Skip to content
This repository was archived by the owner on Aug 6, 2022. It is now read-only.

Commit d789ed3

Browse files
committed
init
0 parents  commit d789ed3

File tree

3,250 files changed

+1319593
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,250 files changed

+1319593
-0
lines changed

common/compiledcaptionswap.cpp

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose: Swap a compiled caption file.
4+
//
5+
// $NoKeywords: $
6+
//=============================================================================//
7+
8+
#include "utlbuffer.h"
9+
#include "byteswap.h"
10+
#include "filesystem.h"
11+
#include "tier2/fileutils.h"
12+
#include "captioncompiler.h"
13+
14+
// memdbgon must be the last include file in a .cpp file!!!
15+
#include "tier0/memdbgon.h"
16+
17+
BEGIN_BYTESWAP_DATADESC( CompiledCaptionHeader_t )
18+
DEFINE_FIELD( magic, FIELD_INTEGER ),
19+
DEFINE_FIELD( version, FIELD_INTEGER ),
20+
DEFINE_FIELD( numblocks, FIELD_INTEGER ),
21+
DEFINE_FIELD( blocksize, FIELD_INTEGER ),
22+
DEFINE_FIELD( directorysize, FIELD_INTEGER ),
23+
DEFINE_FIELD( dataoffset, FIELD_INTEGER ),
24+
END_BYTESWAP_DATADESC()
25+
26+
BEGIN_BYTESWAP_DATADESC( CaptionLookup_t )
27+
DEFINE_FIELD( hash, FIELD_INTEGER ),
28+
DEFINE_FIELD( blockNum, FIELD_INTEGER ),
29+
DEFINE_FIELD( offset, FIELD_SHORT ),
30+
DEFINE_FIELD( length, FIELD_SHORT ),
31+
END_BYTESWAP_DATADESC()
32+
33+
//-----------------------------------------------------------------------------
34+
// Swap a compiled closecaption file
35+
//-----------------------------------------------------------------------------
36+
bool SwapClosecaptionFile( void *pData )
37+
{
38+
CByteswap swap;
39+
swap.ActivateByteSwapping( true );
40+
41+
CompiledCaptionHeader_t *pHdr = (CompiledCaptionHeader_t*)pData;
42+
43+
if ( IsX360() )
44+
{
45+
// pre-swap file header
46+
swap.SwapFieldsToTargetEndian( pHdr );
47+
}
48+
49+
if ( pHdr->magic != COMPILED_CAPTION_FILEID || pHdr->version != COMPILED_CAPTION_VERSION )
50+
{
51+
// bad data
52+
return false;
53+
}
54+
55+
// lookup headers
56+
pData = (byte*)pData + sizeof(CompiledCaptionHeader_t);
57+
swap.SwapFieldsToTargetEndian( (CaptionLookup_t*)pData, pHdr->directorysize );
58+
59+
// unicode data
60+
pData = (byte*)pHdr + pHdr->dataoffset;
61+
swap.SwapBufferToTargetEndian( (wchar_t*)pData, (wchar_t*)pData, pHdr->numblocks * pHdr->blocksize / sizeof(wchar_t) );
62+
63+
if ( IsPC() )
64+
{
65+
// post-swap file header
66+
swap.SwapFieldsToTargetEndian( pHdr );
67+
}
68+
69+
return true;
70+
}
71+
72+
#if defined( CLIENT_DLL )
73+
//-----------------------------------------------------------------------------
74+
// Callback for UpdateOrCreate - generates .360 file
75+
//-----------------------------------------------------------------------------
76+
static bool CaptionCreateCallback( const char *pSourceName, const char *pTargetName, const char *pPathID, void *pExtraData )
77+
{
78+
// Generate the file
79+
CUtlBuffer buf;
80+
bool bOk = g_pFullFileSystem->ReadFile( pSourceName, pPathID, buf );
81+
if ( bOk )
82+
{
83+
bOk = SwapClosecaptionFile( buf.Base() );
84+
if ( bOk )
85+
{
86+
bOk = g_pFullFileSystem->WriteFile( pTargetName, pPathID, buf );
87+
}
88+
else
89+
{
90+
Warning( "Failed to create %s\n", pTargetName );
91+
}
92+
}
93+
return bOk;
94+
}
95+
96+
//-----------------------------------------------------------------------------
97+
// Calls utility function UpdateOrCreate
98+
//-----------------------------------------------------------------------------
99+
int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int maxLen, bool bForce )
100+
{
101+
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
102+
}
103+
#endif

common/gameui/igameui.h

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
// $NoKeywords: $
6+
//=============================================================================//
7+
8+
#ifndef IGAMEUI_H
9+
#define IGAMEUI_H
10+
#ifdef _WIN32
11+
#pragma once
12+
#endif
13+
14+
#include "interface.h"
15+
#include "vgui/IPanel.h"
16+
17+
#if !defined( _X360 )
18+
#include "xbox/xboxstubs.h"
19+
#endif
20+
21+
// reasons why the user can't connect to a game server
22+
enum ESteamLoginFailure
23+
{
24+
STEAMLOGINFAILURE_NONE,
25+
STEAMLOGINFAILURE_BADTICKET,
26+
STEAMLOGINFAILURE_NOSTEAMLOGIN,
27+
STEAMLOGINFAILURE_VACBANNED,
28+
STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
29+
};
30+
31+
enum ESystemNotify
32+
{
33+
SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
34+
SYSTEMNOTIFY_USER_SIGNEDIN,
35+
SYSTEMNOTIFY_USER_SIGNEDOUT,
36+
SYSTEMNOTIFY_XUIOPENING,
37+
SYSTEMNOTIFY_XUICLOSED,
38+
SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
39+
};
40+
41+
//-----------------------------------------------------------------------------
42+
// Purpose: contains all the functions that the GameUI dll exports
43+
//-----------------------------------------------------------------------------
44+
abstract_class IGameUI
45+
{
46+
public:
47+
// initialization/shutdown
48+
virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
49+
virtual void PostInit() = 0;
50+
51+
// connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
52+
virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
53+
54+
virtual void Start() = 0;
55+
virtual void Shutdown() = 0;
56+
virtual void RunFrame() = 0;
57+
58+
// notifications
59+
virtual void OnGameUIActivated() = 0;
60+
virtual void OnGameUIHidden() = 0;
61+
62+
// OLD: Use OnConnectToServer2
63+
virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
64+
65+
virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
66+
virtual void OnLevelLoadingStarted(bool bShowProgressDialog) = 0;
67+
virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
68+
69+
// level loading progress, returns true if the screen needs updating
70+
virtual bool UpdateProgressBar(float progress, const char *statusText) = 0;
71+
// Shows progress desc, returns previous setting... (used with custom progress bars )
72+
virtual bool SetShowProgressText( bool show ) = 0;
73+
74+
// !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
75+
virtual void ShowNewGameDialog( int chapter ) = 0;
76+
77+
// Xbox 360
78+
virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
79+
virtual void SystemNotification( const int notification ) = 0;
80+
virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
81+
virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
82+
virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
83+
virtual void OnCreditsFinished( void ) = 0;
84+
85+
// inserts specified panel as background for level load dialog
86+
virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
87+
88+
// Bonus maps interfaces
89+
virtual void BonusMapUnlock( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
90+
virtual void BonusMapComplete( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
91+
virtual void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) = 0;
92+
virtual void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) = 0;
93+
virtual void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) = 0;
94+
virtual void BonusMapDatabaseSave( void ) = 0;
95+
virtual int BonusMapNumAdvancedCompleted( void ) = 0;
96+
virtual void BonusMapNumMedals( int piNumMedals[ 3 ] ) = 0;
97+
98+
virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
99+
100+
// X360 Storage device validation:
101+
// returns true right away if storage device has been previously selected.
102+
// otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
103+
// once the storage device is selected by user.
104+
virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
105+
106+
virtual void SetProgressOnStart() = 0;
107+
virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
108+
109+
};
110+
111+
#define GAMEUI_INTERFACE_VERSION "GameUI011"
112+
113+
#endif // IGAMEUI_H

0 commit comments

Comments
 (0)