AntonioND / nitro-engine

3D engine for the Nintendo DS
150 stars 10 forks source link

Issues with debugging functions NE_GetPolygonCount, NE_GetVertexCount, NE_GetCPUPercent #5

Closed JustMeDaFaq closed 2 years ago

JustMeDaFaq commented 2 years ago

Hi, im having issues with these three functions: NE_GetPolygonCount NE_GetVertexCount NE_GetCPUPercent

First two always return 0, while the GetCPUPercent one is returning numbrs between 400-600.

I attached an example project and the resulting compiled .nds Compiled.zip free_camera.zip

Unbenannt

AntonioND commented 2 years ago

NE_GetPolygonCount and NE_GetVertexCount don't work on emulators, sorry.

I've checked your code, and NE_WaitForVBL(NE_UPDATE_PHYSICS||NE_CAN_SKIP_VBL); is wrong (you are using logical or instead of bitwise or). Try with NE_WaitForVBL(NE_UPDATE_PHYSICS | NE_CAN_SKIP_VBL); and see if that fixes the CPU count.

Also, have you checked on real hardware?

JustMeDaFaq commented 2 years ago

NE_GetPolygonCount and NE_GetVertexCount don't work on emulators, sorry.

I've checked your code, and NE_WaitForVBL(NE_UPDATE_PHYSICS||NE_CAN_SKIP_VBL); is wrong (you are using logical or instead of bitwise or). Try with NE_WaitForVBL(NE_UPDATE_PHYSICS | NE_CAN_SKIP_VBL); and see if that fixes the CPU count.

Also, have you checked on real hardware?

Tested on real hardware too, yeah! :)

Thanks for pointing out, it still shows 400, which seems to be 4 percent tho. Any idea for the poly & vertex counts not showing? Is it may because bottom screen doesnt have any?

@AntonioND

JustMeDaFaq commented 2 years ago

NVM, i needed to put those functions after stuff has been drawn. getting polycon and vertex count is now working too :) Sorry for taking up your time and thanks for pointing out || vs | :)

AntonioND commented 2 years ago

Yes, you need to call them afterwards.

Also, don't call NE_HBLFunc(); manually, I've just seen you do that before waiting for VBL.

The CPU usage should range from 0 to 100, so there is still something wrong. Can you try without NE_CAN_SKIP_VBL?

JustMeDaFaq commented 2 years ago

Yes, you need to call them afterwards.

Also, don't call NE_HBLFunc(); manually, I've just seen you do that before waiting for VBL.

The CPU usage should range from 0 to 100, so there is still something wrong. Can you try without NE_CAN_SKIP_VBL?

Its still giving me 400-600 percent. printf("\nCpuInPercent %i",NE_GetCPUPercent());

Thats with NE_HBLFunc(); commented out @AntonioND

Also with NE_CAN_SKIP_VBL disabled.

JustMeDaFaq commented 2 years ago

Also doing: printf("\nTexMemory %i",NE_TextureFreeMemPercent());

Always returns 0. Tested on both, emulator and device. Same goes for NE_TextureFreeMem

Edit:That one is an issue of my project. Like, i just assumed its using all vbanks by default

AntonioND commented 2 years ago

Oh, yeah, the mem free functions are broken, sorry. I will take a look at the CPU usage issue...

EDIT: Wait, no, that's the defragmentation function, the mem free one should work.

JustMeDaFaq commented 2 years ago

I have NE_TextureFreeMem working. Only issue is the CPU in percent know, which seems to show me correct numbersif i format it like printf("\nTexMemory %03d",NE_TextureFreeMemPercent()); tho.

Vbanks G, H and I arent used currently by NE am i correct?

AntonioND commented 2 years ago

Oooh so the CPU usage function works, it's just that you're not erasing what was printed before. If you print 100 one frame, and 4 the following one, you'll get 400 unless you erase the zeroes.

AntonioND commented 2 years ago

And yeah, only banks A-E are used. You can disable individual banks of A-D, but E is always used (for texture palettes).

JustMeDaFaq commented 2 years ago

Thanks, got it all working :)