Fix Android crash

This commit is contained in:
elasota
2021-05-14 19:30:31 -04:00
parent 71115b2366
commit 240ba88f53
3 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
#include "SDL.h"
#include "GpMain.h"
#include "GpAllocator_C.h"
#include "GpAudioDriverFactory.h"
#include "GpDisplayDriverFactory.h"
#include "GpGlobalConfig.h"
@@ -70,6 +71,8 @@ GpLogDriver_Android GpLogDriver_Android::ms_instance;
int main(int argc, char* argv[])
{
IGpAllocator *alloc = GpAllocator_C::GetInstance();
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_INFO);
if (SDL_Init(SDL_INIT_VIDEO) < 0)
@@ -83,6 +86,7 @@ int main(int argc, char* argv[])
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_Android::GetInstance());
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_Android::GetInstance());
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_Android::GetInstance());
drivers->SetDriver<GpDriverIDs::kAlloc>(alloc);
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_SDL_GL2;
@@ -96,6 +100,7 @@ int main(int argc, char* argv[])
g_gpGlobalConfig.m_osGlobals = &g_gpAndroidGlobals;
g_gpGlobalConfig.m_logger = GpLogDriver_Android::GetInstance();
g_gpGlobalConfig.m_systemServices = GpSystemServices_Android::GetInstance();
g_gpGlobalConfig.m_allocator = alloc;
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_SDL_GL2, GpDriver_CreateDisplayDriver_SDL_GL2);
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_SDL2, GpDriver_CreateAudioDriver_SDL);