Example #1
0
// Called by DeviceOpen(), DeviceGetDiskType()
void InitDisc()
{
	int i;
#ifdef VERBOSE_FUNCTION_DEVICE
	PrintLog("CDVD device: InitDisc()");
#endif /* VERBOSE_FUNCTION_DEVICE */
	if ((disctype == CDVD_TYPE_PS2DVD) ||
	    (disctype == CDVD_TYPE_DVDV))
		InitDVDInfo(); // ENDIF- Clean out DVD Disc Info?
	if ((disctype == CDVD_TYPE_PS2CD) ||
	    (disctype == CDVD_TYPE_PS2CDDA) ||
	    (disctype == CDVD_TYPE_PSCD) ||
	    (disctype == CDVD_TYPE_PSCDDA) ||
	    (disctype == CDVD_TYPE_CDDA))
		InitCDInfo(); // ENDIF- Clean out DVD Disc Info?
	disctype = CDVD_TYPE_NODISC;
	for (i = 0; i > sizeof(tocbuffer); i++)  tocbuffer[i] = 0x00;
} // END InitDisc()
Example #2
0
static int ReadBotGenInfo (CFile& cf)
{
if (gameFileInfo.botGen.offset > -1) {
	int		i, j;
	CSegment	*segP;

	if (cf.Seek (gameFileInfo.botGen.offset, SEEK_SET)) {
		Error ("Error seeking to robot generator data\n(file damaged or invalid)");
		return -1;
		}
	for (i = 0; i < gameFileInfo.botGen.count; i++) {
		if (gameTopFileInfo.fileinfoVersion < 27) {
			old_tMatCenInfo m;

			OldMatCenInfoRead (&m, cf);

			gameData.matCens.botGens [i].objFlags [0] = m.objFlags;
			gameData.matCens.botGens [i].objFlags [1] = 0;
			gameData.matCens.botGens [i].xHitPoints = m.xHitPoints;
			gameData.matCens.botGens [i].xInterval = m.xInterval;
			gameData.matCens.botGens [i].nSegment = m.nSegment;
			gameData.matCens.botGens [i].nFuelCen = m.nFuelCen;
		}
		else
			MatCenInfoRead (gameData.matCens.botGens + i, cf);

		//	Set links in gameData.matCens.botGens to gameData.matCens.fuelCenters array
		for (j = gameData.segs.nSegments, segP = SEGMENTS.Buffer (); j; j--, segP++)
			if ((segP->m_nType == SEGMENT_IS_ROBOTMAKER) && (segP->m_nMatCen == i)) {
				gameData.matCens.botGens [i].nFuelCen = segP->m_value;
				break;
				}
		if (!j) {
#if DBG
			PrintLog ("Invalid robot generator data found\n");
#endif
			gameData.matCens.nBotCenters--;
			gameFileInfo.botGen.count--;
			i--;
			}
		}
	}
return 0;
}
 /*************************************************************//**
 *
 *  @brief  float型の3つの値でユニフォーム変数を設定する
 *  @param  ユニフォーム変数の名前
 *  @param  値1
 *  @param  値2
 *  @param  値3
 *  @return 正常終了:true
 *  @return 異常終了:false
 *
 ****************************************************************/
bool C_BaseShader::SetUniform3f(const std::string& rName, 
                                float x,
                                float y,
                                float z)
{
    // ユニフォーム変数の場所を取得
    int32_t location = GetUniformLocation(rName);

    if (location == s_UNIFORM_LOCATION_ERROR_VELUE)
    {
        PrintLog("[ C_BaseShader::SetUniform3f ] : ユニフォーム変数の場所の取得に失敗しました。\n");

        return false;
    }

    glUniform3f(location, x, y, z);

    return true;
}
Example #4
0
QVector<PrintLog> SqlHelper::getPrintLogByUserName(QString userName) {
    QString sql = "select id, status, user_name, printer_name, file_path, title, options, copies, submit_time, print_time from tab_print_log where user_name = '" + userName + "';";
    QVector<PrintLog> res;
    QVector<QVector<QVariant> > table = exec(sql, 10);
    for (auto i : table) {
        int id = i[0].toInt();
        int status = i[1].toInt();
        QString userName = i[2].toString();
        QString printerName = i[3].toString();
        QString filePath = i[4].toString();
        QString title = i[5].toString();
        QString options = i[6].toString();
        int copies  = i[7].toInt();
        QDateTime submitTime = i[8].toDateTime();
        QDateTime printTime = i[9].toDateTime();
        res.push_back(PrintLog(id, status, userName, printerName, filePath, title, options, copies, submitTime, printTime));
    }
    return res;
}
Example #5
0
void LoadTextureColors (const char *pszLevelName, tFaceColor *colorP)
{
	char			szFilename [SHORT_FILENAME_LEN];
	CFile			cf;
	int			i;

//first, free up data allocated for old bitmaps
PrintLog ("   loading texture colors\n");
CFile::ChangeFilenameExtension (szFilename, pszLevelName, ".clr");
if (cf.Open (szFilename, gameFolders.szDataDir, "rb", 0)) {
	if (!colorP)
		colorP = gameData.render.color.textures.Buffer ();
	for (i = MAX_WALL_TEXTURES; i; i--, colorP++) {
		ReadColor (cf, colorP, 0, 0);
		colorP->index = 0;
		}
	cf.Close ();
	}
}
Example #6
0
unsigned int HashUUIDForAPR (const char *key_s, apr_ssize_t *len_p)
{
	unsigned int res = 0;
	char *uuid_s = GetUUIDAsString ((const uint8 *) key_s);

	if (uuid_s)
		{
			apr_ssize_t len = APR_HASH_KEY_STRING;
			res = apr_hashfunc_default (uuid_s, &len);

			#if APR_GLOBAL_STORAGE_DEBUG >= STM_LEVEL_FINER
			PrintLog (STM_LEVEL_FINER, __FILE__, __LINE__, "uuid \"%s\" res %u len %u", uuid_s, res, len);
			#endif

			FreeCopiedString (uuid_s);
		}

	return res;
}
Example #7
0
Smt_Uint TASTConnector::Ami_Originate(Smt_Uint handle, Smt_String actid, Smt_String channel, Smt_String application, Smt_String data, Smt_String callerid, Smt_String variable, Smt_String timeout )
{
	Smt_String strAct = "";
	strAct+= CRLF;
	strAct+= "Action: Originate" + CRLF; 
	strAct+= "Channel: " + channel + CRLF; 
	strAct+= "Application: " + application + CRLF; 
	strAct+= "Data: " + data + CRLF; 
	strAct+= "CallerID: " + callerid + CRLF; 
	strAct+= "Variable: " + variable + CRLF;
	strAct+= "Async: true" + CRLF;
	strAct+= "Timeout: " + timeout + CRLF;
	strAct+= "ActionID: " + actid + CRLF;
	strAct+= CRLF;
	
	PrintLog(4, "[AMI CMD] %s", strAct.c_str() );	
	
	return SendCmd( handle, strAct );
}
Example #8
0
HMODULE WINAPI HookLL::HookLoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
	if (!InputHookManager::Get().GetInputHook().GetState(InputHook::HOOK_LL)) return TrueLoadLibraryExA(lpLibFileName, hFile, dwFlags);

	if (SelfCheckA(lpLibFileName))
	{
		PrintLog("LoadLibraryExA");
		InputHookManager::Get().GetInputHook().StartTimeoutThread();

		std::string path;

		if (ModulePath(&path, InputHookManager::Get().GetInputHook().GetEmulator()))
			return TrueLoadLibraryExA(path.c_str(), hFile, dwFlags);
		else
			return TrueLoadLibraryExA(lpLibFileName, hFile, dwFlags);
	}

	return TrueLoadLibraryExA(lpLibFileName, hFile, dwFlags);
}
Example #9
0
/**
* @brief 以太网通信任务
*/
void EtherTask(void)
{
	unsigned long ev;

	UplinkClearState(UPLINKITF_ETHER);
	SvrCommLineState = LINESTAT_OFF; //关闭状态
  //    while(0 == (ParaTermG.cascade_flag&0x01) )
	 Sleep(20);//如果是从集中器则不启动以太网任务
	EtherKeepAlive();

	while(1) 
	{

		SvrCommPeekEvent(SVREV_NOTE, &ev); 
		if(ev&SVREV_NOTE) 
		{
			if(!RefreshKeepAlive()) EtherKeepAlive();
			if(LINESTAT_ON == SvrCommLineState) SvrNoteProc(UPLINKITF_ETHER);
		}
              /*广电 以太网 处理函数*/
		if(LINESTAT_ON == SvrCommLineState) 
		{

			//接收到服务器发送过来的命令
			if(!UplinkRecvPkt(UPLINKITF_ETHER)) 
			{
				PrintLog(0,"SvrMessageProc: " );
				
				Sleep(10);
				//处理服务器发送过来的命令
				SvrMessageProc(UPLINKITF_ETHER);				
			}
		}

		if(!KeepAliveProc()) EtherKeepAlive();
		if(exitflag)
		{
			EtherDisconnect();
			break;
		}
		Sleep(10);
	}
}
Example #10
0
HMODULE WINAPI HookLL::HookLoadLibraryW(LPCWSTR lpLibFileName)
{
	if (!InputHookManager::Get().GetInputHook().GetState(InputHook::HOOK_LL)) return TrueLoadLibraryW(lpLibFileName);

	if (SelfCheckW(lpLibFileName))
	{
		PrintLog("LoadLibraryW");
		InputHookManager::Get().GetInputHook().StartTimeoutThread();

		std::wstring path;

		if (ModulePath(&path, InputHookManager::Get().GetInputHook().GetEmulator()))
			return TrueLoadLibraryW(path.c_str());
		else
			return TrueLoadLibraryW(lpLibFileName);
	}

	return TrueLoadLibraryW(lpLibFileName);
}
Example #11
0
string CCommonSeqReference::GetKeyPrefix( string& strFileName )
{
    if (!m_mapReference.count(strFileName))
    {
        ofstream logFile("NoReferInfo.txt",ios_base::out | ios_base::app);
        logFile<<strFileName<<"无Keyprefix"<<endl;
        logFile.close();

        if(GetLogToFile())
        {
            stringstream strExp;
            strExp << strFileName << "无Keyprefix";
            PrintLog(strExp.str());
        }

        return "没有Keyprefix信息";
    }
    return m_mapReference[strFileName].m_strPreFix;
}
void CScriptDebugging::LogError ( SString strFile, int iLine, SString strMsg )
{
    SString strText = SString ( "ERROR: %s:%d: %s", strFile.c_str (), iLine, strMsg.c_str () );

    if ( !m_bTriggeringOnDebugMessage )
    {
        m_bTriggeringOnDebugMessage = true;

        // Prepare onDebugMessage
        CLuaArguments Arguments;
        Arguments.PushString ( strMsg.c_str ( ) );
        Arguments.PushNumber ( 1 );

        // Push the file name (if any)
        if ( strFile.length ( ) > 0 )
            Arguments.PushString ( strFile.c_str ( ) );
        else
            Arguments.PushNil ( );

        // Push the line (if any)
        if ( iLine > -1 )
            Arguments.PushNumber ( iLine );
        else
            Arguments.PushNil ( );
        
        // Call onDebugMessage
        g_pGame->GetMapManager ( )->GetRootElement ( )->CallEvent ( "onDebugMessage", Arguments );

        m_bTriggeringOnDebugMessage = false;
    }

    // Log it to the file if enough level
    if ( m_uiLogFileLevel >= 1 )
    {
        PrintLog ( strText );
    }

    // Log to console
    CLogger::LogPrintf( "%s\n", strText.c_str () );

    // Tell the players
    Broadcast ( CDebugEchoPacket ( strText, 1, 255, 255, 255 ), 1 );
}
Example #13
0
nfsstat3 CNFS3Prog::ProcedureFSSTAT(void)
{
    char *path;
    post_op_attr obj_attributes;
    size3 tbytes, fbytes, abytes, tfiles, ffiles, afiles;
    uint32 invarsec;

    nfsstat3 stat;

    PrintLog("FSSTAT");
    path = GetPath();
    stat = CheckFile(path);

    if (stat == NFS3_OK) {
        obj_attributes.attributes_follow = GetFileAttributesForNFS(path, &obj_attributes.attributes);

        if (obj_attributes.attributes_follow
            && GetDiskFreeSpaceEx(path, (PULARGE_INTEGER)&fbytes, (PULARGE_INTEGER)&tbytes, (PULARGE_INTEGER)&abytes)
            ) {
            //tfiles = 99999999999;
            //ffiles = 99999999999;
            //afiles = 99999999999;
            invarsec = 0;
        } else {
            stat = NFS3ERR_IO;
        }
    }

    Write(&stat);
    Write(&obj_attributes);

    if (stat == NFS3_OK) {
        Write(&tbytes);
        Write(&fbytes);
        Write(&abytes);
        Write(&tfiles);
        Write(&ffiles);
        Write(&afiles);
        Write(&invarsec);
    }

    return stat;
}
Example #14
0
void CLightManager::GatherStaticLights (int nLevel)
{
if (gameStates.app.bNostalgia)
	return;

int i, j, bColorize = !gameStates.render.nLightingMethod;

PrintLog ("Computing static lighting\n");
gameData.render.vertColor.bDarkness = IsMultiGame && gameStates.app.bHaveExtraGameInfo [1] && extraGameInfo [IsMultiGame].bDarkness;
gameStates.render.nState = 0;
m_data.renderLights.Clear ();
for (i = 0; i < MAX_THREADS; i++)
	m_data.active [i].Clear (0);
Transform (1, bColorize);
for (i = 0; i < gameData.segs.nVertices; i++)
	m_data.variableVertLights [i] = VariableVertexLights (i);
if (gameStates.render.bPerPixelLighting && lightmapManager.HaveLightmaps ()) {
	gameData.render.color.ambient.Clear ();
	return;
	}
if (gameStates.render.nLightingMethod || (gameStates.render.bAmbientColor && !gameStates.render.bColored)) {
		tFaceColor*	pfh, *pf = gameData.render.color.ambient.Buffer ();
		CSegment*	segP;

	memset (pf, 0, gameData.segs.nVertices * sizeof (*pf));
	if (!RunRenderThreads (rtStaticVertLight))
		lightManager.GatherStaticVertexLights (0, gameData.segs.nVertices, 0);
	pf = gameData.render.color.ambient.Buffer ();
	for (i = 0, segP = SEGMENTS.Buffer (); i < gameData.segs.nSegments; i++, segP++) {
		if (segP->m_nType == SEGMENT_IS_SKYBOX) {
			short* sv = segP->m_verts;
			for (j = 8; j; j--, sv++) {
				pfh = pf + *sv;
				pfh->color.red =
				pfh->color.green =
				pfh->color.blue =
				pfh->color.alpha = 1;
				}
			}
		}
	}
}
Example #15
0
off64_t ActualFileSize(ACTUALHANDLE handle)
{
	int retval;
	BY_HANDLE_FILE_INFORMATION info;
	off64_t retsize;

	if (handle == NULL)  return(-1);
	if (handle == INVALID_HANDLE_VALUE)  return(-1);
#ifdef VERBOSE_FUNCTION_ACTUALFILE
	PrintLog("CDVDiso file: ActualFileSize()");
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
	retval = GetFileInformationByHandle(handle, &info);
	if (retval == 0)  return(-1); // Handle doesn't exist...

	retsize = info.nFileSizeHigh;
	retsize *= 0x10000;
	retsize *= 0x10000;
	retsize += info.nFileSizeLow;
	return(retsize);
} // END ActualFileSize()
Example #16
0
void ResourceManager::flushAsText(const char *filename)
{
    finalize();

    StringBuffer name;
    int len = strlen(filename);
    name.append(filename,0,len-4).append(".txt");

    FILE* f = fopen(name.str(), "wb");
    if (f==NULL)
    {
        PrintLog("Create resource text file %s failed", name.str());
        return; // error is ignorable.
    }

    ForEachItemIn(idx, resources)
    {
        ResourceItem&s = (ResourceItem&)resources.item(idx);
        fwrite(s.data.get(),1,s.data.length(),f);
    }
// See ConfigDlg.h for documentation of this method.
void ConfigDlg::OnBnClickedButtonBrowse()
{
    CFileDialog cFileDlg(TRUE);

    cFileDlg.m_ofn.lpstrTitle = _T("Select the image file");
    cFileDlg.m_ofn.lpstrFilter = _T("Supported files(*.bin)\0*.bin;\0All files(*.*)\0*.*\0\0");
    if (IDOK == cFileDlg.DoModal())
    {
        CString fullPath = cFileDlg.GetPathName();
        if (file_exists(fullPath))
        {
            g_pHistoryData->InsertFile(fullPath);
            RefreshImageFileList();
        }
        else
        {
            PrintLog(_T("Invalid full path filename, or file doesn't exist.(%s)"), fullPath);
        }
    }
}
Example #18
0
static void PlRscStdEventProc(struct amr_module_t *pmodule, unsigned long event)
{
	if(event & AMREVENT_READMET) {
		PlRscStdForwardProc(pmodule);
	}
	else if(event & AMREVENT_CHANGEMET) {
		PrintLog(LOGTYPE_DOWNLINK, "PlRscStd AmrEvent Changemet...\n");
		pmodule->flag_sync = 1;
	}
	else if(event & AMREVENT_CTRLCMD){
		PlRscStdCtrlCmdProc(pmodule);
	}
	else if(event & AMREVENT_DIRECTFWD) {
		Pl3762DirectForwardProc(pmodule);
	}
	else{	//防止不支持的事件循环等待
		pmodule->event_echortn = 0;
		pmodule->event_echoed = 1;
	}
}
Example #19
0
void CNFS2Prog::ProcedureSETATTR(void)
{
	char *path;
	unsigned long nMode, nAttr;

	PrintLog("SETATTR");
	path = GetPath();
	if (!CheckFile(path))
		return;

	m_pInStream->Read(&nMode);
	nAttr = 0;
	if ((nMode & 0x100) != 0)
		nAttr |= S_IREAD;
	if ((nMode & 0x80) != 0)
		nAttr |= S_IWRITE;
	_chmod(path, nAttr);
	m_pOutStream->Write(NFS_OK);
	WriteFileAttributes(path);
}
Example #20
0
Smt_Uint TASTConnector::Ami_Originate(Smt_Uint handle, Smt_String actid, Smt_String channel, Smt_String exten, Smt_String callerid, Smt_String variable, Smt_String timeout, Smt_String context, Smt_String priority )
{
	Smt_String strAct = "";
	strAct+= CRLF;
	strAct+= "Action: Originate" + CRLF; 
	strAct+= "Channel: " + channel + CRLF; 
	strAct+= "Exten: " + exten + CRLF; 
	strAct+= "CallerID: " + callerid + CRLF; 
	strAct+= "Variable: " + variable + CRLF;
	strAct+= "Context: " + context + CRLF; 
	strAct+= "Priority: " + priority + CRLF; 
	strAct+= "ActionID: " + actid + CRLF;
	strAct+= "Async: true" + CRLF;
	strAct+= "Timeout: " + timeout + CRLF;
	strAct+= CRLF;
	
	PrintLog(4, "[AMI CMD] %s", strAct.c_str() );	
	
	return SendCmd( handle, strAct );
}
Example #21
0
Smt_Uint TASTConnector::SendCmd(Smt_Uint handle, Smt_String command )
{
	Smt_Uint nRet = Smt_Fail;
	Smt_Pdu pdu;
	pdu.m_MessageID = Evt_IBaseLib_SendData;

	pdu.PutUint(Key_IBaseLib_ChannelHandle, handle );
	pdu.PutByteArray(Key_IBaseLib_DataBuffer, (Smt_ByteArray)command.c_str(), command.length() );
	
	if(handle>0)
		nRet = PostMessage( pdu );

	if( nRet != Smt_Success )
	{
		PrintLog(1, "[TASTConnector::SendCmd] Post Command Fail<0x%x>, Command<%s>,Handle<0x%x>.",
			nRet, command.c_str(), handle );
	}

	return nRet;
}
Example #22
0
nfsstat3 CNFS3Prog::ProcedurePATHCONF(void)
{
    char *path;
    post_op_attr obj_attributes;
    nfsstat3 stat;
    uint32 linkmax, name_max;
    bool no_trunc, chown_restricted, case_insensitive, case_preserving;

    PrintLog("PATHCONF");
    path = GetPath();
    stat = CheckFile(path);

    if (stat == NFS3_OK) {
        obj_attributes.attributes_follow = GetFileAttributesForNFS(path, &obj_attributes.attributes);

        if (obj_attributes.attributes_follow) {
            linkmax = 1023;
            name_max = 255;
            no_trunc = true;
            chown_restricted = true;
            case_insensitive = true;
            case_preserving = true;
        } else {
            stat = NFS3ERR_SERVERFAULT;
        }
    }

    Write(&stat);
    Write(&obj_attributes);

    if (stat == NFS3_OK) {
        Write(&linkmax);
        Write(&name_max);
        Write(&no_trunc);
        Write(&chown_restricted);
        Write(&case_insensitive);
        Write(&case_preserving);
    }

    return stat;
}
Example #23
0
void InitHeadlightShaders (int nLights)
{
	int	i, j, bOk;
	char	*pszFS;

if (nLights < 0) {
	nLights = gameData.render.ogl.nHeadLights;
	gameData.render.ogl.nHeadLights = 0;
	}
if (nLights == gameData.render.ogl.nHeadLights)
	return;
gameStates.render.bHaveDynLights = 0;
PrintLog ("building lighting shader programs\n");
if ((gameStates.ogl.bHeadLight = (gameStates.ogl.bShadersOk && gameOpts->render.nPath))) {
	gameStates.render.bHaveDynLights = 1;
	for (i = 0; i < 2; i++) {
		for (j = 0; j < 4; j++) {
			if (headLightShaderProgs [i][j])
				DeleteShaderProg (&headLightShaderProgs [i][j]);
#if 1//ndef _DEBUG
			if (nLights == 1)
				pszFS = headLightFS [i][j];
			else
#endif
				pszFS = BuildLightingShader (headLightFS [i][j + 4], nLights);
			bOk = (pszFS != NULL) &&
					CreateShaderProg (&headLightShaderProgs [i][j]) &&
					CreateShaderFunc (&headLightShaderProgs [i][j], &lfs [i][j], &lvs [i][j], pszFS, headLightVS [i][j], 1) &&
					LinkShaderProg (&headLightShaderProgs [i][j]);
			if (pszFS && (nLights > 1))
				D2_FREE (pszFS);
			if (!bOk) {
				DeleteHeadLightShader ();
				nLights = 0;
				break;
				}
			}
		}
	}
gameData.render.ogl.nHeadLights = nLights;
}
Example #24
0
/**
* @author ACM2012
* @note  本函数在按下Enter键时触发,函数获取当前输入命令行,并去除串首空格,通过标志位来将获取当前CmdView
  *工作模式,并将相应的命令发送到对应的命令处理过程;在普通命令模式下命令字符串会被发送到命令映射函数
  *MapTask中进行处理,在用户命令模式下,用户函数将在函数完成时获取子命令字符串
*/
void CmdView::DealEnter()
{
		CString strText;
		int        num, len, nIndex,nline;
		///<移动光标到行尾
		len = myedit->GetWindowTextLength(); 
		myedit->SetSel(len, len, false);
		myedit->SetFocus();
		///<brief 处理第一行命令
		num = myedit->GetLineCount();           
		nIndex = myedit->LineIndex(HintLine); 
		len = myedit->LineLength(nIndex); 
		myedit->GetLine(HintLine, strText.GetBuffer(len), len); 
		strText.ReleaseBuffer();
		command = (strText.Mid(HintSLen)).TrimLeft();  
		strText.Empty();
		///<处理多行命令
        if (HintLine < num - 1){     
			num = myedit->GetLineCount();
			///< 将每一行拼接到字符串
			for (nline= HintLine + 1; nline< num; nline++){
				nIndex = myedit->LineIndex(nline);
				len = myedit->LineLength(nIndex);
				myedit->GetLine(nline, strText.GetBuffer(len), len);
				strText.ReleaseBuffer();
				command += strText;
				strText.Empty();
			}
		}
		///< 处理用户命令模式下命令输入过快异常
	   if (THREADFLAG == THREAD_RUN&&CMDFLAG == ROOT)
				PrintLog(_T("命令无效:请等待上一命令执行完"));	 
	   /**
	   *@brief 处理普通命令模式下命令输入
	   */
	   else if (THREADFLAG == THREAD_WAIT)  //未接管模式下发送命令
		       THREADFLAG = THREAD_RUN;
	  ///< 处理用户模式下命令输入
	   else  if (CMDFLAG == USER)  //用户模式下
		   LINEFLAG = NEWLINE;
}
Example #25
0
//returns the number of a free object, updating gameData.objs.nLastObject [0].
//Generally, CObject::Create() should be called to get an CObject, since it
//fills in important fields and does the linking.
//returns -1 if no free objects
int AllocObject (void)
{
	CObject *objP;
	int		nObject;

if (gameData.objs.nObjects >= LEVEL_OBJECTS - 2) {
	FreeObjectSlots (LEVEL_OBJECTS - 10);
	CleanupObjects ();
	}
if (gameData.objs.nObjects >= LEVEL_OBJECTS)
	return -1;
nObject = gameData.objs.freeList [gameData.objs.nObjects++];
#if DBG
if ((nObject < 0) || (nObject >= LEVEL_OBJECTS))
	return -1;
if (nObject == nDbgObj) {
	PrintLog ("allocating object #%d\n", nObject);
	nDbgObj = nDbgObj;
	if (dbgObjInstances++ > 0)
		nDbgObj = nDbgObj;
	}
#endif
if (nObject > gameData.objs.nLastObject [0]) {
	gameData.objs.nLastObject [0] = nObject;
	if (gameData.objs.nLastObject [1] < gameData.objs.nLastObject [0])
		gameData.objs.nLastObject [1] = gameData.objs.nLastObject [0];
	}
objP = OBJECTS + nObject;
#if DBG
if (objP->info.nType != OBJ_NONE)
	objP = objP;
#endif
memset (objP, 0, sizeof (*objP));
objP->info.nType = OBJ_NONE;
objP->SetLinkedType (OBJ_NONE);
objP->info.nAttachedObj =
objP->cType.explInfo.attached.nNext =
objP->cType.explInfo.attached.nPrev =
objP->cType.explInfo.attached.nParent = -1;
return nObject;
}
Example #26
0
Smt_Uint TASTConnector::OnTcpOffline(Smt_String remoteip,Smt_Uint remoteport, Smt_Uint handle, Smt_Uint chtype)
{
	PrintLog(3,"[TASTConnector::OnTcpOffline] RemoteIP<%s>, RemotePort<%d>, Handle<0x%x>, ChannelType<%d>.",
		remoteip.c_str(), remoteport, handle, chtype );

	if( chtype == Smt_Tcp_ClientChannel )
	{
		// AMI Offline
		g_pConnState->m_AmiHandle = 0;

		Smt_Pdu pdu;
		pdu.m_Receiver = g_pConnState->GetGOR();
		pdu.m_MessageID = Evt_ICMU_LinkDown;
		pdu.PutUint( Key_ICMU_Reason, CausePBXNetWorkError );
		if( pdu.m_Receiver > 0 ) g_pConnState->PostMessage( pdu );
	}
	else // Smt_Tcp_ServerChannel
	{
		// AGI Offline	
		//add by caoyj 20120315
		Smt_Pdu pdu;
		pdu.m_Receiver = g_pConnState->GetGOR();
		pdu.m_MessageID = Evt_ICMU_AGIHandleOffline;
		pdu.PutUint( Key_ICMU_Handle, handle );
		g_pConnState->PostMessage( pdu );
		///////////////////////////////////////
	}

	TASTBuffer* pHandle = NULL;
	if( m_HandleMgr.Lookup(handle, pHandle) == Smt_Success )
	{
		m_HandleMgr.Remove( handle );
		if( pHandle != NULL )
		{
			delete pHandle;
			pHandle = NULL;
		}
	}

	return Smt_Success;
}
Example #27
0
int INILoadString(const char *file, const char *section, const char *keyword, char *buffer) {
  char inname[INIMAXLEN+1];
  int filepos;
  ACTUALHANDLE infile;
  int retval;

  if(file == NULL)  return(-1);
  if(section == NULL)  return(-1);
  if(keyword == NULL)  return(-1);
  if(buffer == NULL)  return(-1);

#ifdef VERBOSE_FUNCTION_INI
  PrintLog("USBqemu ini: LoadString(%s, %s, %s)",
           file, section, keyword);
#endif /* VERBOSE_FUNCTION_INI */

  filepos = INIRemoveExt(file, inname);
  INIAddInExt(inname, filepos);

  filepos = 0;
  infile = ActualFileOpenForRead(inname);
  if(infile == ACTUALHANDLENULL)  return(-1);

  retval = INIFindSection(infile, section);
  if(retval < 0) {
    ActualFileClose(infile);
    infile = ACTUALHANDLENULL;
    return(-1);
  } // ENDIF- Didn't find it? Abort.

  retval = INIFindKeyword(infile, keyword, buffer);
  if(retval < 0) {
    ActualFileClose(infile);
    infile = ACTUALHANDLENULL;
    return(-1);
  } // ENDIF- Didn't find it? Abort.

  ActualFileClose(infile);
  infile = ACTUALHANDLENULL;
  return(0);
} // END INILoadString()
    void init()
    {
        CriticalBlock block(crit);
        started = true;
#ifdef _TRACE
        char name[64];
        int port = socket->peer_name(name,sizeof(name));
        url.append(name).append(':').append(port);
        PrintLog("SORT Merge WRITE: start %s, pos=%" RCPF "d, len=%" RCPF "d",url.str(),poscount,numrecs);
#endif
        rowcount_t pos=poscount;
        try
        {
            iseq.setown(src.createMergeInputStream(pos,numrecs));
        }
        catch (IException *e)
        {
            PrintExceptionLog(e,"**Exception(4a)");
            throw;
        }
    }
void SpritePerfScreen::Draw(const UIGeometricData &geometricData)
{
	if (funcIndex < (int32)perfFuncs.size())
	{
		const int32 RUN_COUNT = 30;
		if (runIndex < RUN_COUNT)
		{
			(this->*perfFuncs[funcIndex].func)(&perfFuncs[funcIndex]);
			runIndex++;
		}else if (runIndex == RUN_COUNT)
		{
			funcIndex++;
			runIndex = 0;
		}
	}
	else if (funcIndex == perfFuncs.size())
	{
		PrintLog();
		funcIndex++;
	}
}
Example #30
0
int IsIsoFile(const char *filename)
{
	int retval;
	struct IsoFile *tempfile;
#ifdef VERBOSE_FUNCTION_ISOFILE
	PrintLog("CDVD isofile: IsIsoFile()");
#endif /* VERBOSE_FUNCTION_ISOFILE */
	retval = IsActualFile(filename);
	if (retval < 0)  return(retval); // Not a regular file? Report it.

	tempfile = NULL;
	tempfile = IsoFileOpenForRead(filename);
	if (tempfile == NULL)  return(-3); // Not an image file? Report it.

	retval = 0;
	if ((tempfile->compress > 0) &&
	        (tempfile->tablehandle == ACTUALHANDLENULL) &&
	        (tempfile->tabledata == NULL))  retval = -4;
	tempfile = IsoFileClose(tempfile);
	return(retval);
} // END IsIsoFile()