result Wav::testAndLoadFile(MemoryFile *aReader) { delete[] mData; mData = 0; mSampleCount = 0; mChannels = 1; int tag = aReader->read32(); if (tag == MAKEDWORD('O','g','g','S')) { return loadogg(aReader); } else if (tag == MAKEDWORD('R','I','F','F')) { return loadwav(aReader); } else if (tag == MAKEDWORD('f', 'L', 'a', 'C')) { return loadflac(aReader); } else if (loadmp3(aReader) == SO_NO_ERROR) { return SO_NO_ERROR; } return FILE_LOAD_FAILED; }
long XGAppCore::ProcKeyboardCommon(UINT msg, WPARAM wp, LPARAM lp) { short mods; short c; switch (msg) { case WM_KEYDOWN: mods = GetStateFlags(); c = GetExtendedKeyCode(wp,lp); if (c != -1) { mods |= KSpecialKey; XGDispatch::SendDispatch(KXGKeyEvent,MAKEDWORD(mods,c),NULL); return 0; // always marked 'handled.' } else { if (wp == VK_TAB) { XGDispatch::SendDispatch(KXGKeyEvent,MAKEDWORD(mods,c),NULL); return 0; } } return -1; case WM_CHAR: mods = GetStateFlags(); return XGDispatch::SendDispatch(KXGKeyEvent,MAKEDWORD(mods,wp),NULL); case WM_SYSCHAR: mods = GetStateFlags(); return XGDispatch::SendDispatch(KXGMenuKey,MAKEDWORD(mods,wp),NULL); default: return -1; } }
int Wav::testAndLoadFile(DataReader *aReader) { delete[] mData; mData = 0; mSampleCount = 0; int tag = aReader->read32(); if (tag == MAKEDWORD('O','g','g','S')) { aReader->seek(0); int e = 0; stb_vorbis *v = 0; if (aReader->isMemoryFile()) { v = stb_vorbis_open_memory(aReader->currentData(), aReader->dataLength(), &e, 0); } else { v = stb_vorbis_open_file(aReader->filePtr(), 0, &e, 0); } if (0 != v) { return loadogg(v); } return FILE_LOAD_FAILED; } else if (tag == MAKEDWORD('R','I','F','F')) { return loadwav(aReader); } return FILE_LOAD_FAILED; }
/***************************************************** FromAgentToGame_StartGame_REQ *****************************************************/ void FromAgentToGame_StartGame_REQ ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { if ( wSize>=sizeof(UserPacket) ) { UserPacket user; user.SetPacket( (BYTE*)pMsg, wSize ); user.ToPrint(); GameTable * table = g_GameMgr.GetTable( user.GetTableId() ); if (!table) { return; } { TablePacket & pack = table->GetTablePacket(); pack.GetProtocol() = MAKEDWORD( Games_Protocol, StartGame_BRD ); BYTE _seatid = user.GetSeatId(); if (_seatid<3) { user.GetReady() = PK_READY; // 用户参数包,准备标识 pack.GetReady( _seatid ) = PK_READY; // 桌子参数包,准备标识 } if ( pack.GetReady(0)==PK_READY && pack.GetReady(1)==PK_READY && pack.GetReady(2)==PK_READY ) { { pack.GetProtocol() = MAKEDWORD( Games_Protocol, InitCards_BRD ); pack.GetPokerSize(0) = USER_PLAYER; pack.GetPokerSize(1) = USER_PLAYER; pack.GetPokerSize(2) = USER_PLAYER; BYTE * pokers = pack.GetPokers(); Init_Poker_SetUsercards( pokers, POKER_SIZE ); pack.GetInitcards() = PK_INITCARDS; InitCards_Get_Usercards(pack,PK_USER_0,0); InitCards_Get_Usercards(pack,PK_USER_1,1); InitCards_Get_Usercards(pack,PK_USER_2,2); g_pCnpokerServer->SendToAgentServer( (BYTE*)&pack, pack.GetPacketSize() ); } { pack.GetProtocol() = MAKEDWORD( Games_Protocol, CalledLicense_BRD ); pack.GetPlaySeatId() = pack.GetBankerId(); pack.GetBankerId() = 0; pack.GetLimitedTimes() = 16; g_pCnpokerServer->SendToAgentServer( (BYTE*)&pack, pack.GetPacketSize() ); } return; } pack.ToPrint(); g_pCnpokerServer->SendToAgentServer( (BYTE*)&pack, pack.GetPacketSize() ); } } }
//----------------------------------------------------------------------------- void ImgChildWnd::mouseMoved(int X, int Y) { bool bClearStatusbar = false; MainWindow *pWnd = getMainWindow(); if (pWnd == 0 || m_pIplImage == 0) return; if (X >= m_pIplImage->width) bClearStatusbar = true; if (Y >= m_pIplImage->height) bClearStatusbar = true; if (bClearStatusbar) { pWnd->updateStatusbar(WM_STATUSBAR_MOUSEMOVE_MSG_CLEAR, 0, 0); } else { DWORD lParam = MAKEDWORD(X, Y); DWORD wParam = 0; switch (m_pIplImage->depth) { case IPL_DEPTH_8U: if (m_pIplImage->nChannels == 1) { BYTE *ptr = (BYTE *)(m_pIplImage->imageData + Y * m_pIplImage->widthStep); wParam = MAKEDWORD(MAKEWORD(0,0), MAKEWORD(0, ptr[X])); pWnd->updateStatusbar(WM_STATUSBAR_MOUSEMOVE_MSG_GRAY, lParam, wParam); } else if (m_pIplImage->nChannels == 3) { C24 *ptr = (C24 *)(m_pIplImage->imageData + Y * m_pIplImage->widthStep); C24 val = ptr[X]; wParam = MAKEDWORD(MAKEWORD(0, val.c3), MAKEWORD(val.c2, val.c1)); pWnd->updateStatusbar(WM_STATUSBAR_MOUSEMOVE_MSG_COLOR, lParam, wParam); } break; default: break; } } }
BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class #define MAKEDWORD(h,l) (((unsigned long)h << 16) | l) CRect rect; GetClientRect(&rect); switch (pMsg->message) { case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MOUSEMOVE: case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MOUSEWHEEL: { MSG msg; memcpy(&msg, pMsg, sizeof(MSG)); msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_VScrollPos, LOWORD(pMsg->lParam) + m_HScrollPos); msg.pt.x += m_HScrollPos; msg.pt.y += m_VScrollPos; SendCommand(&msg); } break; case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP: if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN) { MSG msg; memcpy(&msg, pMsg, sizeof(MSG)); msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_VScrollPos, LOWORD(pMsg->lParam) + m_HScrollPos); msg.pt.x += m_HScrollPos; msg.pt.y += m_VScrollPos; SendCommand(&msg); } if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) return true; break; default: break; } return CDialog::PreTranslateMessage(pMsg); }
DWORD GetLiftIDbyCode(const char * pChar) { int i = 0; DWORD dwRet = 0; int nLiftID = 0; if (pChar == NULL) { return 0; } if (g_mcmt.nUsrCnt > 0) { for (i = 0; i < g_mcmt.nUsrCnt; i++) { #ifdef MCMT_DEBUG printf("[%s]: %s vs %s\n", __FUNCTION__, pChar, g_mcmt.pMCMT[i].szCode); #endif if (!strcmp(pChar, g_mcmt.pMCMT[i].szCode)) { nLiftID = g_mcmt.pMCMT[i].ucLiftID - 1; if (nLiftID < g_mcmt.nLiftCnt) { dwRet = MAKEDWORD(0, g_mcmt.pLFDA[nLiftID].da1, g_mcmt.pLFDA[nLiftID].da2, g_mcmt.pLFDA[nLiftID].da3); return dwRet; } } } } return dwRet; }
BOOL display::SetDisplayMode(WORD _width, WORD _height, BYTE _bpp) { int error = 0; set_color_depth(_bpp); error = set_gfx_mode(this->mode, _width, _height, 0, 0); if(error != 0) { LogError("Error setting graphics resolution."); LogError("Allegro returned this error message: %s", allegro_error); return false; } this->back = Surface(new surface(_width, _height, _bpp)); this->_screen = Surface(new surface(::screen)); this->_screen->Acquire(); this->_screen->ShowMouse(); this->_screen->Release(); this->width = _width; this->height = _height; this->bpp = _bpp; /*LogMessage("Screen resolution succesfully changed."); LogMessage("Display Width: %d", this->width); LogMessage("Display Height: %d", this->height); LogMessage("Display bits per pixel: %d", this->bpp); LogMessage("Display mode: %d", this->mode);*/ //queue a message stating that the gfx has been changed. QueueMessage(Message(new message(0, MSG_GFX_SCREEN_RES_CHANGED, MAKEDWORD(_width, _height), MAKEDWORD((WORD)_bpp, (WORD)this->mode), NULL))); return true; }
/* boot image fixer uppers called before downloading the image. */ static void fix_bios(struct esas2r_adapter *a, struct esas2r_flash_img *fi) { struct esas2r_component_header *ch = &fi->cmp_hdr[CH_IT_BIOS]; struct esas2r_pc_image *pi; struct esas2r_boot_header *bh; pi = (struct esas2r_pc_image *)((u8 *)fi + ch->image_offset); bh = (struct esas2r_boot_header *)((u8 *)pi + le16_to_cpu(pi->header_offset)); bh->device_id = cpu_to_le16(a->pcid->device); /* Recalculate the checksum in the PNP header if there */ if (pi->pnp_offset) { u8 *pnp_header_bytes = ((u8 *)pi + le16_to_cpu(pi->pnp_offset)); /* Identifier - dword that starts at byte 10 */ *((u32 *)&pnp_header_bytes[10]) = cpu_to_le32(MAKEDWORD(a->pcid->subsystem_vendor, a->pcid->subsystem_device)); /* Checksum - byte 9 */ pnp_header_bytes[9] -= esas2r_calc_byte_cksum(pnp_header_bytes, 32, 0); } /* Recalculate the checksum needed by the PC */ pi->checksum = pi->checksum - esas2r_calc_byte_cksum((u8 *)pi, ch->length, 0); }
result Wav::testAndLoadFile(File *aReader) { delete[] mData; mData = 0; mSampleCount = 0; int tag = aReader->read32(); if (tag == MAKEDWORD('O','g','g','S')) { return loadogg(aReader); } else if (tag == MAKEDWORD('R','I','F','F')) { return loadwav(aReader); } return FILE_LOAD_FAILED; }
int LobbyUpdate::QueryDayRank() { printf("LobbyUpdate::QueryDayRank\n"); char pMsg[1024] = {0}; snprintf( pMsg, sizeof(pMsg), " { \"protocol\":\"%d\" } ", MAKEDWORD( Update_Protocol, DRankInfo_SYN) ); int nLen = strlen(pMsg); g_LobbyServer->SendToDBServer( (BYTE*) pMsg, nLen ); }
/*********************************************************************************** * ����� ���� �˾Ƴ� */ DWORD CVFS_Manager::GetCurVersion (void) { DWORD dwRet = MAKEDWORD( m_wCurVersion[ 1 ] , m_wCurVersion[ 0 ] ); // ((WORD *)&dwRet)[ 0 ] = m_wCurVersion[ 0 ]; // ((WORD *)&dwRet)[ 1 ] = m_wCurVersion[ 1 ]; return dwRet; }
BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg) { #define MAKEDWORD(h,l) (((unsigned long)h << 16) | l) switch (pMsg->message) { case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MOUSEMOVE: case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MOUSEWHEEL: { MSG Msg; memcpy(&Msg, pMsg, sizeof(MSG)); Msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_ulVScrollPos, LOWORD(pMsg->lParam) + m_ulHScrollPos); Msg.pt.x += m_ulHScrollPos; Msg.pt.y += m_ulVScrollPos; SendCommand(&Msg); } break; case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP: if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN) { MSG Msg; memcpy(&Msg, pMsg, sizeof(MSG)); Msg.lParam = MAKEDWORD(HIWORD(pMsg->lParam) + m_ulVScrollPos, LOWORD(pMsg->lParam) + m_ulHScrollPos); Msg.pt.x += m_ulHScrollPos; Msg.pt.y += m_ulVScrollPos; SendCommand(&Msg); } if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) return true; break; } return CDialog::PreTranslateMessage(pMsg); }
/***************************************************** MSG_Handler_CalledBank_REQ *****************************************************/ void MSG_Handler_Reminder_REQ ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { UserSession * pSession = ( UserSession * ) pServerSession; { UserPacket & user = pSession->GetUserPacket(); user.GetProtocol() = MAKEDWORD( Games_Protocol, Reminder_REQ ); user.ToPrint(); g_AgentServer->SendToGameServer( (BYTE*)&user, user.GetPacketSize() ); } }
result WavStream::parse(File *aFile) { int tag = aFile->read32(); int res = SO_NO_ERROR; if (tag == MAKEDWORD('O', 'g', 'g', 'S')) { res = loadogg(aFile); } else if (tag == MAKEDWORD('R', 'I', 'F', 'F')) { res = loadwav(aFile); } else { res = FILE_LOAD_FAILED; } return res; }
BOOL CNPCMoveMgr::AddMoveNpc( WORD wNpcIdx, WORD wMoveIdx ) { // 이동NPC 리소스에서 해당Index를 가진 이동NPC를 구한다 CMoveNPC* pMoveNpc = MOVENPCRES->GetMoveNpc( wNpcIdx ); if( !pMoveNpc ) return FALSE; // 해당 NPC가 존재하지 않는 경우에 추가 (맵 다운이나 재실행으로 인해 MoveNpc가 이중생성된 경우?) if( m_htMoveNpc.GetData( pMoveNpc->GetNPCIdx() ) == NULL ) m_htMoveNpc.Add( pMoveNpc, pMoveNpc->GetNPCIdx() ); // 이동NPC 추가 pMoveNpc->Move( wMoveIdx ); // 이동NPC 이동 pMoveNpc->SetLastMoveTime( gCurTime ); // 마지막 이동시각 갱신 pMoveNpc->SetSendReadyToMove( FALSE ); // 이동준비 플래그 설정 stNPC_MoveInfo* pCurMoveInfo = pMoveNpc->GetCurMoveInfo(); if( !pCurMoveInfo ) return FALSE; // 이동된 정보로 설정해준다(추가시 존재하는 경우 변경) GAMERESRCMNGR->AddMoveNpcInfo( pMoveNpc->GetNPCIdx(), pMoveNpc->GetNPCKindIdx(), pCurMoveInfo->cPos.wx, pCurMoveInfo->cPos.wz, pCurMoveInfo->wDir ); // 유저들에게 추가 메세지 전송 MSG_DWORD4 msg; memset( &msg, 0, sizeof(MSG_DWORD4) ); msg.Category = MP_NPC; msg.Protocol = MP_NPC_ADD_MOVENPC_SYN; msg.dwData1 = MAKEDWORD( pCurMoveInfo->wMapNum, pCurMoveInfo->wDir ); // Map 번호, 방향 msg.dwData2 = MAKEDWORD( pMoveNpc->GetNPCIdx(), pMoveNpc->GetNPCKindIdx() ); // NPC Index, NPC Kind msg.dwData3 = MAKEDWORD( pCurMoveInfo->cPos.wx, pCurMoveInfo->cPos.wz ); // NPC 위치 g_pUserTable->SetPositionUserHead(); CObject* pObject = NULL ; while( (pObject = g_pUserTable->GetUserData()) != NULL ) { if( pObject->GetObjectKind() != eObjectKind_Player ) continue; CPlayer* pReceiver = (CPlayer*)pObject; pReceiver->SendMsg( &msg, sizeof(MSG_DWORD4) ); } return TRUE; }
int acl_create_jointable( char * pInput, WORD wSize) { char buff[1024] = {0}; char format[256] = "{ \"Protocol\":\"%d\"," "\"userid\":\"555\"," "\"roomid\":\"%d\"," "\"tableid\":\"%d\"}"; sprintf( buff, format, MAKEDWORD( Games_Protocol, JoinTable_REQ ), // 131597088 2, 1 ); int len = strlen(buff); if ( len < wSize ) { memcpy(pInput, buff, len); } printf( "[]acl_create_jointable = %d] \n", MAKEDWORD( Games_Protocol, JoinTable_REQ ) ); return len; }
/************************************************ FromClientToAgent_StartGame_REQ ************************************************/ void FromClientToAgent_StartGame_REQ ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { UserSession * pSession = ( UserSession * ) pServerSession; { UserPacket pack = pSession->GetUserPacket(); pack.GetProtocol() = MAKEDWORD( Games_Protocol, StartGame_REQ ); pack.GetReady() = 1; pack.ToPrint(); g_AgentServer->SendToGameServer( (BYTE*)&pack, pack.GetPacketSize() ); } }
void MSG_Handler_QuitTable_REQ ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { DEBUG_MSG( LVL_DEBUG, "QuitTable_REQ to recv: %s \n", (char*) pMsg ); UserSession * pSession = ( UserSession * ) pServerSession; { UserPacket & user = pSession->GetUserPacket(); user.GetProtocol() = MAKEDWORD( Games_Protocol, QuitTable_REQ ); user.ToPrint(); g_AgentServer->SendToGameServer( (BYTE*)&user, user.GetPacketSize() ); } }
void WavStream::load(const char *aFilename) { delete[] mFilename; mFilename = 0; mSampleCount = 0; FILE * fp = fopen(aFilename, "rb"); if (!fp) return; int tag = read32(fp); if (tag == MAKEDWORD('O','g','g','S')) { loadogg(fp); } if (tag == MAKEDWORD('R','I','F','F')) { loadwav(fp); } int len = strlen(aFilename); mFilename = new char[len+1]; memcpy(mFilename, aFilename, len); mFilename[len] = 0; fclose(fp); }
int User_Query_WeekRank( ServerSession * pServerSession, const char * js_text ) { Query_WeekRank * pQuery = Query_WeekRank::ALLOC(); if ( NULL == pQuery ) { return -1; // 比较忙 } char szQueryBuff[256] = {0}; snprintf( szQueryBuff, sizeof(szQueryBuff), " call p_WeekRank(); "); pQuery->SetIndex( MAKEDWORD( (WORD)Update_Protocol, (WORD)WRankInfo_DBR ) ); pQuery->SetVoidObject( pServerSession ); pQuery->SetQuery( szQueryBuff ); pServerSession->DBQuery( pQuery ); return 0; // 比较忙 }
int User_Result_WRankInfo ( ServerSession * pServerSession, Query_WeekRank * pQuery ) { int iError, iIndex, iRate; char* szName; int iSize = pQuery->vctRes.size(); if ( iSize > 0 ) { JsonBuffer js_send ; JsonBuffer js_rank ; JsonBuffer js_array; js_send.clear_buff(); js_send.WriteInteger("protocol", MAKEDWORD( (WORD)Update_Protocol, (WORD)WRankInfo_ANC) ); js_send.WriteString ("userkey", "%d"); for(int i=0; i<iSize; ++i) { iError = pQuery->vctRes[i].m_iError; if ( iError==0 ) { iIndex = pQuery->vctRes[i].m_iIndex; memset( szName, 0x0, sizeof(szName) ); strcat( szName, pQuery->vctRes[i].m_cName ); iRate = pQuery->vctRes[i].m_iRate ; js_rank.clear_buff(); js_rank.WriteInteger("rank", iIndex ); js_rank.WriteString ("name", szName ); js_rank.WriteInteger("rate", iRate ); js_rank.package_one(); js_array.WriteJson(js_rank); } } js_array.package_array(); js_send.WriteJson( "ranking", js_array ); js_send.package_one(); const char * sendMsg = js_send.get_json(); int nLength = strlen(sendMsg); pServerSession->Send( (BYTE*)sendMsg, nLength ); } Query_WeekRank::FREE(pQuery); }
DWORD GetLiftIDbyLayer(int nLayer) { int i = 0; DWORD dwRet = 0; int nLiftID = 0; if (g_mcmt.nUsrCnt > 0) { for (i = 0; i < g_mcmt.nUsrCnt; i++) { if (nLayer == g_mcmt.pMCMT[i].ucLayer) { nLiftID = g_mcmt.pMCMT[i].ucLiftID - 1; dwRet = MAKEDWORD(0, g_mcmt.pLFDA[nLiftID].da1, g_mcmt.pLFDA[nLiftID].da2, g_mcmt.pLFDA[nLiftID].da3); return dwRet; } } } return dwRet; }
/***************************************************** MSG_Handler_Reminder_REQ *****************************************************/ void MSG_Handler_Reminder_ANC ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { if ( wSize>=sizeof(UserPacket) ) { UserPacket user; user.SetPacket( (BYTE*)pMsg, wSize ); user.GetProtocol() = MAKEDWORD( Games_Protocol, Reminder_ANC ); user.ToPrint(); UINT userkey = user.GetUserKey(); char szBuff[4069] = {0}; int uiLength = user.GetReminderSize(); snprintf( szBuff, sizeof(szBuff), "{\"protocol\":%d,\"count\":%d,\"pokers\":[%s]}", user.GetProtocol(), uiLength, (uiLength>0)?(user.GetReminderPokers()):("-1") ); int szLen = strlen(szBuff); g_AgentServer->SendToClient( userkey, (BYTE*)szBuff, szLen ); DEBUG_MSG( LVL_DEBUG, "%s", szBuff); } }
int acl_create_showcards_0( char * pInput, WORD wSize ) { int _battleid = g_GameUser.m_nBattleid; int _seatid = g_GameUser.m_nSeatid; int _userkey = g_GameUser.m_nSeatKey; char buff[1024] = {0}; char format[256] = "{ \"Protocol\":\"%d\", " " \"called\":\"%d\", " " \"battleid\":\"%d\", " " \"status\":\"1\", " " \"seatid\":\"%d\"} "; sprintf( buff, format, MAKEDWORD( Games_Protocol, ShowCards_REQ ), 1, _battleid, _seatid); int len = strlen(buff); if ( len < wSize ) { memcpy(pInput, buff, len); } // printf("%s \n", buff); }
/***************************************************** MSG_Handler_CalledLicense_BRD *****************************************************/ void MSG_Handler_CalledLicense_BRD ( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize ) { if ( wSize>=sizeof(TablePacket) ) { TablePacket table; table.SetPacket( (BYTE*)pMsg, wSize ); table.GetProtocol() = MAKEDWORD( Games_Protocol, CalledLicense_BRD ); table.ToPrint(); UINT userkey1 = table.GetUserKey(0); UINT userkey2 = table.GetUserKey(1); UINT userkey3 = table.GetUserKey(2); char szBuff[4069] = {0}; WORD uiLength = 0; BYTE * pokers = table.GetPokers(); if ( userkey1!=0 ){ memset( szBuff, 0x0, sizeof(szBuff) ); uiLength = table.JsonData(0, szBuff, sizeof(szBuff) ); g_AgentServer->SendToBuffer( userkey1, (BYTE*)szBuff, uiLength ); DEBUG_MSG( LVL_DEBUG, "%s", szBuff); } if ( userkey2!=0 ){ memset( szBuff, 0x0, sizeof(szBuff) ); uiLength = table.JsonData(1, szBuff, sizeof(szBuff) ); g_AgentServer->SendToBuffer( userkey2, (BYTE*)szBuff, uiLength ); DEBUG_MSG( LVL_DEBUG, "%s", szBuff); } if ( userkey3!=0 ){ memset( szBuff, 0x0, sizeof(szBuff) ); uiLength = table.JsonData(2, szBuff, sizeof(szBuff) ); g_AgentServer->SendToBuffer( userkey3, (BYTE*)szBuff, uiLength ); DEBUG_MSG( LVL_DEBUG, "%s", szBuff); } } }
int acl_create_discards( char * pInput, WORD wSize ) { int _battleid = g_GameUser.m_nBattleid; int _seatid = g_GameUser.m_nSeatid; int _userkey = g_GameUser.m_nSeatKey; char buff[1024] = {0}; char format[256] = "{ \"Protocol\":\"%d\", " " \"battleid\":\"%d\", " " \"count\":\"%d\", " " \"poker\":\"%d\", " " \"seatid\":\"%d\"} "; sprintf( buff, format, MAKEDWORD( Games_Protocol, Discards_REQ ) , _battleid, 1, g_GameUser.m_byPokers[0], _seatid); int len = strlen(buff); if ( len < wSize ) { memcpy(pInput, buff, len); } }
void ENGINEAPI InputProc(XEvent *event) { if(bUsingStandardInput) { struct {int x; int y;} point; if(curKBHandler.Num()) { switch(event->type) { case KeyPress: curKBHandler[0](GetUnixInputCode(event->xkey.keycode), 1); break; case KeyRelease: curKBHandler[0](GetUnixInputCode(event->xkey.keycode), 0); break; } } if(curMouseHandler.Num()) { switch(event->type) { case MotionNotify: //x, y); point.x = event->xmotion.x_root; point.y = event->xmotion.y_root; //ClientToScreen(hwnd, &point); curMouseHandler[0](MOUSE_MOVE, curMouseButtonStates, MAKEDWORD(point.x, point.y)); break; /*case WM_MOUSEWHEEL: //0, dist); curMouseHandler[0](MOUSE_WHEEL, curMouseButtonStates, (int)(short)HIWORD(wParam)); break;*/ case ButtonPress: switch(event->xbutton.button) { case Button1: //0, down); curMouseButtonStates |= STATE_LBUTTONDOWN; curMouseHandler[0](MOUSE_LEFTBUTTON, curMouseButtonStates, 1); break; case Button3: //0, down); curMouseButtonStates |= STATE_MBUTTONDOWN; curMouseHandler[0](MOUSE_MIDDLEBUTTON, curMouseButtonStates, 1); break; case Button2: //0, down); curMouseButtonStates |= STATE_RBUTTONDOWN; curMouseHandler[0](MOUSE_RIGHTBUTTON, curMouseButtonStates, 1); break; } break; case ButtonRelease: switch(event->type) { case Button1: //0, up); curMouseButtonStates &= ~STATE_LBUTTONDOWN; curMouseHandler[0](MOUSE_LEFTBUTTON, curMouseButtonStates, 0); break; case Button3: //0, up); curMouseButtonStates &= ~STATE_MBUTTONDOWN; curMouseHandler[0](MOUSE_MIDDLEBUTTON, curMouseButtonStates, 0); break; case Button2: //0, up); curMouseButtonStates &= ~STATE_RBUTTONDOWN; curMouseHandler[0](MOUSE_RIGHTBUTTON, curMouseButtonStates, 0); break; } break; } } } }
result WavStream::loadwav(File * fp) { fp->seek(4); int wavsize = fp->read32(); if (fp->read32() != MAKEDWORD('W', 'A', 'V', 'E')) { return FILE_LOAD_FAILED; } int chunk = fp->read32(); if (chunk == MAKEDWORD('J', 'U', 'N', 'K')) { int size = fp->read32(); if (size & 1) { size += 1; } int i; for (i = 0; i < size; i++) fp->read8(); chunk = fp->read32(); } if (chunk != MAKEDWORD('f', 'm', 't', ' ')) { return FILE_LOAD_FAILED; } int subchunk1size = fp->read32(); int audioformat = fp->read16(); int channels = fp->read16(); int samplerate = fp->read32(); int byterate = fp->read32(); int blockalign = fp->read16(); int bitspersample = fp->read16(); if (audioformat != 1 || subchunk1size != 16 || (bitspersample != 8 && bitspersample != 16)) { return FILE_LOAD_FAILED; } chunk = fp->read32(); if (chunk == MAKEDWORD('L','I','S','T')) { int size = fp->read32(); int i; for (i = 0; i < size; i++) fp->read8(); chunk = fp->read32(); } if (chunk != MAKEDWORD('d','a','t','a')) { return FILE_LOAD_FAILED; } int readchannels = 1; mChannels = channels; if (channels > 1) { readchannels = 2; mChannels = 2; } int subchunk2size = fp->read32(); int samples = (subchunk2size / (bitspersample / 8)) / channels; mDataOffset = fp->pos(); mBits = bitspersample; mBaseSamplerate = (float)samplerate; mSampleCount = samples; mOgg = 0; return 0; }
void CDmiInfo::InitData() { DmiStatus = FALSE; DmiVersion[0] = '\0'; DmiBiosVendor[0] = '\0'; DmiBiosVersion[0] = '\0'; DmiBiosReleaseDate[0] = '\0'; DmiBiosRomSize[0] = '\0'; DmiMotherManufacturer[0] = '\0'; DmiMotherProduct[0] = '\0'; DmiMotherVersion[0] = '\0'; DmiCpuSocket[0] = '\0'; DmiCpuManufacturer[0] = '\0'; DmiCpuVersion[0] = '\0'; DmiCpuCurrentClock[0] = '\0'; DmiCpuExternalClock[0] = '\0'; DmiCpuMaxClock[0] = '\0'; UCHAR b[MAP_MEMORY_SIZE]; UCHAR *d = NULL; _MemReadBlockChar(0x000F0000, b, MAP_MEMORY_SIZE); int j; UCHAR *p; UCHAR *next; DWORD EntryPoint; DWORD StructureLength; DWORD NumberOfStructures; BOOL Flag = FALSE; p = (UCHAR *)b; for(j = 0;j< MAP_MEMORY_SIZE;j+=16) { if( memcmp( p, "_SM_", 4) == 0 ){ sprintf(DmiVersion,"%d.%d",p[6],p[7]); } if( memcmp( p, "_DMI_", 5) == 0 ){ EntryPoint = MAKEDWORD(p[8],p[9],p[0xA],p[0xB]); StructureLength = MAKEWORD(p[6],p[7]); NumberOfStructures = MAKEWORD(p[0xC],p[0xD]); if( CheckSum(p,0xF) ){ DmiStatus = TRUE; Flag = TRUE; } break; } p+=16; } if( Flag == FALSE ){ return ; } d = new UCHAR[StructureLength]; _MemReadBlockChar(EntryPoint, d, StructureLength); DWORD num; p = d; DmiHeader* dmi; for(num = 0;num < NumberOfStructures; num++){ dmi = (DmiHeader*)p; switch ( dmi->Type ){ /////////////////////////////////////////////////////////////////////////////////////////////////// // 00 BIOS Information /////////////////////////////////////////////////////////////////////////////////////////////////// case 0: DmiString(DmiBiosVendor,dmi,p[4]); DmiString(DmiBiosVersion,dmi,p[5]); DmiString(DmiBiosReleaseDate,dmi,p[8]); sprintf(DmiBiosRomSize, "%d", ( (p[9] + 1) << 16 ) / 1024 ); break; /////////////////////////////////////////////////////////////////////////////////////////////////// // 01 System Information /////////////////////////////////////////////////////////////////////////////////////////////////// /* case 1: DmiString(DmiMotherManufacturer,dmi,p[4]); DmiString(DmiMotherProduct,dmi,p[5]); DmiString(DmiMotherVersion,dmi,p[6]); break; */ /////////////////////////////////////////////////////////////////////////////////////////////////// // 02 Base Board Information /////////////////////////////////////////////////////////////////////////////////////////////////// case 2: DmiString(DmiMotherManufacturer,dmi,p[4]); DmiString(DmiMotherProduct,dmi,p[5]); DmiString(DmiMotherVersion,dmi,p[6]); break; /////////////////////////////////////////////////////////////////////////////////////////////////// // 04 Processor Information /////////////////////////////////////////////////////////////////////////////////////////////////// case 4: DmiString(DmiCpuSocket,dmi,p[4]); DmiString(DmiCpuManufacturer,dmi,p[7]); DmiString(DmiCpuVersion,dmi,p[0x10]); sprintf(DmiCpuExternalClock,"%d",MAKEWORD(p[0x12],p[0x13])); sprintf(DmiCpuMaxClock,"%d",MAKEWORD(p[0x14],p[0x15])); sprintf(DmiCpuCurrentClock,"%d",MAKEWORD(p[0x16],p[0x17])); break; } // next next = p + dmi->Length; while( next[0] !=0 || next[1] != 0 ) next++; p = next + 2; } delete d; }