| 65 | } |
| 66 | |
| 67 | int32_t menu::main::NetcheckJob::Run() |
| 68 | { |
| 69 | int32_t ret = SCE_OK; |
| 70 | int32_t sync = 0; |
| 71 | SceUID shellPid = SCE_UID_INVALID_UID; |
| 72 | bool dialogAborted = false; |
| 73 | char titleid[12]; |
| 74 | SceNetInitParam param; |
| 75 | |
| 76 | if (m_type == Type_NpOnly) |
| 77 | { |
| 78 | vector<uint32_t> tusSlots; |
| 79 | tusSlots.push_back(NP_TUS_HIST_LOG_SLOT); |
| 80 | tusSlots.push_back(NP_TUS_FAV_LOG_SLOT); |
| 81 | |
| 82 | ret = nputils::Init("NetStream", true, &tusSlots); |
| 83 | dialog::Close(); |
| 84 | if (ret < 0) |
| 85 | { |
| 86 | dialog::OpenError(g_appPlugin, ret, g_appPlugin->GetString(msg_error_psn_connection)); |
| 87 | } |
| 88 | |
| 89 | return SCE_PAF_OK; |
| 90 | } |
| 91 | |
| 92 | param.memory = sce_paf_malloc(SCE_KERNEL_32KiB); |
| 93 | param.size = SCE_KERNEL_32KiB; |
| 94 | param.flags = 0; |
| 95 | |
| 96 | ret = sceNetInit(¶m); |
| 97 | while (ret != SCE_OK) |
| 98 | { |
| 99 | if (!dialog::IsActive() || dialogAborted) |
| 100 | { |
| 101 | dialog::OpenError(g_appPlugin, SCE_ERROR_ERRNO_ECANCELED, Framework::Instance()->GetCommonString("msg_error_network_connection")); |
| 102 | dialogAborted = true; |
| 103 | break; |
| 104 | } |
| 105 | ret = sceNetInit(¶m); |
| 106 | thread::Sleep(100); |
| 107 | } |
| 108 | |
| 109 | ret = sceNetCtlInit(); |
| 110 | while (ret != SCE_OK) |
| 111 | { |
| 112 | if (!dialog::IsActive() || dialogAborted) |
| 113 | { |
| 114 | dialog::OpenError(g_appPlugin, SCE_ERROR_ERRNO_ECANCELED, Framework::Instance()->GetCommonString("msg_error_network_connection")); |
| 115 | dialogAborted = true; |
| 116 | break; |
| 117 | } |
| 118 | ret = sceNetCtlInit(); |
| 119 | thread::Sleep(100); |
| 120 | } |
| 121 | |
| 122 | sceNetCtlInetGetState(&ret); |
| 123 | while (ret != SCE_NET_CTL_STATE_IPOBTAINED) |
| 124 | { |
no test coverage detected