Added logic to prevent crashing on an invalid initial screen. Added HARDCODED error screen in _fallback for displaying and explaining the error when a theme has an invalid initial screen.

This commit is contained in:
Kyzentun Keeslala
2015-06-06 20:43:39 -06:00
parent e6dc4307b5
commit 1dca128f79
6 changed files with 35 additions and 2 deletions
+4
View File
@@ -16,6 +16,10 @@ Example:
This means that three strings were added to the "ScreenDebugOverlay" section, This means that three strings were added to the "ScreenDebugOverlay" section,
"Mute actions", "Mute actions on", and "Mute actions off". "Mute actions", "Mute actions on", and "Mute actions off".
2015/06/06
----------
* [ScreenInitialScreenIsInvalid] InvalidScreenExplanation
2015/05/09 2015/05/09
---------- ----------
* [OptionExplanations] AxisFix * [OptionExplanations] AxisFix
+5
View File
@@ -4,6 +4,11 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________ ________________________________________________________________________________
2015/06/06
----------
* [ScreenInitialScreenIsInvalid] Error screen for themes that set an invalid
initial screen. [kyzentun]
2015/06/05 2015/06/05
---------- ----------
* [global] update_centering lua function exposed. [kyzentun] * [global] update_centering lua function exposed. [kyzentun]
@@ -0,0 +1,10 @@
return Def.ActorFrame{
Def.BitmapText{
Font= "Common Normal",
Text= THEME:GetString("ScreenInitialScreenIsInvalid", "InvalidScreenExplanation"),
InitCommand= function(self)
self:xy(_screen.cx, _screen.cy):wrapwidthpixels(_screen.w-16)
:diffuse{1, 1, 1, 1}:strokecolor{0, 0, 0, 1}
end
}
}
+2
View File
@@ -1436,6 +1436,8 @@ Could not find '%s'.=Could not find '%s'.
HeaderText= HeaderText=
HeaderSubText= HeaderSubText=
HelpText= HelpText=
[ScreenInitialScreenIsInvalid]
InvalidScreenExplanation=The initial screen set by this theme is not valid. It is not defined anywhere in the theme or in the _fallback theme. This is an error in the theme and should be reported to the theme's author. You can press Scroll Lock (the operator key) to access the service menu and change to a different theme.
[ScreenAppearanceOptions] [ScreenAppearanceOptions]
HeaderText=Appearance HeaderText=Appearance
HeaderSubText=Customize your game HeaderSubText=Customize your game
+4
View File
@@ -1533,6 +1533,10 @@ CancelCancelCommand=
LightsMode="LightsMode_MenuStartAndDirections" LightsMode="LightsMode_MenuStartAndDirections"
ShowCreditDisplay=false ShowCreditDisplay=false
[ScreenInitialScreenIsInvalid]
Class="ScreenWithMenuElements"
Fallback="ScreenWithMenuElements"
[ScreenDebugOverlay] [ScreenDebugOverlay]
Class="ScreenDebugOverlay" Class="ScreenDebugOverlay"
Fallback="Screen" Fallback="Screen"
+10 -2
View File
@@ -354,9 +354,17 @@ void StepMania::ResetGame()
ThemeMetric<RString> INITIAL_SCREEN ("Common","InitialScreen"); ThemeMetric<RString> INITIAL_SCREEN ("Common","InitialScreen");
RString StepMania::GetInitialScreen() RString StepMania::GetInitialScreen()
{ {
if( PREFSMAN->m_sTestInitialScreen.Get() != "" ) if(PREFSMAN->m_sTestInitialScreen.Get() != "" &&
SCREENMAN->IsScreenNameValid(PREFSMAN->m_sTestInitialScreen))
{
return PREFSMAN->m_sTestInitialScreen; return PREFSMAN->m_sTestInitialScreen;
return INITIAL_SCREEN.GetValue(); }
RString screen_name= INITIAL_SCREEN.GetValue();
if(!SCREENMAN->IsScreenNameValid(screen_name))
{
screen_name= "ScreenInitialScreenIsInvalid";
}
return screen_name;
} }
ThemeMetric<RString> SELECT_MUSIC_SCREEN ("Common","SelectMusicScreen"); ThemeMetric<RString> SELECT_MUSIC_SCREEN ("Common","SelectMusicScreen");
RString StepMania::GetSelectMusicScreen() RString StepMania::GetSelectMusicScreen()