Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp fix for 53 #96

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ bool FJavascriptCommandExecutor::CacheJavascriptContext()
{
// Use Editor context only
const auto JavascriptContext = IJavascriptEditorModule::Get().GetJavascriptContext();
TargetContext = JavascriptContext->ContextId;
if (JavascriptContext)
{
TargetContext = JavascriptContext->ContextId;
}
}

if (TargetContext.IsValid())
Expand Down
2 changes: 1 addition & 1 deletion Source/JavascriptEditor/JavascriptEditorViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Engine/Canvas.h"
#include "Components/OverlaySlot.h"
#include "AssetViewerSettings.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"
#include "Components/DirectionalLightComponent.h"
#if ENGINE_MAJOR_VERSION > 4
#include "UnrealWidget.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/JavascriptEditor/JavascriptUICommands.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "JavascriptUICommands.h"
#include "JavascriptMenuLibrary.h"
#include "Framework/Commands/Commands.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"

//PRAGMA_DISABLE_OPTIMIZATION

Expand Down
2 changes: 1 addition & 1 deletion Source/JavascriptHttp/JavascriptHttpRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
#include "HttpModule.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"

#include "JavascriptHttpRequest.generated.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/JavascriptUMG/JavascriptGameViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "SceneView.h"
#include "CanvasTypes.h"
#include "Widgets/SViewport.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"

#define LOCTEXT_NAMESPACE "UMG"

Expand Down
2 changes: 1 addition & 1 deletion Source/JavascriptUMG/JavascriptWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "JavascriptWindow.h"
#include "Widgets/SWindow.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"

UJavascriptWindow::UJavascriptWindow(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
Expand Down
8 changes: 4 additions & 4 deletions Source/JavascriptWebSocket/JavascriptWebSocket.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ private void HackWebSocketIncludeDir(String WebsocketPath, ReadOnlyTargetRules T
bHasZlib = true;

}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
PlatformSubdir = Path.Combine(PlatformSubdir, Target.Architecture);
}
// else if (Target.Platform == UnrealTargetPlatform.Linux)
// {
// PlatformSubdir = Path.Combine(PlatformSubdir, Target.Architecture);
// }

PrivateDependencyModuleNames.Add("libWebSockets");

Expand Down
7 changes: 7 additions & 0 deletions Source/V8/Private/Inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ class FInspector : public IJavascriptInspector, public FTickableAnyObject, publi
{
static FName NAME_Javascript("Javascript");

/*
* Crash at if (!maybe_console.IsEmpty())
* when inspector is enabled!
*/
return;


if (Category != NAME_Javascript)
{
HandleScope handle_scope(isolate_);
Expand Down
14 changes: 9 additions & 5 deletions Source/V8/Private/JavascriptContext_Private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "../../Launch/Resources/Version.h"


using namespace v8;

static const int kContextEmbedderDataIndex = 0;
Expand Down Expand Up @@ -1947,8 +1948,11 @@ class FJavascriptContextImplementation : public FJavascriptContext
auto Function = *FuncIt;

// Parse all function parameters.
uint8* Parms = (uint8*)FMemory_Alloca(Function->ParmsSize);
FMemory::Memzero(Parms, Function->ParmsSize);
TArray<uint8> Parms = TArray<uint8>();// = (uint8*)FMemory_Alloca(Function->ParmsSize);
//FMemory::Memzero(Parms, Function->ParmsSize);
Parms.SetNumUninitialized(Function->ParmsSize);
FMemory::Memzero(Parms.GetData(), Parms.Num());


bool bHasDefault = false;
TArray<FString> Parameters, ParametersWithDefaults;
Expand All @@ -1963,7 +1967,7 @@ class FJavascriptContextImplementation : public FJavascriptContext
if (!MetadataCppDefaultValue.IsEmpty())
{
const uint32 ExportFlags = PPF_None;
auto Buffer = It->ContainerPtrToValuePtr<uint8>(Parms);
auto Buffer = It->ContainerPtrToValuePtr<uint8>(Parms.GetData());

#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
const TCHAR* Result = It->ImportText_Direct(*MetadataCppDefaultValue, Buffer, nullptr, ExportFlags);
Expand All @@ -1974,7 +1978,7 @@ class FJavascriptContextImplementation : public FJavascriptContext
if (Result)
{
bHasDefault = true;
auto DefaultValue = Environment->ReadProperty(isolate(), Property, Parms, FNoPropertyOwner());
auto DefaultValue = Environment->ReadProperty(isolate(), Property, Parms.GetData(), FNoPropertyOwner());
{
auto ctx = context();
Context::Scope context_scope(ctx);
Expand All @@ -1989,7 +1993,7 @@ class FJavascriptContextImplementation : public FJavascriptContext
}
}

It->DestroyValue_InContainer(Parms);
//It->DestroyValue_InContainer(Parms);
}
}
Parameters.Add(Parameter);
Expand Down
2 changes: 1 addition & 1 deletion Source/V8/Private/JavascriptIsolate_Private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ class FJavascriptIsolateImplementation : public FJavascriptIsolate
auto Function = reinterpret_cast<UFunction*>((Local<External>::Cast(info.Data()))->Value());

// Determine 'this'
auto Object = (Function->FunctionFlags & FUNC_Static) ? Function->GetOwnerClass()->ClassDefaultObject : UObjectFromV8(isolate->GetCurrentContext(), self);
auto Object = (Function->FunctionFlags & FUNC_Static) ? Function->GetOwnerClass()->ClassDefaultObject.Get() : UObjectFromV8(isolate->GetCurrentContext(), self);

// Check 'this' is valid
if (!IsValid(Object))
Expand Down
2 changes: 1 addition & 1 deletion Source/V8/Private/JavascriptLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Sockets.h"
#include "NavigationSystem.h"
#include "HAL/PlatformApplicationMisc.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#include "UObject/MetaData.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/V8/Private/Translator.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Translator.h"
#include "Engine/UserDefinedStruct.h"
#include "Launch/Resources/Version.h"
#include "Runtime/Launch/Resources/Version.h"

namespace v8
{
Expand Down
8 changes: 4 additions & 4 deletions Source/V8/V8.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ private void HackWebSocketIncludeDir(String WebsocketPath, ReadOnlyTargetRules T
bHasZlib = true;

}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
PlatformSubdir = Path.Combine(PlatformSubdir, Target.Architecture);
}
// else if (Target.Platform == UnrealTargetPlatform.Linux)
// {
// PlatformSubdir = Path.Combine(PlatformSubdir, Target.Architecture);
// }

PrivateDependencyModuleNames.Add("libWebSockets");

Expand Down
1 change: 0 additions & 1 deletion UnrealJS.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"Version": 2,
"VersionName": "0.6.4",
"FriendlyVersion": "0.6.4",
"EngineVersion": "5.1.0",
"Description": "Javascript powered UnrealEngine",
"Category": "Programming",
"CreatedBy": "NCSOFT Corporation",
Expand Down