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:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,335 @@
#include "StreamHandler.h"
#include "StreamBuffer.h"
#include <vector>
#include <algorithm>
#include <windows.h>
//#define HANDLER_LOG
#ifdef HANDLER_LOG
#include <fstream>
std::ofstream HandlerLog;
#endif
/////////////////////////////////////////////////////////////////////////////////////////
//
DWORD __stdcall NotificationProc( void * );
/////////////////////////////////////////////////////////////////////////////////////////
//
CStreamHandler::CStreamHandler()
: m_pHandles( new HANDLES )
, m_pStreamBuffers( new STREAMBUFFERS )
, m_dwNotifyThreadID( 0 )
, m_hNotifyThread( 0 )
{
#ifdef HANDLER_LOG
HandlerLog.open( "HandlerLog.txt" );
#endif
}
/////////////////////////////////////////////////////////////////////////////////////////
//
CStreamHandler::~CStreamHandler()
{
Destroy();
delete m_pHandles;
delete m_pStreamBuffers;
#ifdef HANDLER_LOG
HandlerLog.close();
#endif
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamHandler::Create()
{
m_hNotifyThread = CreateThread( NULL, 0, NotificationProc, this, 0, &m_dwNotifyThreadID );
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamHandler::Destroy()
{
if( m_hNotifyThread != 0 )
{
PostThreadMessage( m_dwNotifyThreadID, WM_QUIT, 0, 0 );
WaitForSingleObject( m_hNotifyThread, INFINITE );
CloseHandle( m_hNotifyThread );
m_dwNotifyThreadID = 0;
m_hNotifyThread = 0;
}
m_pHandles->clear();
m_pStreamBuffers->clear();
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamHandler::Add( CStreamBuffer & streamBuffer )
{
// m_pHandles->push_back( streamBuffer.GetEventNotify() );
m_pStreamBuffers->push_back( &streamBuffer );
UpdateStreamHandles();
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamHandler::Remove( CStreamBuffer & streamBuffer )
{
STREAMBUFFERS::iterator it = find( m_pStreamBuffers->begin(), m_pStreamBuffers->end(), &streamBuffer );
if( it != m_pStreamBuffers->end() )
m_pStreamBuffers->erase( it );
/* HANDLES::iterator it2 = find( m_pHandles->begin(), m_pHandles->end(), streamBuffer.GetEventNotify() );
if( it2 != m_pHandles->end() )
m_pHandles->erase( it2 );*/
UpdateStreamHandles();
}
void CStreamHandler::UpdateStreamHandles()
{
m_pHandles->clear();
STREAMBUFFERS::iterator it = m_pStreamBuffers->begin();
STREAMBUFFERS::iterator it_end = m_pStreamBuffers->end();
//MsgWaitForMultipleObject<63><74> Ǯ<><C7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƹ<EFBFBD> <20>޽<EFBFBD><DEBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
PostThreadMessage( m_dwNotifyThreadID, WM_PAINT, 0, 0 );
for( ; it != it_end; it++ )
{
CStreamBuffer * p = *it;
m_pHandles->push_back( p->GetEventNotify() );
}
#ifdef HANDLER_LOG
char szBuf[1024];
HandlerLog << "---UpdateStreamHandles Begin---\n";
for( int i = 0; i < m_pHandles->size(); i++ )
{
HANDLE h = m_pHandles->at( i );
sprintf( szBuf, "Handle #%d : 0x%X", i, h );
HandlerLog << szBuf << endl;
}
HandlerLog << "---UpdateStreamHandles End---\n";
#endif
}
/////////////////////////////////////////////////////////////////////////////////////////
//
DWORD __stdcall NotificationProc( void * lpParameter )
{
typedef CStreamHandler::HANDLES HANDLES;
CStreamHandler * pHandler = (CStreamHandler*)lpParameter;
try {
while( true )
{
unsigned nHandles = pHandler->m_pHandles->size();
if( nHandles <= 0 )
continue;
vector<HANDLE> Handles = *pHandler->m_pHandles;
// HANDLE * pHandles = &pHandler->m_pHandles->at( 0 );
#ifdef HANDLER_LOG
HandlerLog << "--NotificationProc--\n";
char szBuf[256];
for( int i = 0; i < nHandles; i++ )
{
sprintf( szBuf, "Handle #%d : 0x%X", i, Handles[i] );
HandlerLog << szBuf << endl;
}
HandlerLog << "--------------------\n";
#endif
DWORD dwResult = MsgWaitForMultipleObjects( nHandles, &Handles[0], FALSE, INFINITE, QS_ALLEVENTS );
int index = dwResult - WAIT_OBJECT_0;
if( index >= 0 && index < nHandles )
{
CStreamBuffer * pStreamBuffer = pHandler->m_pStreamBuffers->at( index );
pStreamBuffer->HandleNotification();
#ifdef HANDLER_LOG
if( Handles[index] != pStreamBuffer->GetEventNotify() )
{
MessageBox( NULL, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!!!!!!!!!!", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ڵ<EFBFBD> <20>ȸ<EFBFBD><C8B8><EFBFBD>.", MB_OK );
exit( 0 );
}
#endif
}
else
{
MSG msg;
while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
if( msg.message == WM_QUIT )
return 0;
}
}
}
}
catch( exception & e ) {
MessageBox( NULL, e.what(), "Error!!", MB_OK );
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
//
CStreamUpdater::CStreamUpdater()
: m_pHandles( new HANDLES )
, m_pStreamBuffers( new STREAMBUFFERS )
{
}
/////////////////////////////////////////////////////////////////////////////////////////
//
CStreamUpdater::~CStreamUpdater()
{
Destroy();
delete m_pHandles;
delete m_pStreamBuffers;
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamUpdater::Create()
{
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamUpdater::Destroy()
{
m_pHandles->clear();
m_pStreamBuffers->clear();
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamUpdater::Add( CStreamBuffer & streamBuffer )
{
m_pHandles->push_back( streamBuffer.GetEventNotify() );
m_pStreamBuffers->push_back( &streamBuffer );
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamUpdater::Remove( CStreamBuffer & streamBuffer )
{
STREAMBUFFERS::iterator it = find( m_pStreamBuffers->begin(), m_pStreamBuffers->end(), &streamBuffer );
if( it != m_pStreamBuffers->end() )
m_pStreamBuffers->erase( it );
HANDLES::iterator it2 = find( m_pHandles->begin(), m_pHandles->end(), streamBuffer.GetEventNotify() );
if( it2 != m_pHandles->end() )
m_pHandles->erase( it2 );
}
/////////////////////////////////////////////////////////////////////////////////////////
//
void CStreamUpdater::Update()
{
static bool b = true;
try {
if( b )
{
unsigned nHandles = m_pHandles->size();
if( nHandles <= 0 )
return;
HANDLE * pHandles = &m_pHandles->at( 0 );
if( pHandles )
{
DWORD dwResult = MsgWaitForMultipleObjects( nHandles, pHandles, FALSE, 0, QS_ALLEVENTS );
int index = dwResult - WAIT_OBJECT_0;
if( index >= 0 && index < nHandles )
{
CStreamBuffer * pStreamBuffer = m_pStreamBuffers->at( index );
if( pStreamBuffer )
pStreamBuffer->HandleNotification();
}
}
}
}
catch( exception & e ) {
MessageBox( NULL, e.what(), "Error!!", MB_OK );
//exit( 0 );
b = false;
}
}
/////////////////////////////////////////////////////////////////////////////////////////