allow save screenshot on eval screen with MenuLeft-MenuRight-Start
This commit is contained in:
@@ -61,7 +61,8 @@ const CString g_sCodeNames[CodeDetector::NUM_CODES] = {
|
||||
"NextGame",
|
||||
"NextGame2",
|
||||
"NextBannerGroup",
|
||||
"NextBannerGroup2"
|
||||
"NextBannerGroup2",
|
||||
"SaveScreenshot"
|
||||
};
|
||||
|
||||
CodeItem g_CodeItems[CodeDetector::NUM_CODES];
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
CODE_NEXT_GAME2,
|
||||
CODE_BW_NEXT_GROUP,
|
||||
CODE_BW_NEXT_GROUP2,
|
||||
CODE_SAVE_SCREENSHOT,
|
||||
NUM_CODES // leave this at the end
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "SDL_utils.h"
|
||||
#include "SDL_image.h"
|
||||
#include "RageFile.h"
|
||||
#include "SDL_SaveJPEG.h"
|
||||
|
||||
// needs to be added to avoid an error
|
||||
#include "SDL_SaveJPEG.h"
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "song.h"
|
||||
#include "StageStats.h"
|
||||
#include "Grade.h"
|
||||
#include "CodeDetector.h"
|
||||
#include "RageDisplay.h"
|
||||
#include "StepMania.h"
|
||||
|
||||
const int NUM_SCORE_DIGITS = 9;
|
||||
|
||||
@@ -139,6 +142,9 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
|
||||
|
||||
m_bFailed = false; // the evaluation is not showing failed results by default
|
||||
|
||||
ZERO( m_bSavedScreenshot );
|
||||
|
||||
|
||||
m_sName = sClassName;
|
||||
if( !TYPE.CompareNoCase("stage") )
|
||||
m_Type = stage;
|
||||
@@ -1304,6 +1310,26 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
|
||||
if( m_Menu.IsTransitioning() )
|
||||
return;
|
||||
|
||||
if( GameI.IsValid() )
|
||||
{
|
||||
PlayerNumber pn = GAMESTATE->GetCurrentStyleDef()->ControllerToPlayerNumber( GameI.controller );
|
||||
|
||||
if( CodeDetector::EnteredCode(GameI.controller, CodeDetector::CODE_SAVE_SCREENSHOT) )
|
||||
{
|
||||
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
|
||||
PROFILEMAN->IsUsingProfile(pn) )
|
||||
{
|
||||
/* XXX: What's the difference between this and StyleI.player? */
|
||||
/* StyleI won't be valid if it's a menu button that's pressed.
|
||||
* There's got to be a better way of doing this. -Chris */
|
||||
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn);
|
||||
SaveScreenshot( sDir );
|
||||
m_bSavedScreenshot[pn] = true;
|
||||
return; // handled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ protected:
|
||||
bool m_bPassFailTriggered; // has the pass / fail sound been played yet?
|
||||
RageTimer m_timerSoundSequences; // timer used for triggering sounds.
|
||||
vector<EvalSoundSequence> m_SoundSequences; // a sequence of sounds to be played (although they're stored in no particular order!)
|
||||
bool m_bSavedScreenshot[NUM_PLAYERS];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -85,7 +85,6 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic( CString sName ) : Screen( sName )
|
||||
m_bScanning = false;
|
||||
m_fRemainingWaitTime = 0.0f;
|
||||
i_ErrorDetected=0;
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
if(PREVIEWMUSICMODE == 4)
|
||||
{
|
||||
|
||||
@@ -63,8 +63,6 @@ ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : Screen( sClassNam
|
||||
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
|
||||
GAMESTATE->FinishStage();
|
||||
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectCourse music") );
|
||||
|
||||
m_MusicWheel.Load();
|
||||
|
||||
@@ -99,8 +99,6 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName
|
||||
if( GAMESTATE->m_PlayMode == PLAY_MODE_INVALID )
|
||||
RageException::Throw( "The PlayMode has not been set. A theme must set the PlayMode before loading ScreenSelectMusic." );
|
||||
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
m_MusicWheel.Load();
|
||||
|
||||
int p;
|
||||
@@ -690,6 +688,8 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
|
||||
|
||||
|
||||
/* XXX: What's the difference between this and StyleI.player? */
|
||||
/* StyleI won't be valid if it's a menu button that's pressed.
|
||||
* There's got to be a better way of doing this. -Chris */
|
||||
PlayerNumber pn = GAMESTATE->GetCurrentStyleDef()->ControllerToPlayerNumber( GameI.controller );
|
||||
if( !GAMESTATE->IsHumanPlayer(pn) )
|
||||
return;
|
||||
|
||||
@@ -80,8 +80,6 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
|
||||
LIGHTSMAN->SetLightMode( LIGHTMODE_JOINING ); // do this after Reset!
|
||||
|
||||
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
m_sprLogo.Load( THEME->GetPathToG(ssprintf("ScreenLogo %s",GAMESTATE->GetCurrentGameDef()->m_szName)) );
|
||||
m_sprLogo.Command( PREFSMAN->m_iCoinMode==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND );
|
||||
this->AddChild( &m_sprLogo );
|
||||
|
||||
+28
-18
@@ -31,6 +31,8 @@
|
||||
|
||||
#include "SDL_utils.h"
|
||||
|
||||
#include "CodeDetector.h"
|
||||
|
||||
//
|
||||
// StepMania global classes
|
||||
//
|
||||
@@ -995,6 +997,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
ResetGame();
|
||||
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
/* Initialize which courses are ranking courses here. */
|
||||
SONGMAN->UpdateRankingCourses();
|
||||
|
||||
@@ -1079,6 +1083,28 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SaveScreenshot( CString sDir, bool bSaveUncompressed )
|
||||
{
|
||||
// Save Screenshot.
|
||||
CString sPath;
|
||||
|
||||
FlushDirCache();
|
||||
|
||||
/* XXX slow? */
|
||||
for( int i=0; i<10000; i++ )
|
||||
{
|
||||
sPath = ssprintf( sDir+"screen%04d.%s",i,bSaveUncompressed ? "bmp" : "jpg" );
|
||||
if( !DoesFileExist(sPath) )
|
||||
break;
|
||||
}
|
||||
bool bResult = DISPLAY->SaveScreenshot( sPath, bSaveUncompressed ? RageDisplay::bmp : RageDisplay::jpg );
|
||||
if( bResult )
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common screenshot") );
|
||||
else
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common invalid") );
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/* Returns true if the key has been handled and should be discarded, false if
|
||||
* the key should be sent on to screens. */
|
||||
bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput GameI, MenuInput MenuI, StyleInput StyleI )
|
||||
@@ -1124,6 +1150,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
|
||||
TEXTUREMAN->ReloadAll();
|
||||
SCREENMAN->ReloadCreditsText();
|
||||
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_CurGame );
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
// HACK: Also save bookkeeping and profile info for debugging
|
||||
// so we don't have to play through a whole song to get new output.
|
||||
@@ -1178,24 +1205,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
|
||||
{
|
||||
// If holding LShift save a BMP, else save a JPG
|
||||
bool bSaveBmp = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT) );
|
||||
|
||||
// Save Screenshot.
|
||||
CString sPath;
|
||||
|
||||
FlushDirCache();
|
||||
|
||||
/* XXX slow? */
|
||||
for( int i=0; i<10000; i++ )
|
||||
{
|
||||
sPath = ssprintf("Screenshots/screen%04d.%s",i,bSaveBmp?"bmp":"jpg");
|
||||
if( !DoesFileExist(sPath) )
|
||||
break;
|
||||
}
|
||||
bool bResult = DISPLAY->SaveScreenshot( sPath, bSaveBmp ? RageDisplay::bmp : RageDisplay::jpg );
|
||||
if( bResult )
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common screenshot") );
|
||||
else
|
||||
SOUND->PlayOnce( THEME->GetPathToS("Common invalid") );
|
||||
SaveScreenshot( "Screenshots/", bSaveBmp ? RageDisplay::bmp : RageDisplay::jpg );
|
||||
return true; // handled
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ void ResetGame( bool ReturnToFirstScreen=true );
|
||||
void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame=true );
|
||||
void SaveGamePrefsToDisk();
|
||||
void ChangeCurrentGame( Game g );
|
||||
bool SaveScreenshot( CString sDir, bool bSaveUncompressed = false );
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
#include "windows.h"
|
||||
|
||||
Reference in New Issue
Block a user