Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
porting Namespace Reference

Enumerations

enum  AndroidDialogType { TEXT_INPUT , SELECTION_INPUT }
 
enum  AndroidDialogState { DIALOG_SHOWN , DIALOG_INPUTTED , DIALOG_CANCELED }
 

Functions

bool * signal_handler_killstatus ()
 
static void signal_handler (int sig)
 
void signal_handler_init (void)
 
std::string getDataPath (const char *subpath)
 
static void pathRemoveFile (char *path, char delim)
 
bool detectMSVCBuildDir (const std::string &path)
 
static std::string detectSystemInfo ()
 
const std::string & get_sysinfo ()
 
bool getCurrentWorkingDir (char *buf, size_t len)
 
static bool getExecPathFromProcfs (char *buf, size_t buflen)
 
bool getCurrentExecPath (char *buf, size_t len)
 
static const char * getHomeOrFail ()
 
bool setSystemPaths ()
 
static void migrateCachePath ()
 
static void createCacheDirTag ()
 
void initializePaths ()
 
bool secure_rand_fill_buf (void *buf, size_t len)
 
void osSpecificInit ()
 
void attachOrCreateConsole ()
 
int mt_snprintf (char *buf, const size_t buf_size, const char *fmt,...)
 
static bool open_uri (const std::string &uri)
 
bool open_url (const std::string &url)
 Opens URL in default web browser.
 
bool open_directory (const std::string &path)
 Opens a directory in the default file manager.
 
void os_get_clock (struct timespec *ts)
 
u64 getTimeS ()
 
u64 getTimeMs ()
 
u64 getTimeUs ()
 
u64 getTimeNs ()
 
u64 getTime (TimePrecision prec)
 
u64 getDeltaMs (u64 old_time_ms, u64 new_time_ms)
 Delta calculation function arguments.
 
const char * getPlatformName ()
 
static void TrackFreedMemory (size_t amount)
 
static void TriggerMemoryTrim ()
 
void cleanupAndroid ()
 
std::string getLanguageAndroid ()
 
static std::string readJavaString (jstring j_str)
 
void showTextInputDialog (const std::string &hint, const std::string &current, int editType)
 Show a text input dialog in Java.
 
void showComboBoxDialog (const std::string *optionList, s32 listSize, s32 selectedIdx)
 Show a selection dialog in Java.
 
void openURIAndroid (const char *url)
 
void shareFileAndroid (const std::string &path)
 Opens a share intent to the file at path.
 
AndroidDialogType getLastInputDialogType ()
 
AndroidDialogState getInputDialogState ()
 
std::string getInputDialogMessage ()
 
int getInputDialogSelection ()
 
float getDisplayDensity ()
 
v2u32 getDisplaySize ()
 
bool hasPhysicalKeyboardAndroid ()
 

Variables

static bool g_killed = false
 
std::string path_share = "UNINITIALIZED"
 
std::string path_user = "UNINITIALIZED"
 
std::string path_locale = "UNINITIALIZED"
 
std::string path_cache = "UNINITIALIZED"
 
JNIEnv * jnienv = nullptr
 
jobject activity
 
jclass activityClass
 

Enumeration Type Documentation

◆ AndroidDialogState

Enumerator
DIALOG_SHOWN 
DIALOG_INPUTTED 
DIALOG_CANCELED 

◆ AndroidDialogType

Enumerator
TEXT_INPUT 
SELECTION_INPUT 

Function Documentation

◆ attachOrCreateConsole()

void porting::attachOrCreateConsole ( )

Referenced by main().

+ Here is the caller graph for this function:

◆ cleanupAndroid()

void porting::cleanupAndroid ( )

References DIR_DELIM, path_user, and warningstream.

Referenced by SDL_Main().

+ Here is the caller graph for this function:

◆ createCacheDirTag()

static void porting::createCacheDirTag ( )
static

References fs::CreateAllDirs(), DIR_DELIM, open_ofstream(), path_cache, and fs::PathExists().

Referenced by initializePaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detectMSVCBuildDir()

bool porting::detectMSVCBuildDir ( const std::string & path)

References removeStringEnd().

Referenced by initializePaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detectSystemInfo()

static std::string porting::detectSystemInfo ( )
static

Referenced by get_sysinfo().

+ Here is the caller graph for this function:

◆ get_sysinfo()

const std::string & porting::get_sysinfo ( )

References detectSystemInfo().

Referenced by default_user_agent(), and print_version().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentExecPath()

bool porting::getCurrentExecPath ( char * buf,
size_t len )

Referenced by initializePaths(), and use_debugger().

+ Here is the caller graph for this function:

◆ getCurrentWorkingDir()

bool porting::getCurrentWorkingDir ( char * buf,
size_t len )

Referenced by initializePaths().

+ Here is the caller graph for this function:

◆ getDataPath()

std::string porting::getDataPath ( const char * subpath)

References DIR_DELIM, and path_share.

Referenced by initializePaths(), and set_default_settings().

+ Here is the caller graph for this function:

◆ getDeltaMs()

u64 porting::getDeltaMs ( u64 old_time_ms,
u64 new_time_ms )
inline

Delta calculation function arguments.

Parameters
old_time_msold time for delta calculation
new_time_msnew time for delta calculation
Returns
positive delta value

Referenced by GUIScene::draw(), drawItemStack(), GUIFormSpecMenu::drawMenu(), ClientMediaDownloader::initialStep(), PointerAction::isRelated(), GUIScrollBar::OnPostRender(), and TouchControls::step().

+ Here is the caller graph for this function:

◆ getDisplayDensity()

float porting::getDisplayDensity ( )

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by RenderingEngine::getDisplayDensity(), and set_default_settings().

+ Here is the caller graph for this function:

◆ getDisplaySize()

v2u32 porting::getDisplaySize ( )

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by set_default_settings().

+ Here is the caller graph for this function:

◆ getExecPathFromProcfs()

static bool porting::getExecPathFromProcfs ( char * buf,
size_t buflen )
static

Referenced by initializePaths().

+ Here is the caller graph for this function:

◆ getHomeOrFail()

static const char * porting::getHomeOrFail ( )
inlinestatic

References FATAL_ERROR_IF.

Referenced by setSystemPaths().

+ Here is the caller graph for this function:

◆ getInputDialogMessage()

std::string porting::getInputDialogMessage ( )

References activity, activityClass, FATAL_ERROR_IF, jnienv, and readJavaString().

+ Here is the call graph for this function:

◆ getInputDialogSelection()

int porting::getInputDialogSelection ( )

◆ getInputDialogState()

AndroidDialogState porting::getInputDialogState ( )

◆ getLanguageAndroid()

std::string porting::getLanguageAndroid ( )

References activity, activityClass, FATAL_ERROR_IF, jnienv, and readJavaString().

+ Here is the call graph for this function:

◆ getLastInputDialogType()

AndroidDialogType porting::getLastInputDialogType ( )

◆ getPlatformName()

const char * porting::getPlatformName ( )
inline

Referenced by ScriptApiBase::ScriptApiBase(), and print_version().

+ Here is the caller graph for this function:

◆ getTime()

u64 porting::getTime ( TimePrecision prec)
inline

References FATAL_ERROR, getTimeMs(), getTimeNs(), getTimeS(), getTimeUs(), PRECISION_MICRO, PRECISION_MILLI, PRECISION_NANO, and PRECISION_SECONDS.

Referenced by ScopeProfiler::ScopeProfiler(), ScopeProfiler::~ScopeProfiler(), TimeTaker::getTimerTime(), TimeTaker::start(), and TimeTaker::stop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeMs()

u64 porting::getTimeMs ( )
inline

References os_get_clock().

Referenced by Profiler::Profiler(), Client::afterContentReceived(), TouchControls::applyContextControls(), Database_SQLite3::busyHandler(), Profiler::clear(), GUIAnimatedImage::draw(), GUIChatConsole::draw(), GUIEditBoxWithScrollBar::draw(), GUIScene::draw(), drawItemStack(), GUIFormSpecMenu::drawMenu(), GUIButton::drawSprite(), PointerAction::fromEvent(), Profiler::getElapsedMs(), getTime(), JoystickController::handleEvent(), con::ConnectionReceiveThread::handlePacketType_Control(), ClientMediaDownloader::initialStep(), GUIEditBox::inputString(), con::Peer::isTimedOut(), ServerModManager::loadMods(), GUIButton::OnEvent(), GUITable::OnEvent(), GUIEditBox::onKeyBack(), GUIEditBox::onKeyDelete(), GUIChatConsole::openConsole(), GUIEditBox::processKey(), GUIEditBox::processMouse(), Client::ReceiveAll(), con::ConnectionReceiveThread::run(), con::ConnectionSendThread::run(), sound::OpenALSoundManager::run(), run_tests(), run_tests(), TestBase::runTest(), con::ConnectionSendThread::sendAsPacketReliable(), GUIButton::setPressed(), Client::showUpdateProgressTexture(), TouchControls::step(), AsyncEngine::stepAutoscale(), TestConnection::testConnectSendReceive(), TestBase::testModule(), ServerMap::transformLiquids(), TouchControls::translateEvent(), ClientEnvironment::updateFrameTime(), and GUIChatConsole::weblinkClick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeNs()

u64 porting::getTimeNs ( )
inline

References os_get_clock().

Referenced by getTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeS()

u64 porting::getTimeS ( )
inline

References os_get_clock().

Referenced by getTime(), migrate_map_database(), recompress_map_database(), con::ConnectionReceiveThread::RateLimitHelper::tick(), and RemoteClient::uptime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeUs()

u64 porting::getTimeUs ( )
inline

References os_get_clock().

Referenced by getTime(), init_common(), ModApiBase::l_deprecated_function(), ModApiUtil::l_get_us_time(), FpsControl::limit(), Server::Receive(), FpsControl::reset(), ServerThread::run(), ServerMap::save(), ServerEnvironment::step(), and Map::timerUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPhysicalKeyboardAndroid()

bool porting::hasPhysicalKeyboardAndroid ( )

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by Game::openConsole(), and GUIModalMenu::preprocessEvent().

+ Here is the caller graph for this function:

◆ initializePaths()

void porting::initializePaths ( )

References createCacheDirTag(), detectMSVCBuildDir(), DIR_DELIM, DIR_DELIM_CHAR, errorstream, FATAL_ERROR, getCurrentExecPath(), getCurrentWorkingDir(), getDataPath(), getExecPathFromProcfs(), infostream, migrateCachePath(), path_cache, path_locale, path_share, path_user, fs::PathExists(), pathRemoveFile(), sanity_check, setSystemPaths(), and warningstream.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateCachePath()

static void porting::migrateCachePath ( )
static

References DIR_DELIM, errorstream, path_cache, path_user, fs::PathExists(), fs::RecursiveDelete(), and fs::Rename().

Referenced by initializePaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mt_snprintf()

int porting::mt_snprintf ( char * buf,
const size_t buf_size,
const char * fmt,
... )

Referenced by Minimap::addMode(), analyze_block(), ProfilerGraph::draw(), fmtgettext(), getFloatSerializationType(), TestBase::getTestTempFile(), guiScalingResizeCached(), Profiler::print(), print_hexdump(), script_error(), ScriptApiBase::stackDump(), and TestConnection::testConnectSendReceive().

+ Here is the caller graph for this function:

◆ open_directory()

bool porting::open_directory ( const std::string & path)

Opens a directory in the default file manager.

The directory must exist.

Parameters
pathPath to directory
Returns
true on success, false on failure

References errorstream, fs::IsDir(), and open_uri().

Referenced by ModApiMainMenu::l_open_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_uri()

static bool porting::open_uri ( const std::string & uri)
static

References errorstream, and openURIAndroid().

Referenced by open_directory(), and open_url().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_url()

bool porting::open_url ( const std::string & url)

Opens URL in default web browser.

Must begin with http:// or https://, and not contain any new lines

Parameters
urlThe URL
Returns
true on success, false on failure

References errorstream, open_uri(), and str_starts_with().

Referenced by ModApiMainMenu::l_open_url(), GUIFormSpecMenu::OnEvent(), GUIHyperText::OnEvent(), GUIOpenURLMenu::OnEvent(), and GUIChatConsole::weblinkClick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openURIAndroid()

void porting::openURIAndroid ( const char * url)

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by open_uri().

+ Here is the caller graph for this function:

◆ os_get_clock()

void porting::os_get_clock ( struct timespec * ts)
inline

Referenced by getTimeMs(), getTimeNs(), getTimeS(), and getTimeUs().

+ Here is the caller graph for this function:

◆ osSpecificInit()

void porting::osSpecificInit ( )

Referenced by main().

+ Here is the caller graph for this function:

◆ pathRemoveFile()

static void porting::pathRemoveFile ( char * path,
char delim )
static

Referenced by initializePaths().

+ Here is the caller graph for this function:

◆ readJavaString()

static std::string porting::readJavaString ( jstring j_str)
static

References jnienv.

Referenced by getInputDialogMessage(), and getLanguageAndroid().

+ Here is the caller graph for this function:

◆ secure_rand_fill_buf()

bool porting::secure_rand_fill_buf ( void * buf,
size_t len )

Referenced by LuaSecureRandom::fillRandBuf(), httpfetch_init(), mpz_fill_random(), and srp_create_salted_verification_key().

+ Here is the caller graph for this function:

◆ setSystemPaths()

bool porting::setSystemPaths ( )

References DIR_DELIM, getHomeOrFail(), path_share, and path_user.

Referenced by initializePaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shareFileAndroid()

void porting::shareFileAndroid ( const std::string & path)

Opens a share intent to the file at path.

Parameters
path

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by ModApiMainMenu::l_share_file().

+ Here is the caller graph for this function:

◆ showComboBoxDialog()

void porting::showComboBoxDialog ( const std::string * optionList,
s32 listSize,
s32 selectedIdx )

Show a selection dialog in Java.

Parameters
optionListThe list of options
listSizeSize of the list
selectedIdxSelected index

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by GUIModalMenu::preprocessEvent().

+ Here is the caller graph for this function:

◆ showTextInputDialog()

void porting::showTextInputDialog ( const std::string & hint,
const std::string & current,
int editType )

Show a text input dialog in Java.

Parameters
hintHint to be shown
currentInitial value to be displayed
editTypeType of the text field (1 = multi-line text input; 2 = single-line text input; 3 = password field)

References activity, activityClass, FATAL_ERROR_IF, and jnienv.

Referenced by Game::openConsole(), and GUIModalMenu::preprocessEvent().

+ Here is the caller graph for this function:

◆ signal_handler()

static void porting::signal_handler ( int sig)
static

References dstream, and g_killed.

Referenced by signal_handler_init().

+ Here is the caller graph for this function:

◆ signal_handler_init()

void porting::signal_handler_init ( void )

References signal_handler().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ signal_handler_killstatus()

bool * porting::signal_handler_killstatus ( )

References g_killed.

Referenced by ClientLauncher::launch_game(), ClientLauncher::main_menu(), migrate_map_database(), recompress_map_database(), ClientLauncher::run(), and run_dedicated_server().

+ Here is the caller graph for this function:

◆ TrackFreedMemory()

static void porting::TrackFreedMemory ( size_t amount)
inlinestatic

Referenced by MapBlock::~MapBlock(), MapBlockMesh::~MapBlockMesh(), Schematic::~Schematic(), and VoxelManipulator::clear().

+ Here is the caller graph for this function:

◆ TriggerMemoryTrim()

static void porting::TriggerMemoryTrim ( )
inlinestatic

Referenced by MeshUpdateWorkerThread::doUpdate(), and EmergeThread::run().

+ Here is the caller graph for this function:

Variable Documentation

◆ activity

◆ activityClass

◆ g_killed

bool porting::g_killed = false
static

◆ jnienv

◆ path_cache

◆ path_locale

std::string porting::path_locale = "UNINITIALIZED"

Referenced by init_common(), and initializePaths().

◆ path_share

◆ path_user