diff --git a/Source/Immutable/Private/Immutable/ImmutableSubsystem.cpp b/Source/Immutable/Private/Immutable/ImmutableSubsystem.cpp index 43b1097..2bcb0c7 100644 --- a/Source/Immutable/Private/Immutable/ImmutableSubsystem.cpp +++ b/Source/Immutable/Private/Immutable/ImmutableSubsystem.cpp @@ -36,13 +36,16 @@ void UImmutableSubsystem::Initialize(FSubsystemCollectionBase& Collection) void UImmutableSubsystem::Deinitialize() { IMTBL_LOG_FUNCSIG + BrowserWidget = nullptr; + #if USING_BLUI_CEF - IMTBL_LOG("Stopped BLUI event loop"); - ImtblBlui->StopBluiEventLoop(); -#endif + ImtblBlui->ConditionalBeginDestroy(); ImtblBlui = nullptr; +#endif + Passport = nullptr; + #if PLATFORM_ANDROID | PLATFORM_IOS UGameViewportClient::OnViewportCreated().Remove(EngineInitCompleteHandle); #else diff --git a/Source/Immutable/Private/Immutable/ImtblBlui.cpp b/Source/Immutable/Private/Immutable/ImtblBlui.cpp index cd6ceb6..4228747 100644 --- a/Source/Immutable/Private/Immutable/ImtblBlui.cpp +++ b/Source/Immutable/Private/Immutable/ImtblBlui.cpp @@ -36,13 +36,13 @@ void UImtblBlui::OnLogEvent(const FString& LogText) void UImtblBlui::WorldTickStart(UWorld* World, ELevelTick LevelTick, float X) { #if USING_BLUI_CEF - if (GetBluEye()->IsBrowserLoading()) { - IMTBL_LOG("Waiting for Browser to load..."); - } else if (!bLoadedIndexJS) { - bLoadedIndexJS = true; + if (!GetBluEye()->IsBrowserLoading() && !bLoadedIndexJS) { const FSoftObjectPath AssetRef( - TEXT("/Script/Immutable.ImtblSDKResource'/Immutable/PackagedResources/" - "index.index'")); + TEXT("/Script/Immutable.ImtblSDKResource'/Immutable/PackagedResources/" + "index.index'")); + + IMTBL_LOG("Browser loaded"); + bLoadedIndexJS = true; if (UObject *LoadedAsset = AssetRef.TryLoad()) { if (const auto Resource = Cast(LoadedAsset)) { GetBluEye()->ExecuteJS(Resource->Js); @@ -136,7 +136,7 @@ void UImtblBlui::Init() const FString CustomContentMethod(TEXT("X-GET-CUSTOM-CONTENT")); const auto Request = CefRequest::Create(); - Request->Set("file://Immutable/index.html", *CustomContentMethod, + Request->Set("file:///Immutable/index.html", *CustomContentMethod, PostData, HeaderMap); GetBluEye()->Browser->GetMainFrame()->LoadRequest(Request); @@ -144,6 +144,7 @@ void UImtblBlui::Init() WorldTickHandle = FWorldDelegates::OnWorldTickStart.AddUObject( this, &UImtblBlui::WorldTickStart); + IMTBL_LOG("Waiting for Browser to load..."); } } else diff --git a/Source/Immutable/Private/Immutable/ImtblBrowserWidget.cpp b/Source/Immutable/Private/Immutable/ImtblBrowserWidget.cpp index 4569913..64dfddd 100644 --- a/Source/Immutable/Private/Immutable/ImtblBrowserWidget.cpp +++ b/Source/Immutable/Private/Immutable/ImtblBrowserWidget.cpp @@ -91,7 +91,7 @@ void UImtblBrowserWidget::SetBrowserContent() const FString IndexHtml = FString("GameSDK Bridge

Bridge Running

"); // IMTBL_LOG("Loaded resource: %s", *Resource->GetName()) - WebBrowserWidget->LoadString(IndexHtml, TEXT("file://immutable/index.html")); + WebBrowserWidget->LoadString(IndexHtml, TEXT("file:///immutable/index.html")); // WebBrowserWidget->LoadURL(FString::Printf(TEXT("%s%s"), // TEXT("file:///"), // *FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectContentDir(), diff --git a/Source/Immutable/Private/ImmutableModule.cpp b/Source/Immutable/Private/ImmutableModule.cpp index 53647bc..0912f3f 100644 --- a/Source/Immutable/Private/ImmutableModule.cpp +++ b/Source/Immutable/Private/ImmutableModule.cpp @@ -30,61 +30,7 @@ void FImmutableModule::StartupModule() } void FImmutableModule::ShutdownModule() -{ -#if PLATFORM_WINDOWS && USING_BLUI_CEF - DWORD aProcesses[1024], cbNeeded; - unsigned int i; - - if (EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) - { - // Calculate how many process identifiers were returned. - DWORD cProcesses = cbNeeded / sizeof(DWORD); - - // Print the name and process identifier for each process. - for (i = 0; i < cProcesses; i++) - { - if (aProcesses[i] != 0) - { - TCHAR szProcessName[MAX_PATH] = TEXT(""); - // Get a handle to the process. - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, aProcesses[i]); - DWORD errCode = GetLastError(); - - IMTBL_LOG("PID %d : ERROR %d ", aProcesses[i], errCode); - // Get the process name. - if (errCode == 0 && hProcess != NULL) - { - HMODULE hMod; - - cbNeeded = 0; - if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) - { - if (GetModuleBaseName(hProcess, hMod, szProcessName, sizeof(szProcessName) / sizeof(TCHAR))) - { - if (!_tcscmp(szProcessName, _T("blu_ue4_process.exe"))) - { - if (TerminateProcess(hProcess, 0) == 0) - { - IMTBL_ERR("Faild to shutdown BLUI executable process"); - } - else - { - IMTBL_LOG("BLUI executable process terminated"); - } - } - } - } - errCode = GetLastError(); - - // Release the handle to the process. - CloseHandle(hProcess); - } - } - } - } - -#endif -} +{} #undef LOCTEXT_NAMESPACE