Esempio n. 1
0
MF_API void MFDebug_DebugAssert(const char *pReason, const char *pMessage, const char *pFile, int line)
{
	MFDebug_Message(MFStr("%s(%d) : Assertion Failure.",pFile,line));
	MFDebug_Message(MFStr("Failed Condition: (%s)\n%s", pReason, pMessage));

	// build callstack log string for message box
#if !defined(_RETAIL)
	MFCallstack_Log();
	const char *pCallstack = MFCallstack_GetCallstackString();
#else
	const char *pCallstack = "Not available in _RETAIL builds";
#endif

	MFDebug_Breakpoint();

	exit(0);

	// TODO: show the android message box...
/*
	// query for debug or exit of process
	if(!MFDebugAndroid_MsgBox(MFStr("Failed Condition: (%s)\n%s\nFile: %s\nLine: %d\n\nCallstack:\n%s", pReason, pMessage, pFile, line, pCallstack), "Assertion Failure, do you wish to debug?"))
	{
		exit(0);
	}
*/
}
Esempio n. 2
0
void Game_Update()
{
	MFCALLSTACK;

	MFDebug_Message(MFStr("Time is %f- %f FPS\t", gSystemTimer.GetSecondsF(), gSystemTimer.GetFPS()));
	MFDebug_Message(MFStr("Left (%1.4f, %1.4f) ", MFInput_Read(Axis_LX, IDD_Gamepad), MFInput_Read(Axis_LY, IDD_Gamepad)));
	MFDebug_Message(MFStr("Right (%1.4f, %1.4f) ", MFInput_Read(Axis_RX, IDD_Gamepad), MFInput_Read(Axis_RY, IDD_Gamepad)));

	CHK_BUTTON(Button_P2_Cross);
	CHK_BUTTON(Button_P2_Circle);
	CHK_BUTTON(Button_P2_Box);
	CHK_BUTTON(Button_P2_Triangle);

	CHK_BUTTON(Button_P2_L1);
	CHK_BUTTON(Button_P2_R1);
	CHK_BUTTON(Button_P2_L2);
	CHK_BUTTON(Button_P2_R2);

	CHK_BUTTON(Button_P2_Start);
	CHK_BUTTON(Button_P2_Select);

	CHK_BUTTON(Button_P2_L3);
	CHK_BUTTON(Button_P2_R3);

	CHK_BUTTON(Button_DUp);
	CHK_BUTTON(Button_DDown);
	CHK_BUTTON(Button_DLeft);
	CHK_BUTTON(Button_DRight);
}
Esempio n. 3
0
MF_API void MFDebug_DebugAssert(const char *pReason, const char *pMessage, const char *pFile, int line)
{
	MFDebug_Message(MFStr("%s(%d) : Assertion Failure.",pFile,line));
	MFDebug_Message(MFStr("Failed Condition: (%s)\n%s", pReason, pMessage));

	MFDebug_Breakpoint();
}
Esempio n. 4
0
void MFModel_DeinitModule()
{
	// list all non-freed textures...
	MFModelPool::Iterator pI = gModelBank.First();
	bool bShowHeader = true;

	while(pI)
	{
		if(bShowHeader)
		{
			bShowHeader = false;
			MFDebug_Message("\nUn-freed models:\n----------------------------------------------------------");
		}

		MFDebug_Message(MFStr("'%s' - x%d", (*pI)->pName, (*pI)->refCount));

		// Destroy template...

		pI = gModelBank.Next(pI);
	}

	MFModel_DeinitModulePlatformSpecific();

	gModelBank.Deinit();
}
Esempio n. 5
0
void MFMaterial_DeinitModule()
{
	MFCALLSTACK;

	// destroy stock materials
	MFMaterial_Release(pNoneMaterial);
	MFMaterial_Release(pWhiteMaterial);
	MFMaterial_Release(pSysLogoLarge);
	MFMaterial_Release(pSysLogoSmall);

#if defined(_PSP)
	// destroy PSP specific stock materials
	MFMaterial_Release(pConnected);
	MFMaterial_Release(pDisconnected);
	MFMaterial_Release(pPower);
	MFMaterial_Release(pCharging);
	MFMaterial_Release(pUSB);
#endif

	MaterialDefinition *pDef = pDefinitionRegistry;

	while(pDef)
	{
		MaterialDefinition *pNext = pDef->pNextDefinition;
		MFMaterial_DestroyDefinition(pDef);
		pDef = pNext;
	}

	bool bShowHeader = true;

	// list all non-freed materials...
	MFResourceIterator *pI = MFResource_EnumerateFirst(MFRT_Material);
	while(pI)
	{
		if(bShowHeader)
		{
			bShowHeader = false;
			MFDebug_Message("\nUn-freed materials:\n----------------------------------------------------------");
		}

		MFMaterial *pMat = (MFMaterial*)MFResource_Get(pI);

		MFDebug_Message(MFStr("'%s' - x%d", pMat->pName, pMat->refCount));

		pMat->refCount = 1;
		MFMaterial_Release(pMat);

		pI = MFResource_EnumerateNext(pI, MFRT_Material);
	}

	MFMaterial_UnregisterMaterialType("Standard");
	MFMaterial_UnregisterMaterialType("Effect");

	gMaterialDefList.Deinit();
	gMaterialRegistry.Deinit();
}
Esempio n. 6
0
/// Resize the context.
void OpenGLContext::ResizeContext(const pp::Size& size)
{
MFDebug_Message("ogl: resize");
	size_ = size;
	if(!context_.is_null())
	{
		context_.ResizeBuffers(size.width(), size.height());
MFDebug_Message("ogl: resized");
	}
}
Esempio n. 7
0
void MFMaterial_DeinitModule()
{
	MFCALLSTACK;

	// destroy stock materials
	MFMaterial_Destroy(pNoneMaterial);
	MFMaterial_Destroy(pWhiteMaterial);
	MFMaterial_Destroy(pSysLogoLarge);
	MFMaterial_Destroy(pSysLogoSmall);

#if defined(_PSP)
	// destroy PSP specific stock materials
	MFMaterial_Destroy(pConnected);
	MFMaterial_Destroy(pDisconnected);
	MFMaterial_Destroy(pPower);
	MFMaterial_Destroy(pCharging);
	MFMaterial_Destroy(pUSB);
#endif

	MaterialDefinition *pDef = pDefinitionRegistry;

	while(pDef)
	{
		MaterialDefinition *pNext = pDef->pNextDefinition;
		MFMaterial_DestroyDefinition(pDef);
		pDef = pNext;
	}

	// list all non-freed materials...
	MFMaterial **ppI = gMaterialList.Begin();
	bool bShowHeader = true;

	while(*ppI)
	{
		if(bShowHeader)
		{
			bShowHeader = false;
			MFDebug_Message("\nUn-freed materials:\n----------------------------------------------------------");
		}

		MFDebug_Message(MFStr("'%s' - x%d", (*ppI)->pName, (*ppI)->refCount));

		(*ppI)->refCount = 1;
		MFMaterial_Destroy(*ppI);

		ppI++;
	}

	MFMaterial_UnregisterMaterialType("Standard");
	MFMaterial_UnregisterMaterialType("Effect");

	gMaterialList.Deinit();
	gMaterialDefList.Deinit();
	gMaterialRegistry.Deinit();
}
Esempio n. 8
0
MF_API void MFDebug_DebugAssert(const char *pReason, const char *pMessage, const char *pFile, int line)
{
	MFDebug_Message(MFStr("%s(%d) : Assertion Failure.",pFile,line));
	MFDebug_Message(MFStr("Failed Condition: (%s)\n%s", pReason, pMessage));

	// query for debug or exit of process
	if(!MFDebugPC_MsgBox(MFStr("Failed Condition: (%s)\n%s\nFile: %s\nLine: %d", pReason, pMessage, pFile, line), "Assertion Failure, do you wish to debug?"))
	{
		ExitProcess(0);
	}
}
Esempio n. 9
0
// Update the graphics context to the new size, and regenerate |pixel_buffer_|
// to fit the new size as well.
void Fuji::DidChangeView(const pp::Rect& position, const pp::Rect& clip)
{
MFDebug_Message("Fuji::DidChangeView");
//			pp::Size view_size = view_->GetSize();
//			const bool view_was_empty = view_size.IsEmpty();
//			view_->UpdateView(position, clip, this);
//			if (view_was_empty)
//				ResetPositions();

/*
int cube_width = cube_ ? cube_->width() : 0;
int cube_height = cube_ ? cube_->height() : 0;
if (position.size().width() == cube_width &&
  position.size().height() == cube_height)
return;  // Size didn't change, no need to update anything.

if (opengl_context_ == NULL)
opengl_context_.reset(new OpenGLContext(this));
opengl_context_->InvalidateContext(this);
opengl_context_->ResizeContext(position.size());
if (!opengl_context_->MakeContextCurrent(this))
return;
if (cube_ == NULL) {
cube_ = new Cube(opengl_context_);
cube_->PrepareOpenGL();
}
cube_->Resize(position.size().width(), position.size().height());
DrawSelf();
*/
}
Esempio n. 10
0
MF_API void MFVertex_LockVertexBuffer(MFVertexBuffer *pVertexBuffer, void **ppVertices)
{
	MFDebug_Assert(pVertexBuffer, "Null vertex buffer");
	MFDebug_Assert(!pVertexBuffer->bLocked, "Vertex buffer already locked!");

	if(pVertexBuffer->bufferType == MFVBType_Dynamic)
	{
		ID3D11Buffer *pVB = (ID3D11Buffer*)pVertexBuffer->pPlatformData;

		D3D11_MAPPED_SUBRESOURCE subresource;
		D3D11_MAP map = (pVertexBuffer->bufferType == MFVBType_Dynamic) ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE;
		HRESULT hr = g_pImmediateContext->Map(pVB, 0, map, D3D11_MAP_FLAG_DO_NOT_WAIT, &subresource);

		if(hr == DXGI_ERROR_WAS_STILL_DRAWING)
		{
			MFDebug_Message("waiting on vertex buffer lock");
			hr = g_pImmediateContext->Map(pVB, 0, map, 0, &subresource);
		}

		MFDebug_Assert(SUCCEEDED(hr), "Failed to map vertex buffer");

		pVertexBuffer->pLocked = subresource.pData;
	}
	else
	{
		pVertexBuffer->pLocked = MFHeap_Alloc(pVertexBuffer->numVerts*pVertexBuffer->pVertexDeclatation->pElementData[0].stride, MFHeap_GetHeap(MFHT_ActiveTemporary));
	}

	if(ppVertices)
		*ppVertices = pVertexBuffer->pLocked;

	pVertexBuffer->bLocked = true;
}
Esempio n. 11
0
MFInitStatus MFPrimitive_InitModule()
{
	MFCALLSTACK;
	if(packet_allocate(&packet, 1024) < 0)
	{
		while(1) MFDebug_Message("NO PACKET");
	}
}
Esempio n. 12
0
void Fuji::Update()
{
	MFDebug_Message("Fuji::Update()");

	// Schedule another update
	UpdateScheduler(kUpdateInterval, this);

	MFSystem_RunFrame();
}
Esempio n. 13
0
MF_API void MFEnd()
{
	MFCALLSTACK;

	MFDebug_Assert(currentVert == beginCount, "Incorrect number of vertices.");

	// Send the DMA chain we have built
	if(packet_send(&packet, DMA_CHANNEL_GIF, DMA_FLAG_CHAIN) < 0)
	{
		MFDebug_Message("CANT SEND PACKET");
		while(1);
	}

}
Esempio n. 14
0
bool Fuji::Init(uint32_t argc, const char* argn[], const char* argv[])
{
	MFDebug_Message("Fuji::Init()");

	// Register the engine modules..
	MFModule_RegisterModules();

	// queue up the next update
	UpdateScheduler(kUpdateInterval, this);

	// Run one frame to kick off the init
	MFSystem_RunFrame();

	return true;
}
Esempio n. 15
0
MF_API void MFDebug_DebugAssert(const char *pReason, const char *pMessage, const char *pFile, int line)
{
	MFDebug_Message(MFStr("%s(%d) : Assertion Failure.",pFile,line));
	MFDebug_Message(MFStr("Failed Condition: %s\n%s", pReason, pMessage));
#if !defined(_RETAIL)
	MFCallstack_Log();
#endif

#if defined(MF_LINUX) || defined(MF_OSX)
	MFDebug_Breakpoint();
#endif

	if(!MFFont_GetDebugFont())
		return;

	while(!gQuit)
	{
		MFSystem_HandleEventsPlatformSpecific();

		MFSystem_UpdateTimeDelta();
		gFrameCount++;

		MFSystem_Update();
		MFSystem_PostUpdate();

		MFRenderer_BeginFramePlatformSpecific();

		MFRenderer_SetClearColour(0,0,0,0);
		MFRenderer_ClearScreen();

		MFView_SetDefault();
		MFView_SetOrtho();

		if(!(((uint32)gSystemTimer.GetSecondsF()) % 2))
		{
			MFMaterial_SetMaterial(MFMaterial_GetStockMaterial(MFMat_White));
			MFPrimitive(PT_QuadList);

			MFBegin(4);
			MFSetColour(1,0,0,1);
			MFSetPosition(50, 50, 0);
			MFSetPosition(590, 110, 0);

			MFSetColour(0,0,0,1);
			MFSetPosition(55, 55, 0);
			MFSetPosition(585, 105, 0);
			MFEnd();
		}

		MFFont_DrawText2f(MFFont_GetDebugFont(), 110, 60, 20, MakeVector(1,0,0,1), "Software Failure. Press left mouse button to continue.");
		MFFont_DrawText2f(MFFont_GetDebugFont(), 240, 80, 20, MakeVector(1,0,0,1), "Guru Meditation: ");

		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 120, 20, MakeVector(1,0,0,1), "Assertion Failure:");
		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 140, 20, MakeVector(1,0,0,1), MFStr("Failed Condition: %s", pReason));
		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 160, 20, MakeVector(1,0,0,1), MFStr("File: %s, Line: %d", pFile, line));
		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 190, 20, MakeVector(1,0,0,1), MFStr("Message: %s", pMessage));

#if !defined(_RETAIL)
		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 230, 20, MakeVector(1,0,0,1), "Callstack:");
		MFFont_DrawText2f(MFFont_GetDebugFont(), 100, 250.0f, 20, MakeVector(1,0,0,1), MFCallstack_GetCallstackString());
#else
		MFFont_DrawText2f(MFFont_GetDebugFont(), 80, 230, 20, MakeVector(1,0,0,1), "Callstack not available in RETAIL builds");
#endif

//		MFSystem_Draw();
		MFRenderer_EndFramePlatformSpecific();
	}
}
Esempio n. 16
0
bool MFModule_InitModules()
{
	uint64 timer = 0;

	for(int a=0; a<gNumModules; ++a)
	{
		uint64 bit = 1ULL << a;

		if(!(gModuleInitComplete & bit) && (gModuleInitComplete & gModules[a].prerequisites) == gModules[a].prerequisites)
		{
			MFInitStatus complete = MFAIC_Failed;
			if((gModules[a].prerequisites & gModuleInitFailed) == 0)
			{
				MFDebug_Message(MFStr("Init %s...", gModules[a].pModuleName));

				timer = MFSystem_ReadRTC();
				complete = gModules[a].pInitFunction();
			}
			else
			{
				// list pre-requisite failures
				if(MFModule_IsModuleInitialised(MFModule_GetBuiltinModuleID(MFBIM_MFString)))
				{
					MFDebug_Message(MFStr("Prerequisite failure"));
				}
			}

			if(complete == MFAIC_Succeeded)
			{
				uint64 initTime = (MFSystem_ReadRTC() - timer) * 1000 / MFSystem_GetRTCFrequency();

				gModuleInitComplete |= bit;

				// if logging is initialised
				MFDebug_Message(MFStr("Init %s complete in %dms", gModules[a].pModuleName, (int)initTime));
			}
			else if(complete == MFAIC_Failed)
			{
				uint64 initTime = (MFSystem_ReadRTC() - timer) * 1000 / MFSystem_GetRTCFrequency();

				gModuleInitComplete |= bit;
				gModuleInitFailed |= bit;

				// if logging is initialised
				MFDebug_Error(MFStr("Init %s FAILED in %dms!", gModules[a].pModuleName, (int)initTime));
			}
		}
	}

	if(gModuleInitComplete == (1ULL << gNumModules) - 1)
	{
		gFujiInitialised = true;

		if(gModuleInitFailed)
		{
			MFDebug_Message("Fuji initialisation completed with errors...");

			// list the failed modules
			//...
		}
		else
		{
			MFDebug_Message("Fuji initialisation complete!");
		}

		MFHeap_Mark();

		// let the game perform any post-init work
		if(pSystemCallbacks[MFCB_InitDone])
			pSystemCallbacks[MFCB_InitDone]();

		// init the timedelta to the moment after initialisation completes
		MFSystem_UpdateTimeDelta();
		return true;
	}

	return false;
}
Esempio n. 17
0
MF_API void MFCallstack_Log()
{
    MFDebug_Message(MFCallstack_GetCallstackString());
}