Add various fixes for Web

This commit is contained in:
2026-02-16 11:59:44 +01:00
parent 3d206e06d0
commit 4ccf969f7a
8 changed files with 15 additions and 7 deletions
+2
View File
@@ -428,7 +428,9 @@ void LevelService::LateFixedUpdate()
void LevelService::Dispose() void LevelService::Dispose()
{ {
// End scene actions
ScopeLock lock(_sceneActionsLocker); ScopeLock lock(_sceneActionsLocker);
_sceneActions.ClearDelete();
// Unload scenes // Unload scenes
unloadScenes(); unloadScenes();
@@ -357,6 +357,8 @@ StringView StringUtils::GetPathWithoutExtension(const StringView& path)
void StringUtils::PathRemoveRelativeParts(String& path) void StringUtils::PathRemoveRelativeParts(String& path)
{ {
FileSystem::NormalizePath(path); FileSystem::NormalizePath(path);
if (path.Length() == 1 && path[0] == TEXT('/'))
return;
Array<String> components; Array<String> components;
path.Split(TEXT('/'), components); path.Split(TEXT('/'), components);
@@ -45,6 +45,11 @@ void ThreadBase::Kill(bool waitForJoin)
if (!_isRunning) if (!_isRunning)
{ {
ClearHandleInternal(); ClearHandleInternal();
if (_callAfterWork)
{
_callAfterWork = false;
_runnable->AfterWork(true);
}
return; return;
} }
ASSERT(GetID()); ASSERT(GetID());
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved. // Copyright (c) Wojciech Figat. All rights reserved.
#if PLATFORM_UNIX #if PLATFORM_UNIX && !PLATFORM_WEB
#include "UnixThread.h" #include "UnixThread.h"
#include "Engine/Core/Log.h" #include "Engine/Core/Log.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#if PLATFORM_UNIX #if PLATFORM_UNIX && !PLATFORM_WEB
#include "Engine/Platform/Base/ThreadBase.h" #include "Engine/Platform/Base/ThreadBase.h"
#include <pthread.h> #include <pthread.h>
+1 -2
View File
@@ -7,7 +7,6 @@
#include "Engine/Core/Log.h" #include "Engine/Core/Log.h"
#include "Engine/Core/Types/String.h" #include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/Version.h" #include "Engine/Core/Types/Version.h"
#include "Engine/Core/Types/TimeSpan.h"
#include "Engine/Core/Types/Guid.h" #include "Engine/Core/Types/Guid.h"
#include "Engine/Platform/CPUInfo.h" #include "Engine/Platform/CPUInfo.h"
#include "Engine/Platform/MemoryStats.h" #include "Engine/Platform/MemoryStats.h"
@@ -52,7 +51,7 @@ MemoryStats WebPlatform::GetMemoryStats()
MemoryStats result; MemoryStats result;
result.TotalPhysicalMemory = emscripten_get_heap_max(); result.TotalPhysicalMemory = emscripten_get_heap_max();
result.UsedPhysicalMemory = emscripten_get_heap_size(); result.UsedPhysicalMemory = emscripten_get_heap_size();
result.TotalVirtualMemory = result.TotalPhysicalMemory; result.TotalVirtualMemory = 2ull * 1024 * 1024 * 1024; // Max 2GB
result.UsedVirtualMemory = result.UsedPhysicalMemory; result.UsedVirtualMemory = result.UsedPhysicalMemory;
result.ProgramSizeMemory = 0; result.ProgramSizeMemory = 0;
return result; return result;
+1 -1
View File
@@ -77,7 +77,7 @@ public:
#ifdef __EMSCRIPTEN_PTHREADS__ #ifdef __EMSCRIPTEN_PTHREADS__
return (uint64)pthread_self(); return (uint64)pthread_self();
#else #else
return 0; return 1;
#endif #endif
} }
static String GetSystemName(); static String GetSystemName();
+2 -2
View File
@@ -232,8 +232,8 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params)
m_posLookup = (dtMeshTile**)dtAlloc(sizeof(dtMeshTile*)*m_tileLutSize, DT_ALLOC_PERM); m_posLookup = (dtMeshTile**)dtAlloc(sizeof(dtMeshTile*)*m_tileLutSize, DT_ALLOC_PERM);
if (!m_posLookup) if (!m_posLookup)
return DT_FAILURE | DT_OUT_OF_MEMORY; return DT_FAILURE | DT_OUT_OF_MEMORY;
memset(m_tiles, 0, sizeof(dtMeshTile)*m_maxTiles); memset((void*)m_tiles, 0, sizeof(dtMeshTile)*m_maxTiles);
memset(m_posLookup, 0, sizeof(dtMeshTile*)*m_tileLutSize); memset((void*)m_posLookup, 0, sizeof(dtMeshTile*)*m_tileLutSize);
m_nextFree = 0; m_nextFree = 0;
for (int i = m_maxTiles-1; i >= 0; --i) for (int i = m_maxTiles-1; i >= 0; --i)
{ {