Add: Final screen for SMOnline
This commit is contained in:
@@ -0,0 +1 @@
|
||||
_shared2
|
||||
@@ -0,0 +1 @@
|
||||
ScreenSelectMusic score frame p2
|
||||
@@ -745,6 +745,37 @@ ScoreFrameP2OnCommand=hidden,1
|
||||
Fallback=ScreenSelectCourse
|
||||
DefaultSort=Endless
|
||||
|
||||
[ScreenSMOnlineLogin]
|
||||
PlayerNumber=1
|
||||
PasswordBG=
|
||||
NextScreen=ScreenNetRoom
|
||||
PrevScreen=ScreenTitleMenu
|
||||
PasswordBGX=320
|
||||
PasswordBGY=260
|
||||
PasswordBGOnCommand=
|
||||
PasswordBGOffCommand=
|
||||
TitleX=320
|
||||
TitleY=50
|
||||
TitleOnCommand=
|
||||
TitleOffCommand=
|
||||
UserNameX=320
|
||||
UserNameY=150
|
||||
UserNameOnCommand=
|
||||
UserNameOffCommand=
|
||||
PasswordX=250
|
||||
PasswordY=260
|
||||
PasswordOnCommand=
|
||||
PasswordOffCommand=
|
||||
LoginMessageX=320
|
||||
LoginMessageY=290
|
||||
LoginMessageOnCommand=
|
||||
LoginMessageOffCommand=
|
||||
StyleIcon=
|
||||
MemoryCardIcons=
|
||||
TimerSeconds=99
|
||||
HelpText=
|
||||
Fallback=ScreenWithMenuElements
|
||||
|
||||
[ScreenNetRoom]
|
||||
MusicSelectScreen=ScreenSMOnlineSelectMusic
|
||||
TitleBGColor=0.5,0.0,0.5,1.0
|
||||
@@ -3535,7 +3566,7 @@ Choices=1,2,3
|
||||
Condition1=IsNetSMOnline()
|
||||
Condition2=IsNetConnected()
|
||||
Condition3=true
|
||||
NextScreen1=screen,ScreenSMOnlineSelectMusic
|
||||
NextScreen1=screen,ScreenNetRoom
|
||||
NextScreen2=screen,ScreenNetSelectMusic
|
||||
NextScreen3=screen,ScreenSelectMusic
|
||||
|
||||
@@ -3545,7 +3576,7 @@ Choices=1,2,3
|
||||
Condition1=IsNetSMOnline()
|
||||
Condition2=IsNetConnected()
|
||||
Condition3=true
|
||||
NextScreen1=screen,ScreenNetRoom
|
||||
NextScreen1=screen,ScreenSMOnlineLogin
|
||||
NextScreen2=screen,ScreenNetSelectMusic
|
||||
NextScreen3=screen,ScreenSelectMusic
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ ScreenNameEntry.cpp ScreenNameEntry.h ScreenNameEntryTraditional.cpp ScreenNameE
|
||||
ScreenOptions.cpp ScreenOptions.h ScreenOptionsMaster.cpp ScreenOptionsMaster.h \
|
||||
ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h ScreenPackages.cpp ScreenPackages.h ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenNetworkOptions.h \
|
||||
ScreenNetworkOptions.cpp ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenPrompt.cpp ScreenPrompt.h ScreenRanking.cpp ScreenRanking.h \
|
||||
ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenSandbox.cpp ScreenSandbox.h \
|
||||
ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenSandbox.cpp ScreenSandbox.h ScreenSMOnlineLogin.cpp ScreenSMOnlineLogin.h \
|
||||
ScreenSelect.cpp ScreenSelect.h ScreenSelectCharacter.cpp ScreenSelectCharacter.h \
|
||||
ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectGroup.cpp ScreenSelectGroup.h \
|
||||
ScreenSelectMaster.cpp ScreenSelectMaster.h ScreenSelectMode.cpp ScreenSelectMode.h \
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
#include "global.h"
|
||||
|
||||
#if !defined(WITHOUT_NETWORKING)
|
||||
#include "ScreenSMOnlineLogin.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "RageTimer.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "Actor.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "MenuTimer.h"
|
||||
#include "NetworkSyncManager.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameState.h"
|
||||
#include "ScreenDimensions.h"
|
||||
#include "crypto\CryptMD5.h"
|
||||
|
||||
const ScreenMessage SM_SMOnlinePack = ScreenMessage(SM_User+8);
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenSMOnlineLogin );
|
||||
ScreenSMOnlineLogin::ScreenSMOnlineLogin( const CString& sName ) : ScreenWithMenuElements( sName )
|
||||
{
|
||||
m_iPlayer = THEME->GetMetricI( sName, "PlayerNumber" ) - 1;
|
||||
|
||||
m_sUserName = GAMESTATE->GetPlayerDisplayName((PlayerNumber)m_iPlayer);
|
||||
|
||||
m_sprPassword.SetName( "PasswordBG" );
|
||||
m_sprPassword.Load( THEME->GetPathG( m_sName, "PasswordBG" ) );
|
||||
m_sprPassword.SetHorizAlign( align_left );
|
||||
SET_XY_AND_ON_COMMAND( m_sprPassword );
|
||||
this->AddChild( &m_sprPassword );
|
||||
|
||||
m_textTitle.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||
m_textTitle.SetName( "Title" );
|
||||
SET_XY_AND_ON_COMMAND( m_textTitle );
|
||||
this->AddChild( &m_textTitle );
|
||||
|
||||
m_textTitle.SetText( NSMAN->GetServerName() );
|
||||
|
||||
m_textUserName.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||
m_textUserName.SetName( "UserName" );
|
||||
m_textUserName.SetWrapWidthPixels( SCREEN_WIDTH );
|
||||
SET_XY_AND_ON_COMMAND( m_textUserName );
|
||||
this->AddChild( &m_textUserName );
|
||||
|
||||
//XXX: Yuck, this should be metric'ed out when we get a chance
|
||||
m_textUserName.SetText( "You are logging on as " + m_sUserName + " if this is incorrect, please change your profile." );
|
||||
|
||||
m_textPassword.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||
m_textPassword.SetName( "Password" );
|
||||
SET_XY_AND_ON_COMMAND( m_textPassword );
|
||||
this->AddChild( &m_textPassword );
|
||||
m_sPassword = "";
|
||||
|
||||
m_textLoginMessage.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||
m_textLoginMessage.SetName( "LoginMessage" );
|
||||
SET_XY_AND_ON_COMMAND( m_textLoginMessage );
|
||||
this->AddChild( &m_textLoginMessage );
|
||||
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::Input( const DeviceInput& DeviceI, const InputEventType type,
|
||||
const GameInput& GameI, const MenuInput& MenuI,
|
||||
const StyleInput& StyleI )
|
||||
{
|
||||
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
||||
return;
|
||||
|
||||
if( (type != IET_FIRST_PRESS) && (type != IET_SLOW_REPEAT) && (type != IET_FAST_REPEAT ) )
|
||||
return;
|
||||
|
||||
bool bHoldingShift =
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) ||
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT));
|
||||
|
||||
bool bHoldingCtrl =
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) ||
|
||||
(!NSMAN->useSMserver); //If we are disconnected, assume no chatting
|
||||
|
||||
switch( DeviceI.button )
|
||||
{
|
||||
case KEY_ENTER:
|
||||
case KEY_KP_ENTER:
|
||||
if ( m_sPassword != "" )
|
||||
SendLogin();
|
||||
return;
|
||||
break;
|
||||
case KEY_BACK:
|
||||
if(!m_sPassword.empty())
|
||||
m_sPassword = m_sPassword.erase( m_sPassword.size()-1 );
|
||||
UpdateTextInput();
|
||||
break;
|
||||
default:
|
||||
char c;
|
||||
c = DeviceI.ToChar();
|
||||
|
||||
if( bHoldingShift && !bHoldingCtrl )
|
||||
{
|
||||
c = (char)toupper(c);
|
||||
|
||||
switch( c )
|
||||
{
|
||||
case '`': c='~'; break;
|
||||
case '1': c='!'; break;
|
||||
case '2': c='@'; break;
|
||||
case '3': c='#'; break;
|
||||
case '4': c='$'; break;
|
||||
case '5': c='%'; break;
|
||||
case '6': c='^'; break;
|
||||
case '7': c='&'; break;
|
||||
case '8': c='*'; break;
|
||||
case '9': c='('; break;
|
||||
case '0': c=')'; break;
|
||||
case '-': c='_'; break;
|
||||
case '=': c='+'; break;
|
||||
case '[': c='{'; break;
|
||||
case ']': c='}'; break;
|
||||
case '\'': c='"'; break;
|
||||
case '\\': c='|'; break;
|
||||
case ';': c=':'; break;
|
||||
case ',': c='<'; break;
|
||||
case '.': c='>'; break;
|
||||
case '/': c='?'; break;
|
||||
}
|
||||
}
|
||||
if( (c >= ' ') && (!bHoldingCtrl) )
|
||||
{
|
||||
m_sPassword += c;
|
||||
UpdateTextInput();
|
||||
}
|
||||
break;
|
||||
}
|
||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
Screen::HandleScreenMessage( SM );
|
||||
switch( SM )
|
||||
{
|
||||
case SM_GoToPrevScreen:
|
||||
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "PrevScreen") );
|
||||
break;
|
||||
case SM_GoToNextScreen:
|
||||
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "NextScreen") );
|
||||
break;
|
||||
case SM_SMOnlinePack:
|
||||
|
||||
int ResponceCode = NSMAN->m_SMOnlinePacket.Read1();
|
||||
if ( ResponceCode == 0 )
|
||||
{
|
||||
int Status = NSMAN->m_SMOnlinePacket.Read1();
|
||||
if ( Status == 0 )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen );
|
||||
else
|
||||
{
|
||||
CString Responce = NSMAN->m_SMOnlinePacket.ReadNT();
|
||||
m_textLoginMessage.SetText( Responce );
|
||||
}
|
||||
}
|
||||
//Else we ignore it.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
SendLogin();
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::MenuBack( PlayerNumber pn )
|
||||
{
|
||||
SCREENMAN->SendMessageToTopScreen( SM_GoToPrevScreen );
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::TweenOffScreen()
|
||||
{
|
||||
OFF_COMMAND( m_textTitle );
|
||||
OFF_COMMAND( m_textUserName );
|
||||
OFF_COMMAND( m_textPassword );
|
||||
OFF_COMMAND( m_textLoginMessage );
|
||||
OFF_COMMAND( m_sprPassword );
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::UpdateTextInput()
|
||||
{
|
||||
CString PasswordText;
|
||||
|
||||
for ( int i = 0; i < m_sPassword.length(); ++i )
|
||||
PasswordText+='*';
|
||||
|
||||
m_textPassword.SetText( PasswordText );
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::SendLogin()
|
||||
{
|
||||
CString HashedName;
|
||||
CString PreHashedName;
|
||||
|
||||
unsigned char Output[16];
|
||||
const unsigned char *Input = (unsigned char *)m_sPassword.c_str();
|
||||
|
||||
MD5Context BASE;
|
||||
|
||||
memset(&BASE,0,sizeof(MD5Context));
|
||||
memset(&Output,0,16);
|
||||
|
||||
MD5Init( &BASE );
|
||||
|
||||
MD5Update( &BASE, Input, 5);
|
||||
|
||||
MD5Final( Output, &BASE );
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
PreHashedName += ssprintf( "%2X", Output[i] );
|
||||
|
||||
//XXX: Yuck. Convert spaces to 0's better. (will fix soon)
|
||||
for (int i = 0; i < 32; i++)
|
||||
if ( PreHashedName.c_str()[i] == ' ' )
|
||||
HashedName += '0';
|
||||
else
|
||||
HashedName += PreHashedName.c_str()[i];
|
||||
|
||||
NSMAN->m_SMOnlinePacket.ClearPacket();
|
||||
NSMAN->m_SMOnlinePacket.Write1((uint8_t)0); //Login command
|
||||
NSMAN->m_SMOnlinePacket.Write1((uint8_t)0); //MD5 hash style
|
||||
NSMAN->m_SMOnlinePacket.WriteNT(m_sUserName);
|
||||
NSMAN->m_SMOnlinePacket.WriteNT(HashedName);
|
||||
NSMAN->SendSMOnline( );
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Charles Lohr
|
||||
* All rights reserved.
|
||||
* Elements from ScreenTextEntry
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,71 @@
|
||||
/* ScreenSMOnlineLogin - Login for StepMania online */
|
||||
|
||||
#ifndef SCREENSMONLINELOGIN_H
|
||||
#define SCREENSMONLINELOGIN_H
|
||||
|
||||
#include "ScreenWithMenuElements.h"
|
||||
#include "Sprite.h"
|
||||
#include "Quad.h"
|
||||
#include "BitmapText.h"
|
||||
|
||||
class ScreenSMOnlineLogin : public ScreenWithMenuElements
|
||||
{
|
||||
public:
|
||||
ScreenSMOnlineLogin( const CString& sName );
|
||||
|
||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type,
|
||||
const GameInput& GameI, const MenuInput& MenuI,
|
||||
const StyleInput& StyleI );
|
||||
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
virtual void TweenOffScreen();
|
||||
|
||||
void UpdateTextInput();
|
||||
void SendLogin();
|
||||
private:
|
||||
|
||||
BitmapText m_textTitle;
|
||||
|
||||
BitmapText m_textUserName;
|
||||
|
||||
BitmapText m_textPassword;
|
||||
BitmapText m_textLoginMessage;
|
||||
|
||||
CString m_sUserName;
|
||||
CString m_sPassword;
|
||||
|
||||
Sprite m_sprPassword;
|
||||
|
||||
int m_iPlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2004 Charles Lohr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -531,6 +531,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenSongOptions.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenStage.cpp">
|
||||
</File>
|
||||
|
||||
@@ -2800,6 +2800,14 @@ SOURCE=.\ScreenSetTime.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenSMOnlineLogin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenSMOnlineLogin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenSongOptions.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -481,6 +481,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenSetTime.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSongOptions.cpp">
|
||||
</File>
|
||||
|
||||
@@ -614,6 +614,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
<File
|
||||
RelativePath="ScreenSetTime.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSMOnlineLogin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSongOptions.cpp">
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user