Raised This Month: $ Target: $400
 0% 

File Consistency Checks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RedComet
Junior Member
Join Date: Dec 2005
Old 12-11-2005 , 02:26   File Consistency Checks
Reply With Quote #1

Hey guys, I have a Hl2 coding quesion.

I need to make sure that each client that plays my mod has the exaclty same files that the server does. sv_consistency does not work. Mainly, I just need to make sure that people did not edit my weapon data files (which are encrypted).

Is there any way to use the SDK to utilize file consistency?
RedComet is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-11-2005 , 11:21  
Reply With Quote #2

IVEngine->ForceExactFile( FileName ) during server activate.

That will reject any changes, but if their file is different it disconnects them instead of overwriting or even prompting..
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
cyko
Member
Join Date: Mar 2004
Old 12-11-2005 , 13:39  
Reply With Quote #3

interesting. so there is no way of printing an error in at least console to say 'file.extension is inconsistent with the server. please check your installation and try again." ?
cyko is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-13-2005 , 21:45  
Reply With Quote #4

Nope ala Valve
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
cyko
Member
Join Date: Mar 2004
Old 12-15-2005 , 01:41  
Reply With Quote #5

well it does say that the particular file is inconsistent. however what is really weird is a win32 server reports properly whether a particular file is inconsist or not yet if you compile it for linux (same server files & and same client connecting) the linux server will report inconsistencies on every file regardless.

i'm not really sure of a better way to describe this behavior.

i'd also like to add that this is in fact using SourceMM (for now at least)
cyko is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-15-2005 , 03:06  
Reply With Quote #6

It doesnt matter what you are using, SMM or not.

Im gonna guess you used windows \'s instead of universal /'s ?

Linux uses / in pathnames, windows will accept both.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
cyko
Member
Join Date: Mar 2004
Old 12-15-2005 , 16:14  
Reply With Quote #7

that was a good suggestion and even got me to double check the source to make sure but unfortunately /'s were used.

for example:

Code:
void CheckFiles::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
        m_Engine->ForceExactFile( "scripts/game_sounds.ctx" );
        m_Engine->ForceExactFile( "scripts/game_sounds_physics.ctx" );
        m_Engine->ForceExactFile( "scripts/playerclass_axis_k98.ctx" );
...
        RETURN_META(MRES_IGNORED);
}
(... = listing of more files)

any other ideas?
cyko is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-16-2005 , 10:21  
Reply With Quote #8

I found this in the HL2SDK...
Code:
// Marks the filename for consistency checking.  This should be called after precaching the file.
virtual void		ForceExactFile( const char *s ) = 0;
Maybe try precaching them first..
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
RedComet
Junior Member
Join Date: Dec 2005
Old 12-17-2005 , 14:12  
Reply With Quote #9

Code:
bool CheckFiles::LevelInit(const char *pMapName, const char *pMapEntities, const char *pOldLevel, const char *pLandmarkName, bool loadGame, bool background)
{
	m_Engine->PrecacheSentenceFile( "scripts/game_sounds.txt" );
	m_Engine->PrecacheSentenceFile( "scripts/game_sounds_physics.txt" );
Code:
void CheckFiles::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
	m_Engine->ForceExactFile( "scripts/game_sounds.txt" );
	m_Engine->ForceExactFile( "scripts/game_sounds_physics.txt" );
Works in windows, not in linux D:
RedComet is offline
cyko
Member
Join Date: Mar 2004
Old 12-19-2005 , 14:37  
Reply With Quote #10

when you say precache them first, do you mean server side, client side or both?

hopefully you mean just server side....

we've also tried every precache function there is and i assume for non-sound/model files (this is weapon data files), that PrecacheGeneric is perfectly fine. in fact, i've rewritten this without sourcemm.

all precaching is done at levelinit and ForceExactFile done at ServerActivate level. i also have ForceExactFile nested in an if/then with a IsGenericPrecached()

Code:
void CheckFilesPlugin::LevelInit( char const *pMapName )
{        
        Msg( "Level \"%s\" has been loaded\n", pMapName );
        gameeventmanager->AddListener( this, true );

      engine->PrecacheGeneric( "scripts/game_sounds.txt", true );                
}
Code:
void CheckFilesPlugin::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
{
        if (engine->IsGenericPrecached( "scripts/game_sounds.txt"))
        {
                engine->LogPrint( "scripts/game_sounds.txt successfully cached\n" );
                engine->ForceExactFile( "scripts/game_sounds.txt" );
        }
}
this will print to the log but yet no matter what, there is inconsistency between the client "scripts/game_sounds.txt" and the server "scripts/game_sounds.txt" even if you download the txt directly off the server directory via ftp.

i'm at a complete loss.
cyko is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode