| 511 | // |
| 512 | //***************************************************************************** |
| 513 | u32 DLParser_Process(u32 instruction_limit, DLDebugOutput * debug_output) |
| 514 | { |
| 515 | #ifdef DAEDALUS_ENABLE_PROFILING |
| 516 | DAEDALUS_PROFILE( "DLParser_Process" ); |
| 517 | #endif |
| 518 | if ( !CGraphicsContext::Get()->IsInitialised() || !gRenderer ) |
| 519 | { |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | // Shut down the debug console when we start rendering |
| 524 | // TODO: Clear the front/backbuffer the first time this function is called |
| 525 | // to remove any stuff lingering on the screen. |
| 526 | if(gFirstCall) |
| 527 | { |
| 528 | CGraphicsContext::Get()->ClearAllSurfaces(); |
| 529 | |
| 530 | gFirstCall = false; |
| 531 | } |
| 532 | |
| 533 | // Update Screen only when something is drawn, otherwise several games ex Army Men will flash or shake. |
| 534 | if( g_ROM.GameHacks != CHAMELEON_TWIST_2 ) gGraphicsPlugin->UpdateScreen(); |
| 535 | |
| 536 | OSTask * pTask {(OSTask *)(g_pu8SpMemBase + 0x0FC0)}; |
| 537 | u32 code_base {(u32)pTask->t.ucode & 0x1fffffff}; |
| 538 | u32 code_size {pTask->t.ucode_size}; |
| 539 | u32 data_base {(u32)pTask->t.ucode_data & 0x1fffffff}; |
| 540 | u32 data_size {pTask->t.ucode_data_size}; |
| 541 | u32 stack_size {pTask->t.dram_stack_size >> 6}; |
| 542 | |
| 543 | if ( gLastUcodeBase != code_base ) |
| 544 | { |
| 545 | DLParser_InitMicrocode( code_base, code_size, data_base, data_size ); |
| 546 | } |
| 547 | |
| 548 | // |
| 549 | // Not sure what to init this with. We should probably read it from the dmem |
| 550 | // |
| 551 | gRDPOtherMode.L = 0x00500001; |
| 552 | gRDPOtherMode.H = 0; |
| 553 | |
| 554 | gRDPFrame++; |
| 555 | |
| 556 | CTextureCache::Get()->PurgeOldTextures(); |
| 557 | |
| 558 | // Initialise stack |
| 559 | gDlistStackPointer=0; |
| 560 | gDlistStack.address[0] = (u32)pTask->t.data_ptr; |
| 561 | gDlistStack.limit = -1; |
| 562 | |
| 563 | gRDPStateManager.Reset(); |
| 564 | |
| 565 | #ifdef DAEDALUS_DEBUG_DISPLAYLIST |
| 566 | gNumDListsCulled = 0; |
| 567 | gNumVertices = 0; |
| 568 | gNumRectsClipped = 0; |
| 569 | if (debug_output) |
| 570 | DLDebug_SetOutput(debug_output); |
no test coverage detected