Skip to content

Commit

Permalink
* FIX:[LE] Вылит при закрытие
Browse files Browse the repository at this point in the history
* FIX:[Engine] Дефолтные клавиши не устанавливались
* FIX:[Engine] Вылет при закрытие
  • Loading branch information
BearIvan committed Jul 1, 2022
1 parent f4896cc commit 547621c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 39 deletions.
8 changes: 7 additions & 1 deletion Source/Editors/LevelEditor/Engine/XrGameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#include "../../xrServerEntities/xrServer_Objects_Abstract.h"
#include "..\XrEngine\XrGameEditorInterface.h"
XrGameManager* g_XrGameManager = nullptr;

extern "C"
{
typedef void xrGameInitialize();
};
XrGameManager::XrGameManager()
{
LPCSTR g_name = "XrGame.dll";
Expand All @@ -27,6 +30,9 @@ XrGameManager::XrGameManager()
m_pDestroy = (Factory_Destroy*)GetProcAddress(m_hGame, "xrFactory_Destroy"); R_ASSERT(m_pCreate);
Engine.External.pCreate = m_pCreate;
Engine.External.pDestroy = m_pDestroy;

xrGameInitialize* pxrGameInitialize = (xrGameInitialize*)GetProcAddress(m_hGame, "xrGameInitialize"); R_ASSERT(pxrGameInitialize);
pxrGameInitialize();
}

XrGameManager::~XrGameManager()
Expand Down
10 changes: 5 additions & 5 deletions Source/Editors/LevelEditor/LevelEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
Console->Hide();
::MainForm = MainForm;
UI->Push(MainForm, false);

while (MainForm->Frame())
{
}
xr_delete(g_XrGameManager);
xr_delete(g_SEFactoryManager);
xr_delete(pApp);
xr_delete(MainForm);
xr_delete(MainForm);
xr_delete(pApp);
xr_delete(g_XrGameManager);
xr_delete(g_SEFactoryManager);

Core._destroy();
return 0;
}
7 changes: 2 additions & 5 deletions Source/Xr3DA/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include "..\XrEngine\stdafx.h"


ENGINE_API int APIENTRY WinMain_impl(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
char* lpCmdLine,
int nCmdShow);
ENGINE_API int EngineLaunch(EGamePath Game);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
char* lpCmdLine,
Expand All @@ -26,7 +23,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,

//free (buffer);

WinMain_impl(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
EngineLaunch(EGamePath::NONE);



Expand Down
18 changes: 13 additions & 5 deletions Source/XrEngine/EngineAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ void CEngineAPI::InitializeNotDedicated()
extern "C" DLL_Pure * __cdecl xrFactory_Create(CLASS_ID clsid);
extern "C" void __cdecl xrFactory_Destroy(DLL_Pure * O);
extern "C" bool SupportsRendering();
extern "C" bool InitializeRendering();
extern "C" void InitializeRendering();
#else
extern "C" {
typedef bool __cdecl SupportsRendering();
typedef bool SupportsRendering();
typedef void InitializeRendering();
typedef void xrGameInitialize();
};
#endif
void CEngineAPI::Initialize(void)
Expand All @@ -153,7 +155,6 @@ void CEngineAPI::Initialize(void)
#ifdef SHIPPING
//InitializeNotDedicated();
InitializeRendering();
EngineDevice->ConnectToRender();
pCreate = &xrFactory_Create;
pDestroy = &xrFactory_Destroy;

Expand All @@ -178,9 +179,14 @@ void CEngineAPI::Initialize(void)
R_ASSERT (hRender);
g_current_renderer = 1;
}
{
InitializeRendering* pInitializeRendering = (InitializeRendering*)GetProcAddress(hRender, "InitializeRendering");
R_ASSERT(pInitializeRendering);
pInitializeRendering();
}



EngineDevice->ConnectToRender();
// game
{
LPCSTR g_name = "XrGame.dll";
Expand All @@ -199,7 +205,9 @@ void CEngineAPI::Initialize(void)
if (0==hGame) R_CHK (GetLastError());
R_ASSERT2 (hGame,"Game DLL raised exception during loading or there is no game DLL at all");
pCreate = (Factory_Create*) GetProcAddress(hGame,"xrFactory_Create" ); R_ASSERT(pCreate);
pDestroy = (Factory_Destroy*) GetProcAddress(hGame,"xrFactory_Destroy" ); R_ASSERT(pDestroy);
pDestroy = (Factory_Destroy*) GetProcAddress(hGame,"xrFactory_Destroy" ); R_ASSERT(pDestroy);
xrGameInitialize* pxrGameInitialize = (xrGameInitialize*) GetProcAddress(hGame,"xrGameInitialize" ); R_ASSERT(pxrGameInitialize);
pxrGameInitialize();
}

//////////////////////////////////////////////////////////////////////////
Expand Down
24 changes: 16 additions & 8 deletions Source/XrEngine/x_ray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,15 @@ CApplication::CApplication()

// levels
Level_Current = u32(-1);
pFontSystem = NULL;
ls_header[0] = '\0';
ls_tip_number[0] = '\0';
ls_tip[0] = '\0';
if (Device->IsEditorMode())return;
Level_Scan ( );

// Font
pFontSystem = NULL;


// Register us
Device->seqFrame.Add (this, REG_PRIORITY_HIGH+1000);
Expand All @@ -1003,21 +1007,25 @@ CApplication::CApplication()

// App Title
// app_title[ 0 ] = '\0';
ls_header[ 0 ] = '\0';
ls_tip_number[ 0 ] = '\0';
ls_tip[ 0 ] = '\0';

}

CApplication::~CApplication()
{
Console->Hide ( );
if (Console)
{
Console->Hide();
}

// font
xr_delete ( pFontSystem );

EngineDevice->seqFrameMT.Remove (&SoundProcessor);
EngineDevice->seqFrame.Remove (&SoundProcessor);
EngineDevice->seqFrame.Remove (this);
if (EngineDevice)
{
EngineDevice->seqFrameMT.Remove(&SoundProcessor);
EngineDevice->seqFrame.Remove(&SoundProcessor);
EngineDevice->seqFrame.Remove(this);
}


// events
Expand Down
25 changes: 10 additions & 15 deletions Source/XrGame/xrGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,22 @@ void setup_luabind_allocator();
CSE_Abstract* F_entity_Create(LPCSTR section);
extern "C"
{

DLL_API DLL_Pure* __cdecl xrFactory_Create (CLASS_ID clsid)
DLL_API void __cdecl xrGameInitialize()
{
PhysicsInitialize();
CCC_RegisterCommands();
// keyboard binding
CCC_RegisterInput();

static bool bIsInitilize = false;
if (!bIsInitilize)
{
PhysicsInitialize();
CCC_RegisterCommands();
// keyboard binding
CCC_RegisterInput();

setup_luabind_allocator();
setup_luabind_allocator();

#ifdef DEBUG
g_profiler = xr_new<CProfiler>();
g_profiler = xr_new<CProfiler>();
#endif

bIsInitilize = true;
}

}
DLL_API DLL_Pure* __cdecl xrFactory_Create (CLASS_ID clsid)
{
DLL_Pure *object = object_factory().client_object(clsid);
#ifdef DEBUG
if (!object)
Expand Down

0 comments on commit 547621c

Please sign in to comment.