Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
83
GameTools/SoundLib/SoundGlobal.cpp
Normal file
83
GameTools/SoundLib/SoundGlobal.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
#include "SoundGlobal.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#pragma comment(lib, "dsound.lib")
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
#pragma comment(lib, "dxerr8.lib")
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
bool IsFileExist2( const char * szFilename )
|
||||
{
|
||||
std::ifstream file( szFilename );
|
||||
|
||||
bool r = file.is_open() ? true : false;
|
||||
|
||||
file.close();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
bool IsWaveFile( const char * szFilename )
|
||||
{
|
||||
//Ogg<67><67><EFBFBD><EFBFBD> Wav<61><76><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD>.
|
||||
char szExt[128];
|
||||
_splitpath( szFilename, NULL, NULL, NULL, szExt );
|
||||
strlwr( szExt );
|
||||
|
||||
if( strcmp( szExt, WAVEFILEEXT ) == 0 )
|
||||
return true;
|
||||
else if( strcmp( szExt, WAVEFILEEXT2 ) == 0 )
|
||||
return true;
|
||||
else if( strcmp( szExt, FAKEFILEEXT ) == 0 )
|
||||
return true;
|
||||
else if( strcmp( szExt, OGGFILEEXT ) == 0 )
|
||||
return false;
|
||||
else
|
||||
SNDError( "Unknown file type : %s", szFilename );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
void SNDError( const char * Msg, ... )
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start( args, Msg );
|
||||
|
||||
char szBuffer[256];
|
||||
vsprintf( szBuffer, Msg, args );
|
||||
|
||||
throw std::bad_exception( szBuffer );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
void SNDError_Debug( const char * Msg, ... )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
va_list args;
|
||||
|
||||
va_start( args, Msg );
|
||||
|
||||
char szBuffer[256];
|
||||
vsprintf( szBuffer, Msg, args );
|
||||
|
||||
throw std::bad_exception( szBuffer );
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
Reference in New Issue
Block a user