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>
84 lines
1.6 KiB
C++
84 lines
1.6 KiB
C++
|
|
#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ÀÎÁö WavÀÎÁö ÆÇ´Ü.
|
|
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
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|