Esempio n. 1
0
void layout_cell_set_h(layout_t *lt, const char *name, int h)
{
	lelex_cell_t *cell = lelex_get_cell( lt->lelex, name );
	
	cassert( h >= 0, "height must be >= 0" );
	
	sizeinfo_set( &cell->height, h, 0 );
}
Esempio n. 2
0
/*static*/ void Specific::pushBuffer(char *&_pb, unsigned _id){
	cassert(_pb);
	cassert(_id < SpecificData::Capacity);
	SpecificData				&rsd(SpecificData::current());
	SpecificData::CachePoint	&rcp(rsd.cps[_id]);
	idbgx(Debug::specific,"pushBuffer "<<_id<<" cp "<<rcp.cp<<' '<<(void*)_pb);
	if(rcp.sz < rsd.pcc->stackCapacity(_id)){
		BufferNode *pbn(reinterpret_cast<BufferNode*>(_pb));
		++rcp.sz;
		pbn->pnext = rcp.pnode;
		rcp.pnode = pbn;
	}else{
		--rcp.cp;
		delete []_pb;
	}
	_pb = NULL;
}
Esempio n. 3
0
	void createWorker(){
		cassert(!mtx.tryLock());
		++wkrcnt;
		if(ctrl.createWorker(*this)){
		}else{
			--wkrcnt;
			thrcnd.broadcast();
		}
	}
Esempio n. 4
0
/* Audited by: green(2002.06.11) */
static unsigned bse_avail(blocknr_set_entry * bse)
{
	unsigned used = bse->nr_singles + 2 * bse->nr_pairs;

	assert("jmacd-5088", BLOCKNR_SET_ENTRIES_NUMBER >= used);
	cassert(sizeof(blocknr_set_entry) == BLOCKNR_SET_ENTRY_SIZE);

	return BLOCKNR_SET_ENTRIES_NUMBER - used;
}
Esempio n. 5
0
FetchSlaveMessage::~FetchSlaveMessage(){
	idbg(""<<(void*)this);
	cassert(serialized);
	print();
// 	if(fromv.first != 0xffffffff){
// 		idbg("unsuccessfull sent");
// 		//signal fromv object to die
// 		Manager::the().signalObject(fromv.first, fromv.second, frame::S_RAISE | frame::S_KILL);
// 	}
}
Esempio n. 6
0
bool
quarantine_boot(void)
{

	cassert(config_fill);

	if (quarantine_tsd_boot())
		return (true);

	return (false);
}
Esempio n. 7
0
static void
arena_large_reset_stats_cancel(arena_t *arena, size_t usize)
{
	szind_t index = size2index(usize);
	szind_t hindex = (index >= NBINS) ? index - NBINS : 0;

	cassert(config_stats);

	arena->stats.ndalloc_large--;
	arena->stats.lstats[hindex].ndalloc--;
}
Esempio n. 8
0
CParticle::~CParticle()
{
	if( myReleaseSprite )
		delete mySprite;

	for( std::size_t i = 0; i < myParticleHacks.size(); ++i )
	{
		cassert( myParticleHacks[ i ] );
		if( myParticleHacks[ i ]->FreeMe() ) 
			delete myParticleHacks[ i ];
	}
}
Esempio n. 9
0
bool CParticle::Update( float dt )
{
	if (myPaused)
		return false;
	
	if( mySprite == NULL ) { myDead = true; return false; }

	myDelay -= dt;
	if(myDelay > 0) return false;
	
	myTimeNow += dt;
	
	if( myTimeNow < 0 )
	{
		mySprite->SetVisibility( false );
		return false;
	} else {
		mySprite->SetVisibility( true );
	}
	
	if( myTimeNow >= myLifeTime )
		myDead = true;
		
	if( mySprite == NULL )
		return false;
		
	std::vector< float > color = mySprite->GetColor();
	for( int i = 0; i < 4; ++i )
		color[ i ] = ceng::math::Clamp( color[ i ] + myColorChanges[ i ] * dt, 0.f, 1.f );
	
	mySprite->SetColor(color);
	mySprite->SetRotation( mySprite->GetRotation() + myRotationVelocity * dt );
	mySprite->SetScale( mySprite->GetScale() + (myScaleVel * dt) );

	if( myUseVelocityAsRotation )
		mySprite->SetRotation( myVelocity.Angle() - (float)ceng::math::pi * 0.5f );

	mySprite->MoveCenterTo( mySprite->GetCenterPos() + myVelocity * dt );

	myVelocity += myGravity * dt;
	myVelocity -= myVelocity * myVelocitySlowDown * dt;

	for( std::size_t i = 0; i < myParticleHacks.size(); ++i ) 
	{
		cassert( myParticleHacks[ i ] );
		myParticleHacks[ i ]->Update( this, dt );
	}

	mySprite->Update( dt );

	return true;
}
Esempio n. 10
0
void
quarantine(tsd_t *tsd, void *ptr)
{
	quarantine_t *quarantine;
	size_t usize = isalloc(ptr, config_prof);

	cassert(config_fill);
	assert(opt_quarantine);

	if ((quarantine = tsd_quarantine_get(tsd)) == NULL) {
		idalloctm(tsd, ptr, NULL, false);
		return;
	}
	/*
	 * Drain one or more objects if the quarantine size limit would be
	 * exceeded by appending ptr.
	 */
	if (quarantine->curbytes + usize > opt_quarantine) {
		size_t upper_bound = (opt_quarantine >= usize) ? opt_quarantine
		    - usize : 0;
		quarantine_drain(tsd, quarantine, upper_bound);
	}
	/* Grow the quarantine ring buffer if it's full. */
	if (quarantine->curobjs == (ZU(1) << quarantine->lg_maxobjs))
		quarantine = quarantine_grow(tsd, quarantine);
	/* quarantine_grow() must free a slot if it fails to grow. */
	assert(quarantine->curobjs < (ZU(1) << quarantine->lg_maxobjs));
	/* Append ptr if its size doesn't exceed the quarantine size. */
	if (quarantine->curbytes + usize <= opt_quarantine) {
		size_t offset = (quarantine->first + quarantine->curobjs) &
		    ((ZU(1) << quarantine->lg_maxobjs) - 1);
		quarantine_obj_t *obj = &quarantine->objs[offset];
		obj->ptr = ptr;
		obj->usize = usize;
		quarantine->curbytes += usize;
		quarantine->curobjs++;
		if (config_fill && unlikely(opt_junk_free)) {
			/*
			 * Only do redzone validation if Valgrind isn't in
			 * operation.
			 */
			if ((!config_valgrind || likely(!in_valgrind))
			    && usize <= SMALL_MAXCLASS)
				arena_quarantine_junk_small(ptr, usize);
			else
				memset(ptr, 0x5a, usize);
		}
	} else {
		assert(quarantine->curbytes == 0);
		idalloctm(tsd, ptr, NULL, false);
	}
}
Esempio n. 11
0
bounds_t *lt_bounds(layout_t *lt, const char *name) 
{
	lelex_cell_t *cell = lelex_get_cell(lt->lelex, name);
	
	if ( cell != NULL )
	{
		cell->bounds.owner = OBJECT(lt);
		return &cell->bounds;
	}
	
	cassert( cell != NULL, "Bounds requested for non-existant cell '%s'!", name );
	return NULL;
}
Esempio n. 12
0
// write multiple characters
// virtual
std::streamsize DeviceOutBuffer::xsputn(const char* s, std::streamsize num){
	//we can safely put BUFF_FLUSH into the buffer
	int towrite = BUFF_CP - BUFF_FLUSH;
	if(towrite > static_cast<int>(num)) towrite = static_cast<int>(num);
	memcpy(bpos, s, towrite);
	bpos += towrite;
	if((bpos - bbeg) > BUFF_FLUSH && !flush()){
		cassert(0);
		return -1;
	}
	if(num == towrite) return num;
	num -= towrite;
	s += towrite;
	if(num >= BUFF_FLUSH){
		std::streamsize retv = pd->write(s, static_cast<uint32>(num));
		cassert(retv != num);
		return retv;
	}
	memcpy(bpos, s, static_cast<size_t>(num));
	bpos += num;
	return num;
}
Esempio n. 13
0
void Debug::Data::doRespin(){
	sz = 0;
	string fname;
	//find the last file
	if(respincnt == 0){
		filePath(fname, 0, path, name);
		Directory::eraseFile(fname.c_str());
	}else{
		uint32 lastpos = respincnt;
		while(lastpos >= 1){
			filePath(fname, lastpos, path, name);
			if(FileDevice::size(fname.c_str()) >= 0){
				break;
			}
			--lastpos;
		}
		string frompath;
		string topath;
        
		if(lastpos == respincnt){
			filePath(topath, respincnt, path, name);
			--lastpos;
		}else{
			filePath(topath, lastpos + 1, path, name);
		}
		
		while(lastpos){
			filePath(frompath, lastpos, path, name);
			Directory::renameFile(topath.c_str(), frompath.c_str());
			topath = frompath;
			--lastpos;
		}
		
		filePath(frompath, 0, path, name);
		Directory::renameFile(topath.c_str(), frompath.c_str());
		fname = frompath;
	}
	
	
	if(fd.create(fname.c_str(), FileDevice::WriteOnlyE)){
		pos = &cerr;
	}else{
		if(pos == &dos){
			dos.device(fd);//close the current file
		}else if(pos == &dbos){
			dbos.device(fd);//close the current file
		}else{
			cassert(false);
		}
	}
}
Esempio n. 14
0
void x86Backend::CompileCommand( Command& cmd )
{
	if( CompileCommand_Arithmetic( cmd ) ) { }
	else if( CompileCommand_ExtArithmetic( cmd ) ) { }
	else if( CompileCommand_Control( cmd ) ) { }
	else if( CompileCommand_Conditionals( cmd ) ) { }
	else if( CompileCommand_System( cmd ) ) { }
	else {
		msg( E_WARNING, E_VERBOSE, "Using an interpreter gate call to execute instruction." );
		cassert( cmd.type == Value::V_MAX, "Cannot use an interpreter gate call on a non-stack-less command (type: %s)",
		         ProcDebug::Print( cmd.type ).c_str() );
		CompileBinaryGateCall( BinaryFunction::BF_COMMANDGATE, reinterpret_cast<abiret_t>( &cmd ) );
	}
}
Esempio n. 15
0
bool ObjectSelector::push(ObjectPointerT &_robj){
	cassert(d.fstk.size());
	uint pos = d.fstk.top();
	if(!this->setObjectThread(*_robj, pos)){
		return false;
	}
	d.fstk.pop();
	d.sv[pos].objptr = _robj;
	d.sv[pos].timepos = 0;
	d.sv[pos].state = 1;
	++d.sz;
	d.objq.push(pos);
	return true;
}
Esempio n. 16
0
bool
chunk_dss_boot(void)
{

	cassert(config_dss);

	if (malloc_mutex_init(&dss_mtx))
		return (true);
	dss_base = sbrk(0);
	dss_prev = dss_base;
	dss_max = dss_base;

	return (false);
}
Esempio n. 17
0
/*virtual*/ void Listener::execute(ExecuteContext &_rexectx){
	idbg("here");
	cassert(this->socketOk());
	if(notified()){
		Locker<Mutex>	lock(Manager::specific().mutex(*this));
		ulong sm = this->grabSignalMask();
		if(sm & frame::S_KILL){ 
			_rexectx.close();
			return;
		}
	}
	
	solid::uint cnt(10);
	
	while(cnt--){
		if(state == 0){
			switch(this->socketAccept(sd)){
				case frame::aio::AsyncError:
					_rexectx.close();
					return;
				case frame::aio::AsyncSuccess:break;
				case frame::aio::AsyncWait:
					state = 1;
					return;
			}
		}
		state = 0;
		cassert(sd.ok());
		//TODO: one may do some filtering on sd based on sd.remoteAddress()
		if(ctxptr.get()){
			rsvc.insertConnection(sd, ctxptr.get(), true);
		}else{
			rsvc.insertConnection(sd);
		}
	}
	_rexectx.reschedule();
}
Esempio n. 18
0
void FetchSlaveMessage::ipcOnReceive(frame::ipc::ConnectionContext const &_rctx, frame::ipc::Message::MessagePointerT &_rmsgptr){
	DynamicPointer<frame::Message> msgptr(_rmsgptr);
	conid = frame::ipc::ConnectionContext::the().connectionuid;
	if(ipcIsOnReceiver()){
		idbg((void*)this<<" Received FetchSlaveMessage on peer");
		print();
		ObjectUidT	ttov;
		Steward::the().sendMessage(msgptr);
	}else if(ipcIsBackOnSender()){
		idbg((void*)this<<" Received FetchSlaveMessage on sender");
		print();
		ipcResetState();
		Manager::the().notify(msgptr, ObjectUidT(tov.first, tov.second));
	}else{
		cassert(false);
	}
}
Esempio n. 19
0
static void
arena_large_dalloc_stats_update(arena_t *arena, size_t usize)
{
	szind_t index, hindex;

	cassert(config_stats);

	if (usize < LARGE_MINCLASS)
		usize = LARGE_MINCLASS;
	index = size2index(usize);
	hindex = (index >= NBINS) ? index - NBINS : 0;

	arena->stats.ndalloc_large++;
	arena->stats.allocated_large -= usize;
	arena->stats.lstats[hindex].ndalloc++;
	arena->stats.lstats[hindex].curlextents--;
}
Esempio n. 20
0
int ObjectSelector::doExecute(unsigned _i, ulong _evs, TimeSpec _crttout){
	
	this->associateObjectToCurrentThread(*d.sv[_i].objptr);
	
	int							rv = 0;
	Object::ExecuteController	exectl(_evs, _crttout);
	
	this->executeObject(*d.sv[_i].objptr, exectl);
	
	switch(exectl.returnValue()){
		case Object::ExecuteContext::RescheduleRequest:
			idbgx(Debug::frame, "OK: reentering object");
			if(!d.sv[_i].state) {d.objq.push(_i); d.sv[_i].state = 1;}
			d.sv[_i].timepos.set(0xffffffff);
			break;
		case Object::ExecuteContext::WaitRequest:
			idbgx(Debug::frame, "TOUT: object waits for signals");
			d.sv[_i].timepos.set(0xffffffff);
			break;
		case Object::ExecuteContext::WaitUntilRequest:
			idbgx(Debug::frame, "TOUT: object waits for signals");
			d.sv[_i].timepos = exectl.waitTime();
			if(d.ntimepos > exectl.waitTime()){
				d.ntimepos = exectl.waitTime();
			}
			break;
		case Object::ExecuteContext::LeaveRequest:
			idbgx(Debug::frame, "LEAVE: object leave");
			d.fstk.push(_i);
			d.sv[_i].objptr.release();
			d.sv[_i].state = 0;
			--d.sz;
			if(empty()) rv = Data::EXIT_LOOP;
			break;
		case Object::ExecuteContext::CloseRequest:
			d.fstk.push(_i);
			this->stopObject(*d.sv[_i].objptr);
			d.sv[_i].objptr.clear();
			d.sv[_i].state = 0;
			--d.sz;
			if(empty()) rv = Data::EXIT_LOOP;
			break;
		default: cassert(false);break;
	}
	return rv;
}
Esempio n. 21
0
bool
chunk_in_dss(void *chunk)
{
	bool ret;

	cassert(config_dss);

	malloc_mutex_lock(&dss_mtx);
	if ((uintptr_t)chunk >= (uintptr_t)dss_base
	    && (uintptr_t)chunk < (uintptr_t)dss_max)
		ret = true;
	else
		ret = false;
	malloc_mutex_unlock(&dss_mtx);

	return (ret);
}
Esempio n. 22
0
/*static*/ char* Specific::popBuffer(unsigned _id){
	cassert(_id < SpecificData::Capacity);
	SpecificData				&rsd(SpecificData::current());
	SpecificData::CachePoint	&rcp(rsd.cps[_id]);
	char *tb;
	if(rcp.pnode){
		BufferNode *pnbn = rcp.pnode->pnext;
		tb = reinterpret_cast<char*>(rcp.pnode);
		rcp.pnode = pnbn;
		--rcp.sz;
	}else{
		++rcp.cp;
		tb = new char[indexToCapacity(_id)];
	}
	idbgx(Debug::specific,"popBuffer "<<_id<<" cp "<<rcp.cp<<' '<<(void*)tb);
	return tb;
}
Esempio n. 23
0
int SerializerBase::run(char *_pb, unsigned _bl, void *_pctx){
	cpb = pb = _pb;
	be = cpb + _bl;
	while(fstk.size()){
		FncData &rfd = fstk.top();
		switch((*reinterpret_cast<FncT>(rfd.f))(*this, rfd, _pctx)) {
			case Continue: continue;
			case Success: fstk.pop(); break;
			case Wait: goto Done;
			case Failure: 
				resetLimits();
				return -1;
		}
	}
	resetLimits();
	Done:
	cassert(fstk.size() || fstk.empty() && estk.empty());
	return cpb - pb;
}
Esempio n. 24
0
File: debug.cpp Progetto: 2asoft/0ad
Status debug_WriteCrashlog(const wchar_t* text)
{
	// (avoid infinite recursion and/or reentering this function if it
	// fails/reports an error)
	enum State
	{
		IDLE,
		BUSY,
		FAILED
	};
	// note: the initial state is IDLE. we rely on zero-init because
	// initializing local static objects from constants may happen when
	// this is first called, which isn't thread-safe. (see C++ 6.7.4)
	cassert(IDLE == 0);
	static volatile intptr_t state;

	if(!cpu_CAS(&state, IDLE, BUSY))
		return ERR::REENTERED;	// NOWARN

	OsPath pathname = ah_get_log_dir()/"crashlog.txt";
	FILE* f = sys_OpenFile(pathname, "w");
	if(!f)
	{
		state = FAILED;	// must come before DEBUG_DISPLAY_ERROR
		DEBUG_DISPLAY_ERROR(L"Unable to open crashlog.txt for writing (please ensure the log directory is writable)");
		return ERR::FAIL;	// NOWARN (the above text is more helpful than a generic error code)
	}

	fputwc(0xFEFF, f);	// BOM
	fwprintf(f, L"%ls\n", text);
	fwprintf(f, L"\n\n====================================\n\n");

	// allow user to bundle whatever information they want
	ah_bundle_logs(f);

	fclose(f);
	state = IDLE;
	return INFO::OK;
}
Esempio n. 25
0
GTween* GTweenEntityRotationTo( SGF::Entity* e, float rotation, float time, ceng::easing::IEasingFunc& math_func, bool autokill)
{
    if( e->GetTransform()->R.GetAngle() == rotation )
        return NULL;


    GTween* old_tween = GetGTween( (void*)e, "entity_rotation" );
    if( old_tween && old_tween->GetUserData().x == rotation )
        return NULL;

    // we have old but it's going somewhere else, so let's kill it
    if( old_tween )
        old_tween->Kill();

    GTween* new_tween = new GTween( time, autokill );

    // to identify this
    new_tween->SetName( "entity_rotation" );
    new_tween->SetUserData( types::vector2( rotation, rotation ) );
    new_tween->AddPointer( (void*)e );

    new_tween->SetFunction( math_func );

    ceng::IInterpolator* in = ceng::CreateInterpolatorForAngles(
                                  ceng::CFunctionPtr<>( &(e->GetTransform()->R), &ceng::math::CMat22< float >::GetAngle ),
                                  ceng::CFunctionPtr<>( &(e->GetTransform()->R), &ceng::math::CMat22< float >::SetAngle ),
                                  rotation, NULL );

    cassert( in );
    if( in )
        in->SetName( "rotation" );

    new_tween->AddInterpolator( in );

    return new_tween;
}
Esempio n. 26
0
// Calculate heuristic cost from tile i,j to destination
// (This ought to be an underestimate for correctness)
static u32 CalculateHeuristic(u16 i, u16 j, u16 iGoal, u16 jGoal, u16 rGoal)
{
#if USE_DIAGONAL_MOVEMENT
	CFixedVector2D pos (fixed::FromInt(i), fixed::FromInt(j));
	CFixedVector2D goal (fixed::FromInt(iGoal), fixed::FromInt(jGoal));
	fixed dist = (pos - goal).Length();
	// TODO: the heuristic could match the costs better - it's not really Euclidean movement

	fixed rdist = dist - fixed::FromInt(rGoal);
	rdist = rdist.Absolute();

	// To avoid overflows on large distances we have to convert to int before multiplying
	// by the full tile cost, which means we lose some accuracy over short distances,
	// so do a partial multiplication here.
	// (This will overflow if sqrt(2)*tilesPerSide*premul >= 32768, so
	// premul=32 means max tilesPerSide=724)
	const int premul = 32;
	cassert(g_CostPerTile % premul == 0);
	return (rdist * premul).ToInt_RoundToZero() * (g_CostPerTile / premul);

#else
	return (abs((int)i - (int)iGoal) + abs((int)j - (int)jGoal)) * g_CostPerTile;
#endif
}
Esempio n. 27
0
int EventDispatcherTest()
{

	TestEventDispacter test;

	cassert( test.hasEventListener( "test" ) );
	cassert( test.hasEventListener( "test1" ) == false );
	
	cassert( test.call_count == 0 );
	test.dispatchEvent( new Event( "test" ) );
	cassert( test.call_count == 1 );

	test.removeEventListener( "test", new FunctionPointer( &test, &TestEventDispacter::HandleTestEvent ) );
	cassert( test.hasEventListener( "test" ) == false );
	test.dispatchEvent( new Event( "test" ) );
	cassert( test.call_count == 1 );


	return 0;

}
Esempio n. 28
0
VfsPath CColladaManager::GetLoadableFilename(const VfsPath& pathnameNoExtension, FileType type)
{
	std::wstring extn;
	switch (type)
	{
	case PMD: extn = L".pmd"; break;
	case PSA: extn = L".psa"; break;
		// no other alternatives
	}

	/*

	If there is a .dae file:
		* Calculate a hash to identify it.
		* Look for a cached .pmd file matching that hash.
		* If it exists, load it. Else, convert the .dae into .pmd and load it.
	Otherwise, if there is a (non-cache) .pmd file:
		* Load it.
	Else, fail.

	The hash calculation ought to be fast, since normally (during development)
	the .dae file will exist but won't have changed recently and so the cache
	would be used. Hence, just hash the file's size, mtime, and the converter
	version number (so updates of the converter can cause regeneration of .pmds)
	instead of the file's actual contents.

	TODO (maybe): The .dae -> .pmd conversion may fail (e.g. if the .dae is
	invalid or unsupported), but it may take a long time to start the conversion
	then realise it's not going to work. That will delay the loading of the game
	every time, which is annoying, so maybe it should cache the error message
	until the .dae is updated and fixed. (Alternatively, avoid having that many
	broken .daes in the game.)

	*/

	// (TODO: the comments and variable names say "pmd" but actually they can
	// be "psa" too.)

	VfsPath dae(pathnameNoExtension.ChangeExtension(L".dae"));
	if (! VfsFileExists(dae))
	{
		// No .dae - got to use the .pmd, assuming there is one
		return pathnameNoExtension.ChangeExtension(extn);
	}

	// There is a .dae - see if there's an up-to-date cached copy

	FileInfo fileInfo;
	if (g_VFS->GetFileInfo(dae, &fileInfo) < 0)
	{
		// This shouldn't occur for any sensible reasons
		LOGERROR(L"Failed to stat DAE file '%ls'", dae.string().c_str());
		return VfsPath();
	}

	// Build a struct of all the data we want to hash.
	// (Use ints and not time_t/off_t because we don't care about overflow
	// but do care about the fields not being 64-bit aligned)
	// (Remove the lowest bit of mtime because some things round it to a
	// resolution of 2 seconds)
#pragma pack(push, 1)
	struct { int version; int mtime; int size; } hashSource
		= { COLLADA_CONVERTER_VERSION, (int)fileInfo.MTime() & ~1, (int)fileInfo.Size() };
	cassert(sizeof(hashSource) == sizeof(int) * 3); // no padding, because that would be bad
#pragma pack(pop)

	// Calculate the hash, convert to hex
	u32 hash = fnv_hash(static_cast<void*>(&hashSource), sizeof(hashSource));
	wchar_t hashString[9];
	swprintf_s(hashString, ARRAY_SIZE(hashString), L"%08x", hash);
	std::wstring extension(L"_");
	extension += hashString;
	extension += extn;

	// realDaePath_ is "[..]/mods/whatever/art/meshes/whatever.dae"
	OsPath realDaePath_;
	Status ret = g_VFS->GetRealPath(dae, realDaePath_);
	ENSURE(ret == INFO::OK);
	wchar_t realDaeBuf[PATH_MAX];
	wcscpy_s(realDaeBuf, ARRAY_SIZE(realDaeBuf), realDaePath_.string().c_str());
	std::replace(realDaeBuf, realDaeBuf+ARRAY_SIZE(realDaeBuf), '\\', '/');
	const wchar_t* realDaePath = wcsstr(realDaeBuf, L"mods/");

	// cachedPmdVfsPath is "cache/mods/whatever/art/meshes/whatever_{hash}.pmd"
	VfsPath cachedPmdVfsPath = VfsPath("cache") / realDaePath;
	cachedPmdVfsPath = cachedPmdVfsPath.ChangeExtension(extension);

	// If it's not in the cache, we'll have to create it first
	if (! VfsFileExists(cachedPmdVfsPath))
	{
		if (! m->Convert(dae, cachedPmdVfsPath, type))
			return L""; // failed to convert
	}

	return cachedPmdVfsPath;
}
Esempio n. 29
0
EmptyChecker::~EmptyChecker(){
	if(v){
		idbgx(Debug::utility, "object check failed for "<<v);
	}
	cassert(v == 0);
}
Esempio n. 30
0
template<> jsval ScriptInterface::ToJSVal<i32>(JSContext* UNUSED(cx), const i32& val)
{
	cassert(JSVAL_INT_BITS == 32);
	return INT_TO_JSVAL(val);
}