Esempio n. 1
0
u32 FreeMemoryBlock(u32 uid) {
	INFO_LOG(HLE, "FreeMemoryBlock(%08x)", uid);
	u32 blockPtr = userMemory.GetBlockStartFromAddress(uid);
	if (!blockPtr) {
		return SCE_KERNEL_ERROR_UNKNOWN_UID;
	}
	userMemory.Free(blockPtr);
	return 0;
}
Esempio n. 2
0
// Parameters are an educated guess.
int sceKernelDeleteTls(SceUID uid)
{
	WARN_LOG(HLE, "sceKernelDeleteTls(%08x)", uid);
	u32 error;
	TLS *tls = kernelObjects.Get<TLS>(uid, error);
	if (tls)
	{
		// TODO: Wake waiting threads, probably?
		userMemory.Free(tls->address);
		tlsUsedIndexes[tls->ntls.index] = false;
		kernelObjects.Destroy<TLS>(uid);
	}
	return error;
}
Esempio n. 3
0
void sceKernelDeleteFpl()
{
	SceUID id = PARAM(0);
	u32 error;
	FPL *fpl = kernelObjects.Get<FPL>(id, error);
	if (fpl)
	{
		userMemory.Free(fpl->address);
		DEBUG_LOG(HLE,"sceKernelDeleteFpl(%i)", id);
		RETURN(kernelObjects.Destroy<FPL>(id));
	}
	else
	{
		RETURN(error);
	}
}
Esempio n. 4
0
int sceKernelDeleteVpl(SceUID uid)
{
	DEBUG_LOG(HLE, "sceKernelDeleteVpl(%i)", uid);
	u32 error;
	VPL *vpl = kernelObjects.Get<VPL>(uid, error);
	if (vpl)
	{
		bool wokeThreads = __KernelClearVplThreads(vpl, SCE_KERNEL_ERROR_WAIT_DELETE);
		if (wokeThreads)
			hleReSchedule("vpl deleted");

		userMemory.Free(vpl->address);
		kernelObjects.Destroy<VPL>(uid);
		return 0;
	}
	else
		return error;
}
Esempio n. 5
0
u32 FreeMemoryBlock(u32 uid) {
	INFO_LOG(HLE, "FreeMemoryBlock(%08x)", uid);
	userMemory.Free(uid);
	return 0;
}
Esempio n. 6
0
 void operator delete (void * p)
 {
   ball.Free (p);
 }
Esempio n. 7
0
void Body::DestroyFixture(Fixture* fixture)
{
	assert(m_world->IsLocked() == false);
	if (m_world->IsLocked() == true)
	{
		return;
	}

	assert(fixture->m_body == this);

	// Remove the fixture from this body's singly linked list.
	assert(m_fixtureCount > 0);
	Fixture** node = &m_fixtureList;
	bool found = false;
	while (*node != NULL)
	{
		if (*node == fixture)
		{
			*node = fixture->m_next;
			found = true;
			break;
		}

		node = &(*node)->m_next;
	}

	// You tried to remove a shape that is not attached to this body.
	assert(found);

	// Destroy any contacts associated with the fixture.
	ContactEdge* edge = m_contactList;
	while (edge)
	{
		Contact* c = edge->contact;
		edge = edge->next;

		Fixture* fixtureA = c->GetFixtureA();
		Fixture* fixtureB = c->GetFixtureB();

		if (fixture == fixtureA || fixture == fixtureB)
		{
			// This destroys the contact and removes it from
			// this body's contact list.
			m_world->m_contactManager.Destroy(c);
		}
	}

	BlockAllocator* allocator = &m_world->m_blockAllocator;

	if (m_flags & activeFlag)
	{
		BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase;
		fixture->DestroyProxies(broadPhase);
	}

	fixture->Destroy(allocator);
	fixture->m_body = NULL;
	fixture->m_next = NULL;
	fixture->~Fixture();
	allocator->Free(fixture, sizeof(Fixture));

	--m_fixtureCount;

	// Reset the mass data.
	ResetMassData();
}