1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +01:00
Files
OpenRCT2/src/openrct2-ui/UiContext.Android.cpp
Michał Janiszewski 7e769ed662 Fix #7536: Android build fails to start (#8554)
This was a regression from #7435 which introduced threads and caused JNI
to misbehave and fail to load our expected classes. Provide a workaround
based on the description in https://stackoverflow.com/a/16302771 which
stores a main thread's class loader and uses that in neighbouring
threads.
2019-01-04 19:48:26 +01:00

77 lines
1.8 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#ifdef __ANDROID__
# include "UiContext.h"
# include <SDL.h>
# include <dlfcn.h>
# include <jni.h>
# include <openrct2/common.h>
# include <openrct2/core/String.hpp>
# include <openrct2/platform/platform.h>
# include <openrct2/ui/UiContext.h>
# include <sstream>
# include <stdexcept>
namespace OpenRCT2::Ui
{
class AndroidContext final : public IPlatformUiContext
{
private:
public:
AndroidContext()
{
}
void SetWindowIcon(SDL_Window* window) override
{
}
bool IsSteamOverlayAttached() override
{
return false;
}
void ShowMessageBox(SDL_Window* window, const std::string& message) override
{
log_verbose(message.c_str());
STUB();
}
std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) override
{
STUB();
return nullptr;
}
std::string ShowDirectoryDialog(SDL_Window* window, const std::string& title) override
{
log_info(title.c_str());
STUB();
return "/sdcard/rct2";
}
void OpenFolder(const std::string& path) override
{
}
};
IPlatformUiContext* CreatePlatformUiContext()
{
return new AndroidContext();
}
} // namespace OpenRCT2::Ui
#endif // __ANDROID__