| 581 | } |
| 582 | |
| 583 | bool CPlugin::SetPauseState(bool paused) |
| 584 | { |
| 585 | if (paused && GetStatus() != Plugin_Running) |
| 586 | { |
| 587 | return false; |
| 588 | } |
| 589 | else if (!paused && GetStatus() != Plugin_Paused && GetStatus() != Plugin_Error) { |
| 590 | return false; |
| 591 | } |
| 592 | |
| 593 | if (paused) |
| 594 | { |
| 595 | LibraryActions(LibraryAction_Removed); |
| 596 | } |
| 597 | else |
| 598 | { |
| 599 | // Set to running again BEFORE trying to call OnPluginPauseChange ;) |
| 600 | m_status = Plugin_Running; |
| 601 | m_pRuntime->SetPauseState(false); |
| 602 | } |
| 603 | |
| 604 | IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange"); |
| 605 | if (pFunction) |
| 606 | { |
| 607 | cell_t result; |
| 608 | pFunction->PushCell(paused ? 1 : 0); |
| 609 | pFunction->Execute(&result); |
| 610 | } |
| 611 | |
| 612 | if (paused) |
| 613 | { |
| 614 | m_status = Plugin_Paused; |
| 615 | m_pRuntime->SetPauseState(true); |
| 616 | } |
| 617 | |
| 618 | g_PluginSys._SetPauseState(this, paused); |
| 619 | |
| 620 | if (!paused) |
| 621 | { |
| 622 | LibraryActions(LibraryAction_Added); |
| 623 | } |
| 624 | |
| 625 | return true; |
| 626 | } |
| 627 | |
| 628 | IdentityToken_t *CPlugin::GetIdentity() |
| 629 | { |
no test coverage detected