Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=b60c6fe9824d0aab4fa9ef39c841e008ab052727
- Loading branch information
1 parent
ab84947
commit 796663f
Showing
14 changed files
with
916 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "conhost:v2", | ||
"version": "0.1.0", | ||
"dependencies": [ | ||
"fx[2]", | ||
"rage:input", | ||
"rage:graphics", | ||
"vendor:imgui" | ||
], | ||
"provides": [] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fxComponent 115 component.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* This file is part of the CitizenFX project - http://citizen.re/ | ||
* | ||
* See LICENSE and MENTIONS in the root of the source tree for information | ||
* regarding licensing. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifdef COMPILING_CONHOST_POSH | ||
#define CONHOST_EXPORT DLL_EXPORT | ||
#else | ||
#define CONHOST_EXPORT DLL_IMPORT | ||
#endif | ||
|
||
namespace ConHost | ||
{ | ||
extern CONHOST_EXPORT fwEvent<const char*, const char*> OnInvokeNative; | ||
|
||
CONHOST_EXPORT void Print(int channel, const std::string& message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* This file is part of the CitizenFX project - http://citizen.re/ | ||
* | ||
* See LICENSE and MENTIONS in the root of the source tree for information | ||
* regarding licensing. | ||
*/ | ||
|
||
#pragma once | ||
|
||
enum ConsoleModifiers | ||
{ | ||
ConsoleModifierNone = 0, | ||
ConsoleModifierAlt = 1, | ||
ConsoleModifierShift = 2, | ||
ConsoleModifierControl = 4 | ||
}; | ||
|
||
// THANKS MICROSOFT | ||
DEFINE_ENUM_FLAG_OPERATORS(ConsoleModifiers); | ||
|
||
void ConHost_Run(); | ||
|
||
void ConHost_KeyEnter(uint32_t vKey, wchar_t character, ConsoleModifiers modifiers); | ||
|
||
// private | ||
void ConHost_AddInternalCalls(); | ||
|
||
void ConHost_WaitForKey(uint32_t& vKey, wchar_t& character, ConsoleModifiers& modifiers); | ||
|
||
void ConHost_GetCursorPos(int& x, int& y); | ||
|
||
void ConHost_NewBuffer(int width, int height); | ||
|
||
void* ConHost_GetBuffer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#pragma once |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* This file is part of the CitizenFX project - http://citizen.re/ | ||
* | ||
* See LICENSE and MENTIONS in the root of the source tree for information | ||
* regarding licensing. | ||
*/ | ||
|
||
#include "StdInc.h" | ||
#include "ComponentLoader.h" | ||
|
||
class ComponentInstance : public Component | ||
{ | ||
public: | ||
virtual bool Initialize(); | ||
|
||
virtual bool DoGameLoad(void* module); | ||
|
||
virtual bool Shutdown(); | ||
}; | ||
|
||
bool ComponentInstance::Initialize() | ||
{ | ||
InitFunctionBase::RunAll(); | ||
|
||
return true; | ||
} | ||
|
||
bool ComponentInstance::DoGameLoad(void* module) | ||
{ | ||
HookFunction::RunAll(); | ||
|
||
return true; | ||
} | ||
|
||
bool ComponentInstance::Shutdown() | ||
{ | ||
return true; | ||
} | ||
|
||
extern "C" __declspec(dllexport) Component* CreateComponent() | ||
{ | ||
return new ComponentInstance(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* This file is part of the CitizenFX project - http://citizen.re/ | ||
* | ||
* See LICENSE and MENTIONS in the root of the source tree for information | ||
* regarding licensing. | ||
*/ | ||
|
||
#include "StdInc.h" | ||
#include "ConsoleHostImpl.h" | ||
#include "InputHook.h" | ||
#include <thread> | ||
#include <condition_variable> | ||
|
||
static std::thread g_consoleThread; | ||
static std::once_flag g_consoleInitialized; | ||
bool g_consoleFlag; | ||
extern int g_scrollTop; | ||
extern int g_bufferHeight; | ||
|
||
static InitFunction initFunction([] () | ||
{ | ||
InputHook::OnWndProc.Connect([] (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool& pass, LRESULT& lresult) | ||
{ | ||
if (g_consoleFlag) | ||
{ | ||
static bool g_consoleClosing = false; | ||
|
||
// should the console be closed? | ||
if (wParam == VK_F8) | ||
{ | ||
if (msg == WM_KEYDOWN) | ||
{ | ||
g_consoleClosing = true; | ||
return; | ||
} | ||
|
||
if (g_consoleClosing) | ||
{ | ||
if (msg == WM_KEYUP) | ||
{ | ||
g_consoleClosing = false; | ||
g_consoleFlag = false; | ||
|
||
return; | ||
} | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// check if the console should be opened | ||
if (msg == WM_KEYUP && wParam == VK_F8) | ||
{ | ||
g_consoleFlag = true; | ||
|
||
pass = false; | ||
lresult = 0; | ||
|
||
return; | ||
} | ||
} | ||
}, -10); | ||
}); |
Oops, something went wrong.