Пример #1
0
void PageReliefModel::Init()
{
    m_nType = ReliefValve::ms_Type.GetnValue()-1;
    m_nPressType = ReliefValve::ms_CrackExitPress.GetnValue();
    InitNum(m_strCrackPress,m_strCrackPressUnit,ReliefValve::ms_CrackExitPress,1);
    InitNum(m_strExitPress,m_strExitPressUnit,ReliefValve::ms_CrackExitPress,3);
    m_strCvOrK = ReliefValve::ms_KOrCv.GetValue();
    m_dlgBasisArea.Init(ReliefValve::ms_BasisArea);
    CurveWrapper wrapper(ReliefValve::ms_Curve);
    m_nLossType = wrapper.GetLossType();
    wrapper.InitChart(m_page1,Jun::ms_RawData);

    InitPressUnit();
    SetExitStatus();
    SetLossStatus();
    UpdateData(FALSE);
}
Пример #2
0
s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) // not multithread-safe
{
	while (m_alive)
	{
		if (Emu.IsStopped())
		{
			LOG_WARNING(PPU, "ExecAsCallback() aborted");
			return CELL_ECANCELED; // doesn't mean anything
		}
		std::this_thread::sleep_for(std::chrono::milliseconds(1));
	}

	Stop();
	Reset();

	SetEntry(pc);
	SetPrio(1001);
	SetStackSize(0x10000);
	SetExitStatus(CELL_OK);

	SetArg(0, a1);
	SetArg(1, a2);
	SetArg(2, a3);
	SetArg(3, a4);
	Run();

	Exec();

	while (wait && m_alive)
	{
		if (Emu.IsStopped())
		{
			LOG_WARNING(PPU, "ExecAsCallback(wait=%s) aborted", wait ? "true" : "false");
			return CELL_EABORT; // doesn't mean anything
		}
		std::this_thread::sleep_for(std::chrono::milliseconds(1));
	}

	return wait * m_exit_status;
}
Пример #3
0
s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) // not multithread-safe
{
    while (m_alive)
    {
        if (Emu.IsStopped())
        {
            ConLog.Warning("ExecAsCallback() aborted");
            return CELL_ECANCELED; // doesn't mean anything
        }
        Sleep(1);
    }

    Stop();
    Reset();

    SetEntry(pc);
    SetPrio(1001);
    SetStackSize(0x10000);
    SetExitStatus(CELL_OK);

    SetArg(0, a1);
    SetArg(1, a2);
    SetArg(2, a3);
    SetArg(3, a4);
    Run();

    Exec();

    while (wait && m_alive)
    {
        if (Emu.IsStopped())
        {
            ConLog.Warning("ExecAsCallback(wait=%s) aborted", wait ? "true" : "false");
            return CELL_EABORT; // doesn't mean anything
        }
        Sleep(1);
    }

    return wait * m_exit_status;
}
Пример #4
0
void SPUThread::StopAndSignal(u32 code)
{
	SetExitStatus(code); // exit code (not status)
	// TODO: process interrupts for RawSPU

	switch (code)
	{
	case 0x110:
	{
		/* ===== sys_spu_thread_receive_event ===== */

		u32 spuq = 0;
		if (!SPU.Out_MBox.Pop(spuq))
		{
			LOG_ERROR(Log::SPU, "sys_spu_thread_receive_event: cannot read Out_MBox");
			SPU.In_MBox.PushUncond(CELL_EINVAL); // ???
			return;
		}

		if (SPU.In_MBox.GetCount())
		{
			LOG_ERROR(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x): In_MBox is not empty", spuq);
			SPU.In_MBox.PushUncond(CELL_EBUSY); // ???
			return;
		}

		if (Ini.HLELogging.GetValue())
		{
			LOG_NOTICE(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x)", spuq);
		}

		EventQueue* eq;
		if (!SPUQs.GetEventQueue(FIX_SPUQ(spuq), eq))
		{
			SPU.In_MBox.PushUncond(CELL_EINVAL); // TODO: check error value
			return;
		}

		u32 tid = GetId();

		eq->sq.push(tid); // add thread to sleep queue

		while (true)
		{
			switch (eq->owner.trylock(tid))
			{
			case SMR_OK:
				if (!eq->events.count())
				{
					eq->owner.unlock(tid);
					break;
				}
				else
				{
					u32 next = (eq->protocol == SYS_SYNC_FIFO) ? eq->sq.pop() : eq->sq.pop_prio();
					if (next != tid)
					{
						eq->owner.unlock(tid, next);
						break;
					}
				}
			case SMR_SIGNAL:
			{
				sys_event_data event;
				eq->events.pop(event);
				eq->owner.unlock(tid);
				SPU.In_MBox.PushUncond(CELL_OK);
				SPU.In_MBox.PushUncond((u32)event.data1);
				SPU.In_MBox.PushUncond((u32)event.data2);
				SPU.In_MBox.PushUncond((u32)event.data3);
				return;
			}
			case SMR_FAILED: break;
			default: eq->sq.invalidate(tid); SPU.In_MBox.PushUncond(CELL_ECANCELED); return;
			}

			std::this_thread::sleep_for(std::chrono::milliseconds(1));
			if (Emu.IsStopped())
			{
				LOG_WARNING(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x) aborted", spuq);
				eq->sq.invalidate(tid);
				return;
			}
		}
		break;
	}

	case 0x101:
	{
		/* ===== sys_spu_thread_group_exit ===== */

		if (!group)
		{
			LOG_ERROR(Log::SPU, "sys_spu_thread_group_exit(): group not set");
			break;
		}
		else if (!SPU.Out_MBox.GetCount())
		{
			LOG_ERROR(Log::SPU, "sys_spu_thread_group_exit(): Out_MBox is empty");
		}
		else if (Ini.HLELogging.GetValue())
		{
			LOG_NOTICE(Log::SPU, "sys_spu_thread_group_exit(status=0x%x)", SPU.Out_MBox.GetValue());
		}
		
		group->m_group_exit = true;
		group->m_exit_status = SPU.Out_MBox.GetValue();
		for (auto& v : group->list)
		{
			if (CPUThread* t = Emu.GetCPU().GetThread(v))
			{
				t->Stop();
			}
		}

		break;
	}

	case 0x102:
	{
		/* ===== sys_spu_thread_exit ===== */

		if (!SPU.Out_MBox.GetCount())
		{
			LOG_ERROR(Log::SPU, "sys_spu_thread_exit(): Out_MBox is empty");
		}
		else if (Ini.HLELogging.GetValue())
		{
			// the real exit status
			LOG_NOTICE(Log::SPU, "sys_spu_thread_exit(status=0x%x)", SPU.Out_MBox.GetValue());
		}
		SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_STOP);
		Stop();
		break;
	}

	default:
	{
		if (!SPU.Out_MBox.GetCount())
		{
			LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (no message)", code);
		}
		else
		{
			LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue());
		}
		Stop();
		break;
	}
	}
}
Пример #5
0
void PageReliefModel::OnRadioInter()
{
    // TODO: Add your control notification handler code here
    m_nType = 0;
    SetExitStatus();
}