Code working in Developement build But not in shipping UE4 - unreal-engine4

void UCreateNewWindow::CreateNewMap()
{
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::RootDir());
FString GameName = FApp::GetName();
ThePath.Append(GameName);
ThePath.Append(".exe");
FString MapPath = "/Game/Maps/Scene";
//ThePath.Append(MapPath);
GEngine->AddOnScreenDebugMessage(-1, 12.f, FColor::White, ThePath);
// TCHAR* path= ThePath.GetCharArray().GetData();
FPlatformProcess::CreateProc(*ThePath, TEXT("/Game/Maps/Scene"), true, false, false, nullptr, 0, nullptr, nullptr);
}
I am calling this class in BP. It works in developement builds but not in shipping builds. Since its shipping build i cant even debug properly.
Any ideas??

It's a shipping build so unreal disables all functions that are for testing purposes.
AddOnScreennDebugMessage() is considered for development and well debugging.
Consider creating formal widgets instead.

Related

Context is null when Part is being activated. What can cause this?

My eclipse 3.x RCP app has 2 perspectives. When the app starts and Perspective A is active then all parts are created and displayed correctly. When the app starts and Perspective B is active then most parts are empty and createControl is never called. If I reset the perspective then all parts are created properly.
So far I have found that part in PartActivationHistory.activate has a null context and this causes a NullPointerException. Why might this be? Who sets the context and when?
void activate(MPart part, boolean activateBranch) {
IEclipseContext context = part.getContext();
if (activateBranch) {
context.activateBranch();
} else {
IEclipseContext parent = context.getParent();
do {
context.activate();
context = parent;
parent = parent.getParent();
} while (parent.get(MWindow.class) != null);
}
prepend(part);
}
The problem was caused by performing certain actions before the Workbench was fully initialised. This does not seem to have been a problem in the past but I have recently updated the platform from Kepler to 2020/6.

How to remove the console from the Roblox Exploit Api Dll Inject

I got the api sauce and I'm editing it.
When you inject the api, the console comes out and tells you to enter the command there.
I just want to erase the console that comes out by injecting api, inject and execute what I wrote as a command into the C# text box, but it didn't go well.
So I fixed the code in the console window, aenter image description herend Roblox crashed.
Tell me how to solve this problem.
And I will show you the status code with the console coming out and the code with the error after fixing it without the console coming out. Make sure the console doesn't come out, and if the command you wrote down in the text box presses the Execute button, let Roblox run it.
Code before modification (state with console)
void main()
{
ShowWindow(GetConsoleWindow(), 0);
CONSOLEBYPASS();
freopen("CONOUT$", "w", stdout);
freopen("CONIN$", "r", stdin);
HWND ConsoleHandle = GetConsoleWindow();
SetWindowPos(ConsoleHandle, HWND_TOPMOST, 50, 20, 0, 0, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
ShowWindow(ConsoleHandle, 1);
SetConsoleTitle("Sxploit // Credits to Aero // Updated by L");
XHosted::Run(XHosted::GetVersion());
//XHosted::XDumper();
RobloxState = XHosted::GetRState();
VanillaState = luaL_newstate();
BreakPointsInit();
luaL_openlibs(VanillaState);
luaL_newmetatable(VanillaState, "garbagecollector");
lua_pushcfunction(VanillaState, UserDataGC);
lua_setfield(VanillaState, -2, "gc");
lua_pushvalue(VanillaState, -1);
lua_setfield(VanillaState, -2, "index");
WrapGlobals(RobloxState, VanillaState);
SetLevel(RobloxState, 7);
RegisterShittyFunc(VanillaState);
lua_newtable(VanillaState);
lua_setglobal(VanillaState, "_G");
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)input, NULL, NULL, NULL);
std::string i;
Execute("warn('Connect to Roblox')");
while (true) {
getline(std::cin, i);
Execute(i.c_str());
i = "";
}
}
BOOL WINAPI CONSOLEBYPASS()
{
DWORD nOldProtect;
if (!VirtualProtect(FreeConsole, 1, PAGE_EXECUTE_READWRITE, &nOldProtect))
return FALSE;
(BYTE)(FreeConsole) = 0xC3; //opcode time
if (!VirtualProtect(FreeConsole, 1, nOldProtect, &nOldProtect))
return FALSE;
AllocConsole();
}
Code after modification (the console does not come out, but the Inject causes the Roblox to crash)
void main()
{
BreakPointsInit();
luaL_openlibs(VanillaState);
luaL_newmetatable(VanillaState, "garbagecollector");
lua_pushcfunction(VanillaState, UserDataGC);
lua_setfield(VanillaState, -2, "gc");
lua_pushvalue(VanillaState, -1);
lua_setfield(VanillaState, -2, "index");
WrapGlobals(RobloxState, VanillaState);
SetLevel(RobloxState, 6);
RegisterShittyFunc(VanillaState);
lua_newtable(VanillaState);
lua_setglobal(VanillaState, "_G");
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)input, NULL, NULL, NULL);
std::string i;
Execute("warn('Connect to Roblox')");
}
The picture over there is the console window I want to erase.
You cant remove that console app from here, this console is used to push lua script that given by pipes from your exploit to roblox, the only way how to teke out that console is to hide it.
As i understand this is a c++ code right?
void HideConsole()
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
}
You're using Axon Source i can see, you can give the code pls?
//Necesary for hide console
#include <Windows.h>
//Hide Console
void HideConsole()
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
}
//Check Is Console Visible
bool IsConsoleVisible()
{
return ::IsWindowVisible(::GetConsoleWindow()) != FALSE;
}
Axon is currently entirely patched, I would suggest checking out Imperious Transpiler with more stability and actually working!
Check it here: https://v3rmillion.net/showthread.php?pid=7615717
(Also if you don't know the basic fix for that, I don't think you will be able to update addys every Wednesday.)

User-defined code folding regions in Eclipse

Is there any built-in functionality or plugin that would allow me to define my own custom regions for code folding? I am using version 4.8.0 (Photon release)
In particular, I am interested in folding certain parts of .java files where I am needing to declare a lot of variables.
To add folding regions to Java sources, you can implement the extension "org.eclipse.jdt.ui.foldingStructureProvider". To do this, you create an eclipse plug-in project (requires Eclipse PDE) and add an extension point to your plugin.xml. Then you create a class that implements IJavaFoldingStructureProvider and possibly IJavaFoldingStructureProviderExtension.
Folding regions are added like this:
FoldingStructureComputationContext context
IRegion normalized = alignRegion(new Region(offset, length), context);
if (normalized != null) {
Position position = createMemberPosition(normalized, (IMember) element);
if (position != null) {
boolean isCollapsed = false, isComment = false;
context.addProjectionRange(new JavaProjectionAnnotation(isCollapsed, element, isComment), position);
}
}
See DefaultJavaFoldingStructureProvider for alignRegion, createMemberPosition, etc. offset and length are determined by your code.

How can I check if a Flutter application is running in debug?

I'm looking for a way to execute code in Flutter when the app is in Debug mode. Is that possible in Flutter? I can't seem to find it anywhere in the documentation.
Something like this
If(app.inDebugMode) {
print("Print only in debug mode");
}
How can I check if the Flutter application is running in debug or release mode?
In later versions, you can use kDebugMode:
if (kDebugMode)
doSomething();
While asserts can technically be used to manually create an "is debug mode" variable, you should avoid that.
Instead, use the constant kReleaseMode from package:flutter/foundation.dart
The difference is all about tree shaking.
Tree shaking (aka the compiler removing unused code) depends on variables being constants.
The issue is, with asserts our isInReleaseMode boolean is not a constant. So when shipping our app, both the dev and release code are included.
On the other hand, kReleaseMode is a constant. Therefore the compiler is correctly able to remove unused code, and we can safely do:
if (kReleaseMode) {
} else {
// Will be tree-shaked on release builds.
}
Here is a simple solution to this:
import 'package:flutter/foundation.dart';
Then you can use kReleaseMode like
if(kReleaseMode){ // Is Release Mode??
print('release mode');
} else {
print('debug mode');
}
Please use Remi's answer with kReleaseMode and kDebugMode or Dart compilation won't be able to tree-shake your code.
This little snippet should do what you need:
bool get isInDebugMode {
bool inDebugMode = false;
assert(inDebugMode = true);
return inDebugMode;
}
If not, you can configure your IDE to launch a different main.dart in debug mode where you can set a Boolean.
kDebugMode
You can now use the kDebugMode constant.
if (kDebugMode) {
// Code here will only be included in debug mode.
// As kDebugMode is a constant, the tree shaker
// will remove the code entirely from compiled code.
} else {
}
This is preferable over !kReleaseMode as it also checks for profile mode, i.e., kDebugMode means not in release mode and not in profile mode.
kReleaseMode
If you just want to check for release mode and not for profile mode, you can use kReleaseMode instead:
if (kReleaseMode) {
// Code here will only be run in release mode.
// As kReleaseMode is a constant, the tree shaker
// will remove the code entirely from other builds.
} else {
}
kProfileMode
If you just want to check for profile mode and not for release mode, you can use kProfileMode instead:
if (kProfileMode) {
// Code here will only be run in release mode.
// As kProfileMode is a constant, the tree shaker
// will remove the code entirely from other builds.
} else {
}
While this works, using constants kReleaseMode or kDebugMode is preferable. See Rémi's answer below for a full explanation, which should probably be the accepted question.
The easiest way is to use assert as it only runs in debug mode.
Here's an example from Flutter's Navigator source code:
assert(() {
if (navigator == null && !nullOk) {
throw new FlutterError(
'Navigator operation requested with a context that does not include a Navigator.\n'
'The context used to push or pop routes from the Navigator must be that of a '
'widget that is a descendant of a Navigator widget.'
);
}
return true;
}());
Note in particular the () at the end of the call - assert can only operate on a Boolean, so just passing in a function doesn't work.
Not to be picky, but the foundation package includes a kDebugMode constant.
So:
import 'package:flutter/foundation.dart' as Foundation;
if(Foundation.kDebugMode) {
print("App in debug mode");
}
I believe the latest way to do this is:
const bool prod = const bool.fromEnvironment('dart.vm.product');
src
Just import this
import 'package:flutter/foundation.dart'
String bulid = kReleaseMode ? "Release" : "";
or
String bulid = kDebugMode ? "Debug" : "";
or
String bulid = kProfileMode ? "Profile" : "";
Or try this
if (kDebugMode) {
print("Debug");
} else if (kReleaseMode) {
print("Release");
} else if (kProfileMode) {
print("Profile");
}
Make a file named constants.dart. Add these variables in it:
const bool kReleaseMode = bool.fromEnvironment('dart.vm.product');
const bool kProfileMode = bool.fromEnvironment('dart.vm.profile');
const bool kDebugMode = !kReleaseMode && !kProfileMode;
printk(String string) {
if (kDebugMode) {
// ignore: avoid_print
print(string);
}
}
Then import this constant file in any other file and use it like this:
import 'package:package_name/constants.dart';
if(kDebugMode){
//Debug code
}else{
//Non-Debug code
}
printk("Debug Log");
I've created this useful class, based on other answers and inspired on Android usage.
If anything changes on "Foundation" package, it would not be necessary to change the entire application, it would be necessary to change only this class.
import 'package:flutter/foundation.dart' as Foundation;
abstract class Build {
static const bool isDebugMode = Foundation.kDebugMode;
static const bool isReleaseMode = Foundation.kReleaseMode;
static const bool isWeb = Foundation.kIsWeb;
static const bool isProfileMode = Foundation.kProfileMode;
}
Extracted from Dart Documentation:
When exactly do assertions work? That depends on the tools and
framework you’re using:
Flutter enables assertions in debug mode.
Development-only tools such as dartdevc typically enable assertions by default.
Some tools, such as dart and dart2js, support assertions through a command-line flag: --enable-asserts.
In production code, assertions are ignored, and the arguments to
assert aren’t evaluated.

Set focus to embedded MSHTML

In my application I have an embedded MSHTML control. The problem is that I cannot set focus to this control. I can click, select, push buttons etc, but it won't accept keyboard input and mouse wheel notifications as a result. Even left-clicks on the control do not set the focus. (The question is related to this issue.)
Ultimately, I've tried 4 approaches. (Error handling is omitted here for brevity.) The first is sending WM_SETFOCUS to the control.
HWND iehwnd = ::FindWindowEx (m_oleObjectHWND, NULL,
L"Shell DocObject View", NULL);
if(iehwnd != NULL)
{
iehwnd = ::FindWindowEx (iehwnd, NULL, L"Internet Explorer_Server", NULL);
if(iehwnd != NULL)
{
::PostMessage(iehwnd, WM_SETFOCUS, (WPARAM)GetHWND(), NULL);
}
}
Using Winspector, I made sure that the messages came through to the control's window, but it seems to ignore them.
The second is calling the focus() method of IHtmlWindow2.
IHTMLDocument2* pHTMLDoc2 = NULL;
m_webBrowser->get_Document((IDispatch**)&pHTMLDoc2);
IHTMLWindow2* pWindow = 0;
pHTMLDoc2->get_parentWindow(&pWindow);
pWindow->focus();
This time, I get E_FAIL from focus().
MSDN says that the call may fail when the document hasn't loaded, but pHTMLDoc2->get_readyState() returns "complete". So this isn't the case.
The third is doing the UIACTIVATE verb.
hret = m_oleObject->DoVerb(OLEIVERB_UIACTIVATE, NULL,
clientSite, 0, (HWND)GetHWND(), &posRect);
This seems to achieve nothing.
The fourth is calling focus() of IHtmlDocument4.
IDispatch* pdisp = NULL;
m_webBrowser->get_Document((IDispatch**)&pdisp);
IHTMLDocument4* pHTMLDoc4 = NULL;
pdisp->QueryInterface(IID_IHTMLDocument4, (void**)(&pHTMLDoc4));
pHTMLDoc4->focus();
Does nothing.
I've spent a full day on this already and know google's links by heart now :) Hoping for a hint from experts.
Finally found it.
This function in my code (or rather the IEHtmlWin component for the wxWidgets library) returned S_FALSE. I changed the return code to S_OK - and voila...
HRESULT FS_IOleInPlaceSiteWindowless::RequestUIActivate()
{
return S_OK;
}