This commit is contained in:
Wojciech Figat
2022-01-21 16:23:30 +01:00
parent d36c502287
commit f801e7ffd9
5 changed files with 50 additions and 29 deletions

View File

@@ -52,11 +52,11 @@ GraphicsService GraphicsServiceInstance;
void Graphics::DisposeDevice()
{
// Clean any danging pointer to last task (might stay if engine is disposing after crash)
GPUDevice::Instance->CurrentTask = nullptr;
if (GPUDevice::Instance)
{
// Clean any danging pointer to last task (might stay if engine is disposing after crash)
GPUDevice::Instance->CurrentTask = nullptr;
GPUDevice::Instance->Dispose();
LOG_FLUSH();
Delete(GPUDevice::Instance);

View File

@@ -43,20 +43,6 @@ namespace
XTaskQueueRegistrationToken UserDeviceAssociationChangedCallbackToken;
}
User* FindUser(const XUserLocalId& id)
{
User* result = nullptr;
for (auto& user : Platform::Users)
{
if (user->LocalId.value == id.value)
{
result = user;
break;
}
}
return result;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
@@ -98,7 +84,7 @@ void CALLBACK UserChangeEventCallback(_In_opt_ void* context, _In_ XUserLocalId
{
LOG(Info, "User event (userLocalId: {0}, event: {1})", userLocalId.value, (int32)event);
auto user = FindUser(userLocalId);
auto user = Platform::FindUser(userLocalId);
switch (event)
{
case XUserChangeEvent::SignedInAgain:
@@ -131,13 +117,13 @@ void CALLBACK UserDeviceAssociationChangedCallback(_In_opt_ void* context,_In_ c
{
LOG(Info, "User device association event (deviceId: {0}, oldUser: {1}, newUser: {2})", ToString(change->deviceId), change->oldUser.value, change->newUser.value);
User* oldGameUser = FindUser(change->oldUser);
User* oldGameUser = Platform::FindUser(change->oldUser);
if (oldGameUser)
{
oldGameUser->AssociatedDevices.Remove(change->deviceId);
}
User* newGameUser = FindUser(change->newUser);
User* newGameUser = Platform::FindUser(change->newUser);
if (newGameUser)
{
newGameUser->AssociatedDevices.Add(change->deviceId);
@@ -184,7 +170,7 @@ void CALLBACK AddUserComplete(_In_ XAsyncBlock* ab)
XUserLocalId localId;
XUserGetLocalId(userHandle, &localId);
if (FindUser(localId) == nullptr)
if (Platform::FindUser(localId) == nullptr)
{
// Login
auto user = New<User>(userHandle, userLocalId, String::Empty);
@@ -326,6 +312,20 @@ bool GDKPlatform::IsRunningOnDevKit()
return deviceType == XSystemDeviceType::XboxOneXDevkit || deviceType == XSystemDeviceType::XboxScarlettDevkit;
}
User* GDKPlatform::FindUser(const XUserLocalId& id)
{
User* result = nullptr;
for (auto& user : Platform::Users)
{
if (user->LocalId.value == id.value)
{
result = user;
break;
}
}
return result;
}
bool GDKPlatform::Init()
{
if (Win32Platform::Init())
@@ -425,10 +425,12 @@ void GDKPlatform::Exit()
XTaskQueueCloseHandle(TaskQueue);
}
UnregisterAppStateChangeNotification(Plm);
CloseHandle(PlmSuspendComplete);
CloseHandle(PlmSignalResume);
if (Plm)
UnregisterAppStateChangeNotification(Plm);
if (PlmSuspendComplete)
CloseHandle(PlmSuspendComplete);
if (PlmSignalResume)
CloseHandle(PlmSignalResume);
UnregisterClassW(ApplicationWindowClass, nullptr);

View File

@@ -44,6 +44,8 @@ public:
static bool IsRunningOnDevKit();
static User* FindUser(const struct XUserLocalId& id);
public:
// [Win32Platform]

View File

@@ -414,7 +414,7 @@ void ScriptingObject::OnDeleteObject()
String ScriptingObject::ToString() const
{
return _type ? String(_type.GetType().ManagedClass->GetFullName()) : String::Empty;
return _type ? String(_type.GetType().Fullname) : String::Empty;
}
ManagedScriptingObject::ManagedScriptingObject(const SpawnParams& params)

View File

@@ -394,9 +394,26 @@ namespace Flax.Build.Bindings
}
// Filter condition
condition = condition.Replace("1|1", "1");
condition = condition.Replace("1|0", "1");
condition = condition.Replace("0|1", "1");
bool modified;
do
{
modified = false;
if (condition.Contains("1|1"))
{
condition = condition.Replace("1|1", "1");
modified = true;
}
if (condition.Contains("1|0"))
{
condition = condition.Replace("1|0", "1");
modified = true;
}
if (condition.Contains("0|1"))
{
condition = condition.Replace("0|1", "1");
modified = true;
}
} while (modified);
// Skip chunk of code of condition fails
if (condition != "1")