bool CSetItemTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sSET_ITEM_TBLDAT* pSetItem = (sSET_ITEM_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pSetItem->tblidx = READ_DWORD( bstrData ); } else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") ) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pSetItem->bValidity_Able = READ_BOOL( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Semi_Set_Option")) { pSetItem->semiSetOption = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Full_Set_Option")) { pSetItem->fullSetOption = READ_DWORD( bstrData ); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Item_Tblidx_", wcslen(L"Item_Tblidx_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SET_ITEM_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Item_Tblidx_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pSetItem->aItemTblidx[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool CChatCommandTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sCHAT_COMMAND_TBLDAT* pChatCommand = (sCHAT_COMMAND_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pChatCommand->tblidx = READ_DWORD(bstrData); } else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") ) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pChatCommand->bValidity_Able = READ_BOOL(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Animation_Index")) { pChatCommand->wAction_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Chat_Command_", wcslen(L"Chat_Command_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_CHAT_COMMAND; i++ ) { swprintf( szBuffer, 1024, L"Chat_Command_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { if ( 0 == i ) CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pChatCommand->aChat_Command[ i ] = READ_DWORD( bstrData); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { _ASSERT(0); return false; } return true; }
bool TextTable::SetTableData(VOID* pvTable, WCHAR* pwszSheetName, TYPE eType, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sTEXT_TBLDAT* pChatCommand = (sTEXT_TBLDAT*)pvTable; if (eType == INDEX) { pChatCommand->tblidx = READ_DWORD(bstrData); } else if (eType == TEXT) { if (false == READ_STR(pChatCommand->wstrText, bstrData)) { return false; } } else { _ASSERT(0); return false; } } else { _ASSERT(0); return false; } return true; }
bool HelpTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sHELP_TBLDAT* pHelp = (sHELP_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Help_Tblidx")) { pHelp->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Category")) { pHelp->byCategory = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Help_Title")) { pHelp->dwHelpTitle = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Popo_Hint")) { pHelp->dwPopoHint = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Help_HTML_Name")) { READ_STRINGW(bstrData, pHelp->wszHelpHTMLName, _countof(pHelp->wszHelpHTMLName)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Condition_Check")) { pHelp->byConditionCheck = READ_BYTE(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool CHLSMerchantTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sHLS_MERCHANT_TBLDAT* pMerchant = (sHLS_MERCHANT_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pMerchant->tblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Tab_Name")) { pMerchant->Tab_Name = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name_Text")) { READ_STRINGW(bstrData, pMerchant->wszNameText, _countof(pMerchant->wszNameText)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Tab_Type")) { pMerchant->byTabType = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Start_Item_Tblidx")) { pMerchant->startItemTblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"End_Item_Tblidx")) { pMerchant->endItemTblidx = READ_DWORD( bstrData ); } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool CGuideHintTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sGUIDE_HINT_TBLDAT* pGuide = (sGUIDE_HINT_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pGuide->tblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Type")) { pGuide->byType = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"WidthPosition")) { pGuide->byWidthPosition = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"HeightPosition")) { pGuide->byHeightPosition = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"WidthSize")) { pGuide->wWidthSize = READ_WORD( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"HeightSize")) { pGuide->wHeightSize = READ_WORD( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Resource")) { READ_STRING(bstrData, pGuide->szResource, _countof(pGuide->szResource)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { READ_STRING(bstrData, pGuide->szNote, _countof(pGuide->szNote)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Auto_Show")) { pGuide->bAutoShow = READ_BOOL( bstrData, pstrDataName->c_str() ); } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
/* ------------------------------------------------------------------------- Recovery XLOG buffer from the card ------------------------------------------------------------------------- */ static void pri_cpu_trapped (PISDN_ADAPTER IoAdapter) { byte __iomem *base ; word *Xlog ; dword regs[4], TrapID, size ; Xdesc xlogDesc ; /* * check for trapped MIPS 46xx CPU, dump exception frame */ base = DIVA_OS_MEM_ATTACH_ADDRESS(IoAdapter); TrapID = READ_DWORD(&base[0x80]) ; if ( (TrapID == 0x99999999) || (TrapID == 0x99999901) ) { dump_trap_frame (IoAdapter, &base[0x90]) ; IoAdapter->trapped = 1 ; } regs[0] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x70]); regs[1] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x74]); regs[2] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x78]); regs[3] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x7c]); regs[0] &= IoAdapter->MemorySize - 1 ; if ( (regs[0] < IoAdapter->MemorySize - 1) ) { if ( !(Xlog = (word *)diva_os_malloc (0, MAX_XLOG_SIZE)) ) { DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, base); return ; } size = IoAdapter->MemorySize - regs[0] ; if ( size > MAX_XLOG_SIZE ) size = MAX_XLOG_SIZE ; memcpy_fromio(Xlog, &base[regs[0]], size) ; xlogDesc.buf = Xlog ; xlogDesc.cnt = READ_WORD(&base[regs[1] & (IoAdapter->MemorySize - 1)]) ; xlogDesc.out = READ_WORD(&base[regs[2] & (IoAdapter->MemorySize - 1)]) ; dump_xlog_buffer (IoAdapter, &xlogDesc) ; diva_os_free (0, Xlog) ; IoAdapter->trapped = 2 ; } DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, base); }
bool MobMovePatternTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sMOVE_PATTERN_TBLDAT* pPattern = (sMOVE_PATTERN_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pPattern->tblidx = READ_DWORD(bstrData); } else if (0 == wcsncmp(pstrDataName->c_str(), L"Pattern_", wcslen(L"Pattern_"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_COUNT_MOVE_PATTERN; i++) { swprintf(szBuffer, 1024, L"Pattern_%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pPattern->abyPattern[i] = READ_BYTE(bstrData, pstrDataName->c_str()); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { // READ_STR( pPattern->wstrNote, bstrData); // 메모리에 로드하지 않는다. } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
// PwrSmu9MessageService: Smu9 message is used for reading counter table base address. static bool PwrSmu9MessageService(Smu9Interface* pSmu, uint32 msgId, uint32* arg, uint32* pData, uint32 retry) { bool ret = false; volatile uint32 repeatCnt = retry; uint64 res = 0; // Write 0 to resp to check if it is busy WRITE_DWORD(pSmu->m_msg.m_resp, 0); // Write argument if any if (NULL != arg) { WRITE_DWORD(pSmu->m_msg.m_arg, *arg); } // Write message id WRITE_DWORD(pSmu->m_msg.m_msg, msgId); // Wait for completion do { res = READ_DWORD(pSmu->m_msg.m_resp); if (res & SMC_RESULT_OK) { ret = true; } } while ((false == ret) && --repeatCnt); // Read the result if ((true == ret) && (NULL != pData)) { *pData = (uint32)READ_DWORD(pSmu->m_msg.m_arg); } return ((true == ret) && (NULL != pData)) ? true : false; }
// PwrSmu9ReadIndexDataMapping: Index and data pair mapping for reading soft register values static void PwrSmu9ReadIndexDataMapping(Smu9Interface* pSmu, uint64 reg, uint32* pValue) { if (SMU_REG_ADDRESS_UNDEFINED != reg) { // use indirect mapping uint32* Reg = (uint32*)pSmu->m_gmmxPair.m_index; WRITE_DWORD(Reg, (uint32)reg); *pValue = READ_DWORD((uint32*)pSmu->m_gmmxPair.m_data); } else { *pValue = 0xDEADBEEF; } }
VOID vFillKernPairs(BYTE *pjKernOut, BYTE *pjPFM) { DWORD dpPairKernTable = READ_DWORD(&pjPFM[OFF_PairKernTable]); ULONG cKernPairs; BYTE *pjKern; WCHAR awcKern[2]; FD_KERNINGPAIR *pkp, *pkpEnd; if (!dpPairKernTable) return; // first WORD is the number of kerning pairs to follow cKernPairs = READ_WORD(&pjPFM[dpPairKernTable]); // skip the count, point to data: pjKern = &pjPFM[dpPairKernTable + sizeof(WORD)]; pkp = (FD_KERNINGPAIR *)pjKernOut; pkpEnd = &pkp[cKernPairs]; // 4 == sizeof(BYTE) + sizeof(BYTE) + sizeof(WORD) for ( ; pkp < pkpEnd; pkp++, pjKern += 4) { // Upon every entry to this loop the input data looks as follows // pjKern[0] = iCh1; // pjKern[1] = iCh2; // This is followed by a WORD of data for the Kerning distance. // The ANSI character codes for each character // of the kerning pair need to be converted to UNICODE: MULTIBYTETOUNICODE(awcKern, (2 * sizeof(WCHAR)),NULL, pjKern, 2); pkp->wcFirst = awcKern[0]; pkp->wcSecond = awcKern[1]; pkp->fwdKern = (FWORD)READ_WORD(&pjKern[2]); } // fill in the zero terminator: pkpEnd->wcFirst = 0; pkpEnd->wcSecond = 0; pkpEnd->fwdKern = 0; }
/* -------------------------------------------------------------------------- PRI Adapter interrupt Service Routine -------------------------------------------------------------------------- */ static int pri_ISR (struct _ISDN_ADAPTER* IoAdapter) { byte __iomem *cfg = DIVA_OS_MEM_ATTACH_CFG(IoAdapter); if ( !(READ_DWORD(cfg) & 0x80000000) ) { DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfg); return (0) ; } /* clear interrupt line */ WRITE_DWORD(cfg, (dword)~0x03E00000) ; DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfg); IoAdapter->IrqCount++ ; if ( IoAdapter->Initialized ) { diva_os_schedule_soft_isr (&IoAdapter->isr_soft_isr); } return (1) ; }
// parse_header: populates a kssl_header structure from a byte stream. Returns // KSSL_ERROR_NONE if successful. kssl_error_code parse_header(BYTE *bytes, // Stream of bytes // containing a // kssl_header kssl_header *header) { // Returns the populated // header (must be // allocated by caller) int offset = 0; if (bytes == NULL || header == NULL) { return KSSL_ERROR_INTERNAL; } header->version_maj = READ_BYTE(bytes, offset); header->version_min = READ_BYTE(bytes, offset); header->length = READ_WORD(bytes, offset); header->id = READ_DWORD(bytes, offset); return KSSL_ERROR_NONE; }
VOID vReadCharWidths(USHORT *ausCharWidths, BYTE *pjPFM) { DWORD dfWidthOffset = READ_DWORD(&pjPFM[OFF_ExtentTable]); BYTE *pjWidths = pjPFM + dfWidthOffset; USHORT usWidth; INT i,iFirst,iLast; if (!dfWidthOffset) // fixed pitch font { usWidth = READ_WORD(&pjPFM[OFF_MaxWidth]); for (i = 0; i < 256; i++) ausCharWidths[i] = usWidth; } else { usWidth = READ_WORD(&pjWidths[2 * pjPFM[OFF_DefaultChar]]); // it turns out that this value is sometimes bogus, i.e. negative. // It seems that win 31 in this case replaces the bogus value by zero: if (usWidth & 0x8000) usWidth = 0; for (i = 0; i < 256; i++) ausCharWidths[i] = usWidth; iFirst = (INT)pjPFM[OFF_FirstChar]; iLast = (INT)pjPFM[OFF_LastChar]; for (i = iFirst; i <= iLast; i++) // iLast inclusive { ausCharWidths[i] = READ_WORD(&pjWidths[2 * (i-iFirst)]); if (ausCharWidths[i] & 0x8000) ausCharWidths[i] = 0; // fix bogus ones. } } }
bool DragonBallTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sDRAGONBALL_TBLDAT* pDragonBall = (sDRAGONBALL_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pDragonBall->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Altar_Group")) { pDragonBall->dwAltarGroup = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Type")) { pDragonBall->byBallType = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_1_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[0] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_2_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[1] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_3_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[2] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_4_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[3] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_5_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[4] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_6_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[5] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_7_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->aBallTblidx[6] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Drop_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->ballDropTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Ball_Junk_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pDragonBall->ballJunkTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Start_Dialog")) { pDragonBall->startDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"End_Dialog")) { pDragonBall->endDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Hurry_Dialog")) { pDragonBall->hurryDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Timeover_Dialog")) { pDragonBall->timeoverDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"No_Repeat_Dialog")) { pDragonBall->noRepeatDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dragon_NPC_Tblidx")) { pDragonBall->dragonNPCTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Default_Summon_Chat")) { pDragonBall->defaultSummonChat = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Inventory_Full_Dialog")) { pDragonBall->inventoryFullDialog = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appear_Dir_X")) { pDragonBall->fDir.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appear_Dir_Z")) { pDragonBall->fDir.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
int ipx_int7a(void) { u_short port; /* port here means DOS IPX socket */ u_short newPort; u_char *AddrPtr; far_t ECBPtr; unsigned long network; int hops, ticks; n_printf("IPX: request number 0x%x\n", LWORD(ebx)); switch (LWORD(ebx)) { case IPX_OPEN_SOCKET: if (LO(ax) != 0xff) n_printf("IPX: OpenSocket: longevity flag (%#x) not supported\n", LO(ax)); port = LWORD(edx); newPort = 0; LO(ax) = IPXOpenSocket(port, &newPort); if (LO(ax) == RCODE_SUCCESS) LWORD(edx) = newPort; break; case IPX_CLOSE_SOCKET: port = LWORD(edx); LO(ax) = IPXCloseSocket(port); break; case IPX_GET_LOCAL_TARGET: /* do nothing here because routing is handled by IPX */ /* normally this would return an ImmediateAddress, but */ /* the ECB ImmediateAddress is never used, so just return */ network = READ_DWORD(SEGOFF2LINEAR(REG(es), LWORD(esi))); n_printf("IPX: GetLocalTarget for network %08lx\n", network ); if( network==0 || memcmp(&network, MyAddress, 4) == 0 ) { n_printf("IPX: returning GLT success for local address\n"); LO(ax) = RCODE_SUCCESS; LWORD(ecx) = 1; } else { if( IPXGetLocalTarget( network, &hops, &ticks )==0 ) { LO(ax) = RCODE_SUCCESS; LWORD(ecx) = ticks; } else { n_printf("IPX: GetLocalTarget failed.\n"); LO(ax) = RCODE_CANNOT_FIND_ROUTE; } } break; case IPX_FAST_SEND: n_printf("IPX: fast send\n"); /* just fall through to regular send */ case IPX_SEND_PACKET: { int ret; ECBPtr.segment = REG(es); ECBPtr.offset = LWORD(esi); n_printf("IPX: send packet ECB at %p\n", ECBp); /* What the hell is the async send? Do it synchroniously! */ ret = IPXSendPacket(ECBPtr); if ((ret == RCODE_SUCCESS) && FARt_PTR(ECBp->ESRAddress)) ipx_esr_call(ECBPtr, ESR_CALLOUT_IPX); LO(ax) = ret; break; } case IPX_LISTEN_FOR_PACKET: ECBPtr.segment = REG(es); ECBPtr.offset = LWORD(esi); n_printf("IPX: listen for packet, ECB at %x:%x\n", ECBPtr.segment, ECBPtr.offset); /* put this packet on the queue of listens for this socket */ LO(ax) = IPXListenForPacket(ECBPtr); break; case IPX_SCHEDULE_IPX_EVENT: ECBPtr.segment = REG(es); ECBPtr.offset = LWORD(esi); n_printf("IPX: schedule IPX event for ECB at %x:%x\n", ECBPtr.segment, ECBPtr.offset); /* put this packet on the queue of AES events for this socket */ LO(ax) = IPXScheduleEvent(ECBPtr, IU_ECB_IPX_WAITING, LWORD(eax)); break; case IPX_CANCEL_EVENT: ECBPtr.segment = REG(es); ECBPtr.offset = LWORD(esi); n_printf("IPX: cancel event for ECB at %p\n", ECBp); LO(ax) = IPXCancelEvent(ECBPtr); break; case IPX_SCHEDULE_AES_EVENT: ECBPtr.segment = REG(es); ECBPtr.offset = LWORD(esi); n_printf("IPX: schedule AES event ECB at %p\n", FARt_PTR(ECBPtr)); /* put this packet on the queue of AES events for this socket */ LO(ax) = IPXScheduleEvent(ECBPtr, IU_ECB_AES_WAITING, LWORD(eax)); break; case IPX_GET_INTERVAL_MARKER: /* Note that timerticks is actually an unsigned long in BIOS */ /* this works because of intel lo-hi architecture */ LWORD(eax) = READ_WORD(BIOS_TICK_ADDR); n_printf("IPX: get interval marker %d\n", LWORD(eax)); /* n_printf("IPX: doing extra relinquish control\n"); */ IPXRelinquishControl(); break; case IPX_GET_INTERNETWORK_ADDRESS: n_printf("IPX: get internetwork address\n"); AddrPtr = SEG_ADR((u_char *), es, si); memcpy(AddrPtr, MyAddress, 10); break; case IPX_RELINQUISH_CONTROL: n_printf("IPX: relinquish control\n"); IPXRelinquishControl(); break; case IPX_DISCONNECT: n_printf("IPX: disconnect\n"); break; case IPX_SHELL_HOOK: n_printf("IPX: shell hook\n"); break; case IPX_GET_MAX_PACKET_SIZE: n_printf("IPX: get max packet size\n"); /* return max data size in AX, and suggested retries in CL */ /* DANG_FIXTHIS - return a real max packet size here */ LWORD(eax) = 1024; /* must be a power of 2 */ LO(cx) = 20; break; case IPX_GET_MEDIA_DATA_SIZE: n_printf("IPX: get max packet size\n"); /* return max data size in AX, and suggested retries in CL */ /* DANG_FIXTHIS - return a real max media size here */ LWORD(eax) = 1480; LO(cx) = 20; break; case IPX_CLEAR_SOCKET: n_printf("IPX: clear socket\n"); break; default: n_printf("IPX: Unimplemented function.\n"); break; } return 1; }
BOOL bInitWinResData( PVOID pvView, COUNT cjView, PWINRESDATA pwrd ) { PBYTE pjNewExe; // ptr to the beginning of the new exe hdr PBYTE pjResType; // ptr to the beginning of TYPEINFO struct PBYTE pjResName; // ptr to the beginning of NAMEINFO struct ULONG iResID; // resource type id #ifdef DUMPCALL DbgPrint("\nbInitWinResData("); DbgPrint("\n PFILEVIEW pfvw = %-#8lx", pfvw); DbgPrint("\n PWINRESDATA pwrd = %-#8lx", pwrd); DbgPrint("\n )\n"); #endif pwrd->pvView = pvView; pwrd->cjView = cjView; // check the magic # at the beginning of the old header if (US_GET(pvView, OFF_e_magic) != EMAGIC) return(FALSE); pwrd->dpNewExe = (PTRDIFF)READ_DWORD((PBYTE)pvView + OFF_e_lfanew); // make sure that offset is consistent if ((ULONG)pwrd->dpNewExe > pwrd->cjView) return FALSE; pjNewExe = (PBYTE)pvView + pwrd->dpNewExe; if (US_GET(pjNewExe, OFF_ne_magic) != NEMAGIC) return(FALSE); pwrd->cjResTab = (ULONG)(US_GET(pjNewExe, OFF_ne_restab) - US_GET(pjNewExe, OFF_ne_rsrctab)); if (pwrd->cjResTab == 0L) { // // The following test is applied by DOS, so I presume that it is // legitimate. The assumption is that the resident name table // FOLLOWS the resource table directly, and that if it points to // the same location as the resource table, then there are no // resources. WARNING("No resources in *.fon file\n"); return(FALSE); } // want offset from pvView, not from pjNewExe => must add dpNewExe pwrd->dpResTab = (PTRDIFF)US_GET(pjNewExe, OFF_ne_rsrctab) + pwrd->dpNewExe; // make sure that offset is consistent if ((ULONG)pwrd->dpResTab > pwrd->cjView) return FALSE; // what really lies at the offset OFF_ne_rsrctab is a NEW_RSRC.rs_align field // that is used in computing resource data offsets and sizes as a shift factor. // This field occupies two bytes on the disk and the first TYPEINFO structure // follows right after. We want pwrd->dpResTab to point to the first // TYPEINFO structure, so we must add 2 to get there and subtract 2 from // the length pwrd->ulShift = (ULONG) US_GET(pvView, pwrd->dpResTab); pwrd->dpResTab += 2; pwrd->cjResTab -= 2; // Now we want to determine where the resource data is located. // The data consists of a RSRC_TYPEINFO structure, followed by // an array of RSRC_NAMEINFO structures, which are then followed // by a RSRC_TYPEINFO structure, again followed by an array of // RSRC_NAMEINFO structures. This continues until an RSRC_TYPEINFO // structure which has a 0 in the rt_id field. pjResType = (PBYTE)pvView + pwrd->dpResTab; iResID = (ULONG) US_GET(pjResType,OFF_rt_id); while((iResID != 0L) && (iResID != RT_FNT)) { // # of NAMEINFO structures that follow = resources of this type ULONG crn = (ULONG)US_GET(pjResType, OFF_rt_nres); // get ptr to the new TYPEINFO struc and the new resource id pjResType = pjResType + CJ_TYPEINFO + crn * CJ_NAMEINFO; iResID = (ULONG) US_GET(pjResType,OFF_rt_id); } if (iResID == RT_FNT) // we found the font resource type { // # of NAMEINFO structures that follow == # of font resources pwrd->cFntRes = (ULONG)US_GET(pjResType, OFF_rt_nres); // this is ptr to the first NAMEINFO struct that follows // an RT_FNT TYPEINFO structure pjResName = pjResType + CJ_TYPEINFO; pwrd->dpFntTab = (PTRDIFF)(pjResName - (PBYTE)pvView); } else // iResID == 0L, no font resources found in the font file { // no font resources pwrd->cFntRes = (ULONG)0; pwrd->dpFntTab = (PTRDIFF)0; return(FALSE); } // make sure that offset is consistent if ((ULONG)pwrd->dpFntTab > pwrd->cjView) return FALSE; // Now we search for the FONDIR resource. Windows actually grabs facenames // from the FONDIR entries and not the FNT entries. For some wierd fonts this // makes a difference. [gerritv] pjResType = (PBYTE)pvView + pwrd->dpResTab; iResID = (ULONG) US_GET(pjResType,OFF_rt_id); while((iResID != 0L) && (iResID != RT_FDIR)) { // # of NAMEINFO structures that follow = resources of this type ULONG crn = (ULONG)US_GET(pjResType, OFF_rt_nres); // get ptr to the new TYPEINFO struc and the new resource id pjResType = pjResType + CJ_TYPEINFO + crn * CJ_NAMEINFO; iResID = (ULONG) US_GET(pjResType,OFF_rt_id); } if (iResID == RT_FDIR) // we found the font resource type { COUNT cFdirEntries; // this is ptr to the first NAMEINFO struct that follows // an RT_FDIR TYPEINFO structure pjResName = pjResType + CJ_TYPEINFO; // Get the offset to res data computed from the top of the new header pwrd->dpFdirRes = (PTRDIFF)((ULONG)US_GET(pjResName,OFF_rn_offset) << pwrd->ulShift); if ((ULONG)pwrd->dpFdirRes > pwrd->cjView) return FALSE; // Now pwrd->dpFdirRes is an offset to the FONTDIR resource, the first // byte will be the number of entries in the font dir. Lets make sure it // matches the number of FNT resources in the file. cFdirEntries = (ULONG)US_GET(pvView,pwrd->dpFdirRes); if( cFdirEntries != pwrd->cFntRes ) { WARNING( "bInitWinResData: # of FONTDIR entries != # of FNT entries.\n"); pwrd->cFntRes = (ULONG)0; pwrd->dpFntTab = (PTRDIFF)0; return(FALSE); } // now increment dpFdirRes so it points passed the count of entries and // to the first entry. pwrd->dpFdirRes += 2; return(TRUE); } else // iResID == 0L, no FONTDIR resources found in the font file { // no font resources pwrd->cFntRes = (ULONG)0; pwrd->dpFntTab = (PTRDIFF)0; return(FALSE); } }
static void read_partition(cyg_uint8 *data, cyg_disk_info_t *info, cyg_disk_partition_t *part) { cyg_disk_identify_t *ident = &info->ident; cyg_uint16 c, h, s; cyg_uint32 start, end, size; #ifdef DEBUG diag_printf("Partition data:\n"); diag_dump_buf( data, 16 ); diag_printf("Disk geometry: %d/%d/%d\n",info->ident.cylinders_num, info->ident.heads_num, info->ident.sectors_num ); #endif // Retrieve basic information part->type = data[4]; part->state = data[0]; READ_DWORD(&data[12], part->size); READ_DWORD(&data[8], start); READ_DWORD(&data[12], size); // Use the LBA start and size fields if they are valid. Otherwise // fall back to CHS. if( start > 0 && size > 0 ) { READ_DWORD(&data[8], start); end = start + size - 1; #ifdef DEBUG diag_printf("Using LBA partition parameters\n"); diag_printf(" LBA start %d\n",start); diag_printf(" LBA size %d\n",size); diag_printf(" LBA end %d\n",end); #endif } else { READ_CHS(&data[1], c, h, s); CHS_TO_LBA(ident, c, h, s, start); #ifdef DEBUG diag_printf("Using CHS partition parameters\n"); diag_printf(" CHS start %d/%d/%d => %d\n",c,h,s,start); #endif READ_CHS(&data[5], c, h, s); CHS_TO_LBA(ident, c, h, s, end); #ifdef DEBUG diag_printf(" CHS end %d/%d/%d => %d\n",c,h,s,end); diag_printf(" CHS size %d\n",size); #endif } part->size = size; part->start = start; part->end = end; }
bool CharmTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { sCHARM_TBLDAT* pCharm = (sCHARM_TBLDAT*)pvTable; if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pCharm->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Drop_Rate")) { pCharm->wDrop_Rate = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"EXP")) { pCharm->wEXP = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"RP_Sharing")) { pCharm->wRP_Sharing = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time")) { pCharm->wCool_Time = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Time")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pCharm->wKeep_Time = READ_WORD(bstrData, pstrDataName->c_str()); pCharm->dwKeep_Time_In_Millisecs = pCharm->wKeep_Time * 1000; } else if (0 == wcscmp(pstrDataName->c_str(), L"Need_Zenny")) { pCharm->dwNeed_Zenny = READ_DWORD(bstrData, 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dice_Min")) { pCharm->byDice_Min = READ_BYTE(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dice_Max")) { pCharm->byDice_Max = READ_BYTE(bstrData, pstrDataName->c_str(), 0xFF); } else if (0 == wcscmp(pstrDataName->c_str(), L"Charm_Type_Bit_Flag")) { pCharm->byCharm_Type_Bit_Flag = READ_BYTE(bstrData, pstrDataName->c_str(), 0); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool ObjectTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { #define READ_STATE( idx ) \ if ( READ_STRING( bstrData, szTemp, 1024 ) ) \ { \ int nCnt = 0; \ char *pToken, *pNextToken; \ \ pToken = strtok_s( szTemp, ";", &pNextToken ); \ \ while ( NULL != pToken ) \ { \ DWORD dwTemp = (DWORD)_atoi64( pToken ); \ \ if ( dwTemp >= INVALID_BYTE ) \ { \ _ASSERTE( !"BYTE 타입의 데이타 값이 최대값 을 초과했습니다." ); \ } \ else \ { \ pObj->abyState[idx][nCnt] = (BYTE)dwTemp; \ } \ \ nCnt++; \ \ pToken = strtok_s( NULL, ";", &pNextToken ); \ } \ } static char szTemp[1024]; if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sOBJECT_TBLDAT* pObj = (sOBJECT_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pObj->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { pObj->dwName = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_X")) { pObj->vLoc.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_Y")) { pObj->vLoc.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Loc_Z")) { pObj->vLoc.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_X")) { pObj->vDir.x = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_Y")) { pObj->vDir.y = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dir_Z")) { pObj->vDir.z = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Func")) { pObj->wFunction = (WORD)READ_BITFLAG(bstrData, 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_X")) { pObj->vMin.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_Y")) { pObj->vMin.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_Z")) { pObj->vMin.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_X")) { pObj->vMax.x = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Y")) { pObj->vMax.y = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Z")) { pObj->vMax.z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"StateType")) { pObj->byStateType = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"DefMainState")) { pObj->byDefMainState = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"DefSubState")) { pObj->byDefSubState = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcsncmp(pstrDataName->c_str(), L"State", wcslen(L"State"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_OBJECT_STATE; i++) { swprintf(szBuffer, 1024, L"State%d", i); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { READ_STATE(i); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcsncmp(pstrDataName->c_str(), L"Click_Sound", wcslen(L"Click_Sound"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_OBJECT_STATE; i++) { swprintf(szBuffer, 1024, L"Click_Sound%d", i); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { READ_STRING(bstrData, pObj->achClickSound[i], _countof(pObj->achClickSound[i])); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Boundary_Distance")) { pObj->byBoundaryDistance = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"ModelName")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); READ_STRING(bstrData, pObj->szModelName, _countof(pObj->szModelName)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { // 기획 전용 필드 } else if (0 == wcscmp(pstrDataName->c_str(), L"Contents_Tblidx")) { pObj->contentsTblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Object_Direction_Index")) { pObj->objectDirectionIndex = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"MinQuestId")) { pObj->minQuestId = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"MaxQuestId")) { pObj->maxQuestId = READ_WORD(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool RankBattleTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { static char szTemp[1024] = { 0x00, }; if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sRANKBATTLE_TBLDAT * pTbldat = (sRANKBATTLE_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pTbldat->tblidx = READ_TBLIDX(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); READ_STRINGW(bstrData, pTbldat->wszName, _countof(pTbldat->wszName)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Rule_Type")) { BYTE byMatchRule = READ_BYTE(bstrData, pstrDataName->c_str()); if (1 == byMatchRule) { pTbldat->byRuleType = GAMERULE_RANKBATTLE; } else if (100 == byMatchRule) { pTbldat->byRuleType = GAMERULE_MINORMATCH; } else if (101 == byMatchRule) { pTbldat->byRuleType = GAMERULE_MAJORMATCH; } else if (102 == byMatchRule) { pTbldat->byRuleType = GAMERULE_FINALMATCH; } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : invalid \"Rule_Type\"[%u] (Field Name = %s)", m_wszXmlFileName, byMatchRule, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Battle_Mode")) { pTbldat->byBattleMode = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Map_Index")) { pTbldat->worldTblidx = READ_TBLIDX(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Need_Item")) { pTbldat->needItemTblidx = READ_TBLIDX(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Need_Zenny")) { pTbldat->dwZenny = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Min_Level")) { pTbldat->byMinLevel = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Level")) { pTbldat->byMaxLevel = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Battle_Count")) { pTbldat->byBattleCount = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"WaitTime")) { pTbldat->dwWaitTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"DirectionTime")) { pTbldat->dwDirectionTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"MatchReadyTime")) { pTbldat->dwMatchReadyTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"StageReadyTime")) { pTbldat->dwStageReadyTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"StageRunTime")) { pTbldat->dwStageRunTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"StageFinishTime")) { pTbldat->dwStageFinishTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"MatchFinishTime")) { pTbldat->dwMatchFinishTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"BossDirection_Time")) { pTbldat->dwBossDirectionTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"BossKill_Time")) { pTbldat->dwBossKillTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"BossEndingTime")) { pTbldat->dwBossEndingTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"EndTime")) { pTbldat->dwEndTime = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"KO_Score")) { pTbldat->chScoreKO = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"OutofArea_Score")) { pTbldat->chScoreOutOfArea = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Pointwin_Score")) { pTbldat->chScorePointWin = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Draw_Score")) { pTbldat->chScoreDraw = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Lost_Score")) { pTbldat->chScoreLose = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Excellent_Result")) { pTbldat->chResultExcellent = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Greate_Result")) { pTbldat->chResultGreate = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Good_Result")) { pTbldat->chResultGood = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Draw_Result")) { pTbldat->chResultDraw = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Lost_Result")) { pTbldat->chResultLose = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"PerfectWinner_Score")) { pTbldat->chBonusPerfectWinner = READ_CHAR(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"NormalWinner_Score")) { pTbldat->chBonusNormalWinner = READ_CHAR(bstrData, pstrDataName->c_str()); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool CEachDropTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sEACH_DROP_TBLDAT* pDrop = (sEACH_DROP_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pDrop->tblidx = READ_DWORD(bstrData); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Item_Tblidx_", wcslen(L"Item_Tblidx_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_EACH_DROP; i++ ) { swprintf( szBuffer, 1024, L"Item_Tblidx_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pDrop->aItem_Tblidx[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Drop_Rate_", wcslen(L"Drop_Rate_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_EACH_DROP; i++ ) { swprintf( szBuffer, 1024, L"Drop_Rate_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pDrop->afDrop_Rate[ i ] = READ_FLOAT( bstrData, pstrDataName->c_str(), 0.0f ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool QuestProbabilityTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sQUEST_PROBABILITY_TBLDAT * pProbabilityTbldat = (sQUEST_PROBABILITY_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { pProbabilityTbldat->tblidx = READ_TBLIDX(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { if (false == READ_STRINGW(bstrData, pProbabilityTbldat->wszName, _countof(pProbabilityTbldat->wszName))) { return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { if (false == READ_STRINGW(bstrData, pProbabilityTbldat->wszNote, _countof(pProbabilityTbldat->wszNote))) { return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Probability_Type")) { pProbabilityTbldat->byProbabilityType = READ_BYTE(bstrData, pstrDataName->c_str()); } else { WCHAR szBuffer[1024] = { 0x00, }; // Reward Type for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Reward_Type%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].byType = READ_BYTE(bstrData, pstrDataName->c_str()); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Reward_Tblidx%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].tblidx = READ_TBLIDX(bstrData); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Min_Value%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].dwMinValue = READ_DWORD(bstrData); return true; } } // Reward Index for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Max_Value%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].dwMaxValue = READ_DWORD(bstrData); return true; } } // Rate for (int i = 0; i < NTL_QUEST_PROBABILITY_MAX_COUNT; i++) { swprintf(szBuffer, 1024, L"Drop_Rate%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pProbabilityTbldat->asProbabilityData[i].fRate = READ_FLOAT(bstrData, pstrDataName->c_str()); return true; } } Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } // end if } // end if else { return false; } return true; }
int main(int argc, char *argv[]) { int f; int j; char* io_buffer; char file_name[100]; unsigned int next_entry; unsigned int name_len; unsigned int rec_len; unsigned int i_number; // printf("--argc=%d \n",argc); // printf("--argv[0]=%s \n",argv[0]); // printf("--argv[1]=%s \n",argv[1]); if (argc>1) { f=open(argv[1], O_RDWR | O_APPEND); if (f==-1) { printf("\n"); printf("wrong arguments"); printf("\n"); exit(0); } } else { f=open("./", O_RDWR | O_APPEND); if (f==-1) { printf("\n"); printf("wrong arguments"); printf("\n"); exit(0); } } io_buffer=malloc(DIR_SIZE); read(f,io_buffer,DIR_SIZE); close(f); next_entry=0; j=0; while(next_entry<DIR_SIZE) { READ_DWORD(&io_buffer[next_entry],i_number); READ_BYTE(&io_buffer[next_entry+6],name_len); READ_WORD(&io_buffer[next_entry+4],rec_len); j=0; while(j<name_len) { file_name[j]=io_buffer[next_entry+8+j]; j++; } next_entry+=rec_len; file_name[j]='\0'; printf(file_name); printf("\n"); } free(io_buffer); exit(0); }
bool IE_Imp_MSWrite::read_pap (pap_t process) { static const char *text_align[] = {"left", "center", "right", "justify"}; int fcMac, pnPara, fcFirst, cfod, fc, fcLim; unsigned char page[0x80]; UT_String properties, tmp, lastprops; if (process == All) { UT_DEBUGMSG(("PAP:\n")); } fcMac = wri_struct_value(wri_file_header, "fcMac"); pnPara = wri_struct_value(wri_file_header, "pnPara"); fcFirst = 0x80; while (true) { gsf_input_seek(mFile, pnPara++ * 0x80, G_SEEK_SET); gsf_input_read(mFile, 0x80, page); fc = READ_DWORD(page); cfod = page[0x7f]; if (process == All) { UT_DEBUGMSG((" fcFirst = %d\n", fc)); UT_DEBUGMSG((" cfod = %d\n", cfod)); } if (fc != fcFirst) UT_WARNINGMSG(("read_pap: fcFirst wrong.\n")); // read all FODs (format descriptors) for (int fod = 0; fod < cfod; fod++) { int bfprop, cch; int jc, dxaRight, dxaLeft, dxaLeft1, dyaLine, fGraphics; int rhcPage, rHeaderFooter, rhcFirst; int tabs, dxaTab[14], jcTab[14]; if (process == All) { UT_DEBUGMSG((" PAP-FOD #%02d:\n", fod + 1)); } // read a FOD (format descriptor) fcLim = READ_DWORD(page + 4 + fod * 6); bfprop = READ_WORD(page + 8 + fod * 6); if (process == All) { UT_DEBUGMSG((" fcLim = %d\n", fcLim)); UT_DEBUGMSG((bfprop == 0xffff ? " bfprop = 0x%04X\n" : " bfprop = %d\n", bfprop)); } // default PAP values jc = 0; dxaRight = dxaLeft = dxaLeft1 = 0; dyaLine = 240; rhcPage = rHeaderFooter = rhcFirst = 0; fGraphics = 0; tabs = 0; // if the PAP FPROPs (formatting properties) differ from the defaults, get them if (bfprop != 0xffff && bfprop + (cch = page[bfprop + 4]) < 0x80) { if (process == All) { UT_DEBUGMSG((" cch = %d\n", cch)); } if (cch >= 2) jc = page[bfprop + 6] & 3; if (cch >= 6) dxaRight = READ_WORD(page + bfprop + 9); if (cch >= 8) dxaLeft = READ_WORD(page + bfprop + 11); if (cch >= 10) dxaLeft1 = READ_WORD(page + bfprop + 13); if (cch >= 12) dyaLine = READ_WORD(page + bfprop + 15); if (cch >= 17) { rhcPage = page[bfprop + 21] & 1; rHeaderFooter = page[bfprop + 21] & 6; rhcFirst = page[bfprop + 21] & 8; fGraphics = page[bfprop + 21] & 0x10; } for (int n = 0; n < 14; n++) { if (cch >= 4 * (n + 1) + 26) { dxaTab[tabs] = READ_WORD(page + bfprop + n * 4 + 27); jcTab[tabs] = page[bfprop + n * 4 + 29] & 3; tabs++; } } if (dxaRight & 0x8000) dxaRight = -0x10000 + dxaRight; if (dxaLeft & 0x8000) dxaLeft = -0x10000 + dxaLeft; if (dxaLeft1 & 0x8000) dxaLeft1 = -0x10000 + dxaLeft1; if (dyaLine < 240) dyaLine = 240; if (process == All && rHeaderFooter) { if (rhcPage) { if (!hasFooter) { hasFooter = true; page1Footer = rhcFirst; } } else { if (!hasHeader) { hasHeader = true; page1Header = rhcFirst; } } } } if ((process == All && !rHeaderFooter) || (rHeaderFooter && ((process == Header && !rhcPage) || (process == Footer && rhcPage)))) { UT_DEBUGMSG((" jc = %d\n", jc)); UT_DEBUGMSG((" dxaRight = %d\n", dxaRight)); UT_DEBUGMSG((" dxaLeft = %d\n", dxaLeft)); UT_DEBUGMSG((" dxaLeft1 = %d\n", dxaLeft1)); UT_DEBUGMSG((" dyaLine = %d\n", dyaLine)); UT_DEBUGMSG((" rhcPage = %d\n", rhcPage)); UT_DEBUGMSG((" rHeaderFooter = %d\n", rHeaderFooter)); UT_DEBUGMSG((" rhcFirst = %d\n", rhcFirst)); UT_DEBUGMSG((" fGraphics = %d\n", fGraphics)); UT_LocaleTransactor lt(LC_NUMERIC, "C"); UT_String_sprintf(properties, "text-align:%s; line-height:%.1f", text_align[jc], static_cast<float>(dyaLine) / 240.0); if (tabs) { properties += "; tabstops:"; UT_DEBUGMSG((" Tabs:\n")); for (int n = 0; n < tabs; n++) { UT_String_sprintf(tmp, "%.4fin/%c0", static_cast<float>(dxaTab[n]) / 1440.0, jcTab[n] ? 'D' : 'L'); properties += tmp; UT_DEBUGMSG((" #%02d dxa = %d, jcTab = %d\n", n + 1, dxaTab[n], jcTab[n])); if (n != tabs - 1) properties += ","; } } if (process == Header || process == Footer) { // For reasons unknown, the left and right margins from the paper // are included in the indents of the headers and footers. dxaLeft -= xaLeft; dxaRight -= xaRight; } if (dxaLeft1) { UT_String_sprintf(tmp, "; text-indent:%.4fin", static_cast<float>(dxaLeft1) / 1440.0); properties += tmp; } if (dxaLeft) { UT_String_sprintf(tmp, "; margin-left:%.4fin", static_cast<float>(dxaLeft) / 1440.0); properties += tmp; } if (dxaRight) { UT_String_sprintf(tmp, "; margin-right:%.4fin", static_cast<float>(dxaRight) / 1440.0); properties += tmp; } // new attributes, only if there was a line feed or FPROPs have changed if (lf || strcmp(properties.c_str(), lastprops.c_str()) != 0) { const gchar *attributes[3]; attributes[0] = PT_PROPS_ATTRIBUTE_NAME; attributes[1] = properties.c_str(); attributes[2] = NULL; appendStrux(PTX_Block, attributes); lastprops = properties; } if (fGraphics) read_pic(fcFirst, fcLim - fcFirst); else read_txt(fcFirst, fcLim - 1); } fcFirst = fcLim; if (fcLim >= fcMac) { UT_DEBUGMSG((" PAP-FODs end, fcLim (%d) >= fcMac (%d)\n", fcLim, fcMac)); return true; } } } }
bool ItemMixMachineTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sITEM_MIX_MACHINE_TBLDAT* pItem = (sITEM_MIX_MACHINE_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Validity_Able")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->bValidityAble = READ_BOOL(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Name")) { pItem->name = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Machine_Type")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byMachineType = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Function_Bit_Flag")) { pItem->wFunctionBitFlag = (WORD)READ_BITFLAG(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Mix_Zenny_Discount_Rate")) { pItem->byMixZennyDiscountRate = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Dynamic_Object_Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->dynamicObjectTblidx = READ_DWORD(bstrData); } else if (0 == wcsncmp(pstrDataName->c_str(), L"Built_In_Recipe_Tblidx_", wcslen(L"Built_In_Recipe_Tblidx_"))) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for (int i = 0; i < DBO_MAX_COUNT_RECIPE_MATERIAL_ITEM; i++) { swprintf(szBuffer, 1024, L"Built_In_Recipe_Tblidx_%d", i + 1); if (0 == wcscmp(pstrDataName->c_str(), szBuffer)) { pItem->aBuiltInRecipeTblidx[i] = READ_DWORD(bstrData); bFound = true; break; } } if (false == bFound) { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
bool IE_Imp_MSWrite::read_txt (int from, int to) { static const char *currcp; int fcMac, pnChar, fcFirst, cfod, fc, fcLim; unsigned char page[0x80]; UT_String properties, tmp; int dataLen = static_cast<UT_sint32>(mData.getLength()); UT_DEBUGMSG((" TXT:\n")); UT_DEBUGMSG((" from = %d\n", from)); UT_DEBUGMSG((" to = %d\n", to)); fcMac = wri_struct_value(wri_file_header, "fcMac"); pnChar = (fcMac + 127) / 128; fcFirst = 0x80; while (true) { gsf_input_seek(mFile, pnChar++ * 0x80, G_SEEK_SET); gsf_input_read(mFile, 0x80, page); fc = READ_DWORD(page); cfod = page[0x7f]; UT_DEBUGMSG((" fcFirst = %d\n", fc)); UT_DEBUGMSG((" cfod = %d\n", cfod)); if (fc != fcFirst) UT_WARNINGMSG(("read_txt: fcFirst wrong.\n")); // read all FODs (format descriptors) for (int fod = 0; fod < cfod; fod++) { int bfprop, cch, ftc, hps, fBold, fItalic, fUline, hpsPos; UT_DEBUGMSG((" CHP-FOD #%02d:\n", fod + 1)); // read a FOD (format descriptor) fcLim = READ_DWORD(page + 4 + fod * 6); bfprop = READ_WORD(page + 8 + fod * 6); UT_DEBUGMSG((" fcLim = %d\n", fcLim)); UT_DEBUGMSG((bfprop == 0xffff ? " bfprop = 0x%04X\n" : " bfprop = %d\n", bfprop)); // default CHP values ftc = 0; hps = 24; fBold = fItalic = fUline = hpsPos = 0; // if the CHP FPROPs (formatting properties) differ from the defaults, get them if (bfprop != 0xffff && bfprop + (cch = page[bfprop + 4]) < 0x80) { UT_DEBUGMSG((" cch = %d\n", cch)); if (cch >= 2) ftc = page[bfprop + 6] >> 2; if (cch >= 5) ftc |= (page[bfprop + 9] & 3) << 6; if (cch >= 3) hps = page[bfprop + 7]; if (cch >= 2) fBold = page[bfprop + 6] & 1; if (cch >= 2) fItalic = page[bfprop + 6] & 2; if (cch >= 4) fUline = page[bfprop + 8] & 1; if (cch >= 6) hpsPos = page[bfprop + 10]; } UT_DEBUGMSG((" ftc = %d\n", ftc)); UT_DEBUGMSG((" hps = %d\n", hps)); UT_DEBUGMSG((" fBold = %d\n", fBold)); UT_DEBUGMSG((" fItalic = %d\n", fItalic)); UT_DEBUGMSG((" fUline = %d\n", fUline)); UT_DEBUGMSG((" hpsPos = %d\n", hpsPos)); if (ftc >= wri_fonts_count) { UT_WARNINGMSG(("read_txt: Wrong font code.\n")); ftc = wri_fonts_count - 1; } if (from < fcLim && to >= fcFirst) { UT_LocaleTransactor lt(LC_NUMERIC, "C"); UT_String_sprintf(properties, "font-weight:%s", fBold ? "bold" : "normal"); if (hps != 24) { UT_String_sprintf(tmp, "; font-size:%dpt", hps / 2); properties += tmp; } if (fItalic) properties += "; font-style:italic"; if (fUline) properties += "; text-decoration:underline"; if (hpsPos) { UT_String_sprintf(tmp, "; text-position:%s", hpsPos < 128 ? "superscript" : "subscript"); properties += tmp; } if (wri_fonts_count) { UT_String_sprintf(tmp, "; font-family:%s", wri_fonts[ftc].name); properties += tmp; } if (wri_fonts[ftc].codepage != currcp /*sic!*/) { set_codepage(wri_fonts[ftc].codepage); currcp = wri_fonts[ftc].codepage; } mText.clear(); UT_DEBUGMSG((" Text: ")); while (fcFirst <= from && from < fcLim && from <= to && from - 0x80 < dataLen) translate_char(*mData.getPointer(from++ - 0x80), mText); UT_DEBUGMSG(("\n")); // new attributes, only if there was text if (mText.size() > 0) { const gchar *attributes[5]; const UT_UCS4Char *text = mText.ucs4_str(), *p = text; size_t txtLen; UT_DEBUGMSG((" Conv: %s\n", mText.utf8_str())); attributes[0] = PT_PROPS_ATTRIBUTE_NAME; attributes[1] = properties.c_str(); attributes[2] = NULL; appendFmt(attributes); // check for page number (should only be in header or footer) while (*p && *p != (UT_UCS4Char) 0x01) p++; if (*p) { if (p - text) appendSpan(text, p - text); attributes[2] = PT_TYPE_ATTRIBUTE_NAME; attributes[3] = "page_number"; attributes[4] = NULL; appendObject(PTO_Field, attributes); txtLen = mText.size() - (p - text) - 1; p++; } else { txtLen = mText.size(); p = text; } if (txtLen) appendSpan(p, txtLen); } } fcFirst = fcLim; if (fcLim >= fcMac || fcFirst > to) { UT_DEBUGMSG((" CHP-FODs end, fcLim (%d) >= fcMac (%d) or fcFirst (%d) > to (%d)\n", fcLim, fcMac, fcFirst, to)); return true; } } }
bool CItemOptionTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sITEM_OPTION_TBLDAT* pItem = (sITEM_OPTION_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->tblidx = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Name")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); READ_STRINGW(bstrData, pItem->wszOption_Name, _countof(pItem->wszOption_Name)); } else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") ) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->bValidity_Able = READ_BOOL( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Rank")) { CheckNegativeInvalid( pstrDataName->c_str(), bstrData ); pItem->byOption_Rank = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Item_Group")) { pItem->byItem_Group = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Quality")) { pItem->byMaxQuality = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Quality")) { pItem->byQuality = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Quality_Index")) { pItem->byQualityIndex = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cost")) { pItem->dwCost = READ_DWORD( bstrData, 0 ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Level")) { pItem->byLevel = READ_BYTE( bstrData, pstrDataName->c_str() ); } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"System_Effect_", wcslen(L"System_Effect_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"System_Effect_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->system_Effect[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Type_", wcslen(L"Type_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Type_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->bAppliedInPercent[ i ] = READ_BOOL( bstrData, pstrDataName->c_str() ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Value_", wcslen(L"Value_") ) ) { bool bFound = false; WCHAR szBuffer[1024] = { 0x00, }; for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ ) { swprintf( szBuffer, 1024, L"Value_%d", i + 1 ); if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) ) { pItem->nValue[ i ] = READ_DWORD( bstrData ); bFound = true; break; } } if( false == bFound ) { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Effect")) { pItem->activeEffect = READ_DWORD( bstrData ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Rate")) { pItem->fActiveRate = READ_FLOAT( bstrData, pstrDataName->c_str() ); } else if (0 == wcscmp(pstrDataName->c_str(), L"Note")) { READ_STRING(bstrData, pItem->szNote, _countof(pItem->szNote)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Scouter_Info")) { pItem->byScouterInfo = READ_BYTE( bstrData, pstrDataName->c_str() ); } else { CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }
DWORD NTheader::getSignature() { return READ_DWORD(pointer); }
bool UseItemTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData) { if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR")) { sUSE_ITEM_TBLDAT* pItem = (sUSE_ITEM_TBLDAT*)pvTable; if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->tblidx = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Item_Active_Type")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byUse_Item_Active_Type = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Buff_Group")) { pItem->byBuff_Group = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time_Bit_Flag")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->dwCool_Time_Bit_Flag = HexToDec(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Function_Bit_Flag")) { pItem->wFunction_Bit_Flag = (WORD)READ_BITFLAG(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Appoint_Target")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byAppoint_Target = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Target = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target_Max")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Target_Max = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Range")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->byApply_Range = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Need_State_Bit_Flag")) { WORD wDummy = 0; pItem->wNeed_State_Bit_Flag = ~wDummy; pItem->wNeed_State_Bit_Flag = (WORD)READ_BITFLAG(bstrData, ~wDummy); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_1")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->aSystem_Effect[0] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_1")) { pItem->abySystem_Effect_Type[0] = READ_BYTE(bstrData, pstrDataName->c_str()); // [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것 //if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[0] || // SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[0]) //{ // _ASSERT(0); // return false; //} } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_1")) { pItem->afSystem_Effect_Value[0] = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_2")) { pItem->aSystem_Effect[1] = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_2")) { pItem->abySystem_Effect_Type[1] = READ_BYTE(bstrData, pstrDataName->c_str()); // [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것 //if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[1] || // SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[1]) //{ // _ASSERT(0); // return false; //} } else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_2")) { pItem->afSystem_Effect_Value[1] = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_LP")) { pItem->wRequire_LP = READ_WORD(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_EP")) { pItem->wRequire_EP = READ_WORD(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Require_RP_Ball")) { pItem->byRequire_RP_Ball = READ_BYTE(bstrData, pstrDataName->c_str(), 0); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Time")) { pItem->fCasting_Time = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f); pItem->dwCastingTimeInMilliSecs = (DWORD)(pItem->fCasting_Time * 1000.0f); } else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time")) { pItem->wCool_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0); pItem->dwCoolTimeInMilliSecs = pItem->wCool_Time * 1000; } else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Time")) { pItem->wKeep_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0); pItem->dwKeepTimeInMilliSecs = pItem->wKeep_Time * 1000; } else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Effect")) { CheckNegativeInvalid(pstrDataName->c_str(), bstrData); pItem->bKeep_Effect = READ_BOOL(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Min")) { pItem->byUse_Range_Min = READ_BYTE(bstrData, pstrDataName->c_str(), 0); pItem->fUse_Range_Min = (float)(pItem->byUse_Range_Min); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Max")) { pItem->byUse_Range_Max = READ_BYTE(bstrData, pstrDataName->c_str(), 0); pItem->fUse_Range_Max = (float)(pItem->byUse_Range_Max); } else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Info_Text")) { pItem->Use_Info_Text = READ_DWORD(bstrData); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect")) { READ_STRING(bstrData, pItem->szCasting_Effect, _countof(pItem->szCasting_Effect)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect")) { READ_STRING(bstrData, pItem->szAction_Effect, _countof(pItem->szAction_Effect)); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Start")) { pItem->wCasting_Animation_Start = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Loop")) { pItem->wCasting_Animation_Loop = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Animation_Index")) { pItem->wAction_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Loop_Animation_Index")) { pItem->wAction_Loop_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_End_Animation_Index")) { pItem->wAction_End_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect_Position")) { pItem->byCastingEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect_Position")) { pItem->byActionEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_X")) { pItem->fUseLoc_X = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Z")) { pItem->fUseLoc_Z = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Radius")) { pItem->fUseLoc_Radius = READ_FLOAT(bstrData, pstrDataName->c_str()); } else if (0 == wcscmp(pstrDataName->c_str(), L"RequiredQuestID")) { pItem->RequiredQuestID = (QUESTID)(READ_WORD(bstrData, pstrDataName->c_str())); } else { Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str()); return false; } } else { return false; } return true; }