Add various fixes for Web

This commit is contained in:
Wojtek Figat
2026-02-16 11:59:44 +01:00
parent 3d206e06d0
commit 4ccf969f7a
8 changed files with 15 additions and 7 deletions

View File

@@ -428,7 +428,9 @@ void LevelService::LateFixedUpdate()
void LevelService::Dispose()
{
// End scene actions
ScopeLock lock(_sceneActionsLocker);
_sceneActions.ClearDelete();
// Unload scenes
unloadScenes();

View File

@@ -357,6 +357,8 @@ StringView StringUtils::GetPathWithoutExtension(const StringView& path)
void StringUtils::PathRemoveRelativeParts(String& path)
{
FileSystem::NormalizePath(path);
if (path.Length() == 1 && path[0] == TEXT('/'))
return;
Array<String> components;
path.Split(TEXT('/'), components);

View File

@@ -45,6 +45,11 @@ void ThreadBase::Kill(bool waitForJoin)
if (!_isRunning)
{
ClearHandleInternal();
if (_callAfterWork)
{
_callAfterWork = false;
_runnable->AfterWork(true);
}
return;
}
ASSERT(GetID());

View File

@@ -1,6 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved.
#if PLATFORM_UNIX
#if PLATFORM_UNIX && !PLATFORM_WEB
#include "UnixThread.h"
#include "Engine/Core/Log.h"

View File

@@ -2,7 +2,7 @@
#pragma once
#if PLATFORM_UNIX
#if PLATFORM_UNIX && !PLATFORM_WEB
#include "Engine/Platform/Base/ThreadBase.h"
#include <pthread.h>

View File

@@ -7,7 +7,6 @@
#include "Engine/Core/Log.h"
#include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/Version.h"
#include "Engine/Core/Types/TimeSpan.h"
#include "Engine/Core/Types/Guid.h"
#include "Engine/Platform/CPUInfo.h"
#include "Engine/Platform/MemoryStats.h"
@@ -52,7 +51,7 @@ MemoryStats WebPlatform::GetMemoryStats()
MemoryStats result;
result.TotalPhysicalMemory = emscripten_get_heap_max();
result.UsedPhysicalMemory = emscripten_get_heap_size();
result.TotalVirtualMemory = result.TotalPhysicalMemory;
result.TotalVirtualMemory = 2ull * 1024 * 1024 * 1024; // Max 2GB
result.UsedVirtualMemory = result.UsedPhysicalMemory;
result.ProgramSizeMemory = 0;
return result;

View File

@@ -77,7 +77,7 @@ public:
#ifdef __EMSCRIPTEN_PTHREADS__
return (uint64)pthread_self();
#else
return 0;
return 1;
#endif
}
static String GetSystemName();

View File

@@ -232,8 +232,8 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params)
m_posLookup = (dtMeshTile**)dtAlloc(sizeof(dtMeshTile*)*m_tileLutSize, DT_ALLOC_PERM);
if (!m_posLookup)
return DT_FAILURE | DT_OUT_OF_MEMORY;
memset(m_tiles, 0, sizeof(dtMeshTile)*m_maxTiles);
memset(m_posLookup, 0, sizeof(dtMeshTile*)*m_tileLutSize);
memset((void*)m_tiles, 0, sizeof(dtMeshTile)*m_maxTiles);
memset((void*)m_posLookup, 0, sizeof(dtMeshTile*)*m_tileLutSize);
m_nextFree = 0;
for (int i = m_maxTiles-1; i >= 0; --i)
{