# This file contains a list of all available settings and their default value for minetest.conf # By default, all the settings are commented and not functional. # Uncomment settings by removing the preceding #. # minetest.conf is read by default from: # ../minetest.conf # ../../minetest.conf # Any other path can be chosen by passing the path as a parameter # to the program, eg. "minetest.exe --config ../minetest.conf.example". # Further documentation: # http://wiki.minetest.net/ # # Client # ## Controls # If enabled, you can place blocks at the position (feet + eye level) where you stand. # This is helpful when working with nodeboxes in small areas. # type: bool # enable_build_where_you_stand = false # Player is able to fly without being affected by gravity. # This requires the "fly" privilege on the server. # type: bool # free_move = false # Fast movement (via use key). # This requires the "fast" privilege on the server. # type: bool # fast_move = false # If enabled together with fly mode, player is able to fly through solid nodes. # This requires the "noclip" privilege on the server. # type: bool # noclip = false # Smooths camera when looking around. Also called look or mouse smoothing. # Useful for recording videos. # type: bool # cinematic = false # Smooths rotation of camera. 0 to disable. # type: float min: 0 max: 0.99 # camera_smoothing = 0.0 # Smooths rotation of camera in cinematic mode. 0 to disable. # type: float min: 0 max: 0.99 # cinematic_camera_smoothing = 0.7 # Invert vertical mouse movement. # type: bool # invert_mouse = false # Mouse sensitivity multiplier. # type: float # mouse_sensitivity = 0.2 # If enabled, "use" key instead of "sneak" key is used for climbing down and descending. # type: bool # aux1_descends = false # Double-tapping the jump key toggles fly mode. # type: bool # doubletap_jump = false # If disabled "use" key is used to fly fast if both fly and fast mode are enabled. # type: bool # always_fly_fast = true # The time in seconds it takes between repeated right clicks when holding the right mouse button. # type: float # repeat_rightclick_time = 0.25 # Enable random user input (only used for testing). # type: bool # random_input = false # Continuous forward movement (only used for testing). # type: bool # continuous_forward = false # Enable Joysticks # type: bool # enable_joysticks = false # The identifier of the joystick to use # type: int # joystick_id = 0 # The type of joystick # type: enum values: auto, generic, xbox # joystick_type = auto # The time in seconds it takes between repeated events # when holding down a joystick button combination. # type: float # repeat_joystick_button_time = 0.17 # The sensitivity of the joystick axes for moving the # ingame view frustum around. # type: float # joystick_frustum_sensitivity = 170 # Key for moving the player forward. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_forward = KEY_KEY_W # Key for moving the player backward. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_backward = KEY_KEY_S # Key for moving the player left. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_left = KEY_KEY_A # Key for moving the player right. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_right = KEY_KEY_D # Key for jumping. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_jump = KEY_SPACE # Key for sneaking. # Also used for climbing down and descending in water if aux1_descends is disabled. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_sneak = KEY_LSHIFT # Key for opening the inventory. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_inventory = KEY_KEY_I # Key for moving fast in fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_special1 = KEY_KEY_E # Key for opening the chat window. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_chat = KEY_KEY_T # Key for opening the chat window to type commands. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_cmd = / # Key for opening the chat window to type local commands. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_cmd_local = . # Key for opening the chat console. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keyman_console = KEY_F10 # Key for toggling unlimited view range. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_rangeselect = KEY_KEY_R # Key for toggling flying. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_freemove = KEY_KEY_K # Key for toggling fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_fastmove = KEY_KEY_J # Key for toggling noclip mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_noclip = KEY_KEY_H # Key for selecting the next item in the hotbar. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_hotbar_next = KEY_KEY_N # Key for selecting the previous item in the hotbar. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_hotbar_previous = KEY_KEY_B # Key for muting the game. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_mute = KEY_KEY_M # Key for increasing the volume. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_increase_volume = # Key for decreasing the volume. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_decrease_volume = # Key for toggling autorun. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_autorun = # Key for toggling cinematic mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_cinematic = # Key for toggling display of minimap. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_minimap = KEY_F9 # Key for taking screenshots. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_screenshot = KEY_F12 # Key for dropping the currently selected item. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_drop = KEY_KEY_Q # Key to use view zoom when possible. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_zoom = KEY_KEY_Z # Key for toggling the display of the HUD. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key # keymap_toggle_hud = KEY_F1 # Key for toggling the display of the chat. # See http://irrlicht.sourceforge.net/docu/namespaceirr./* Minetest Copyright (C) 2013 sapier <sapier AT gmx DOT net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "threading/semaphore.h" #include <iostream> #include <cstdlib> #include <cassert> #define UNUSED(expr) do { (void)(expr); } while (0) #ifdef _WIN32 #include <climits> #define MAX_SEMAPHORE_COUNT LONG_MAX - 1 #else #include <cerrno> #include <sys/time.h> #include <pthread.h> #if defined(__MACH__) && defined(__APPLE__) #include <mach/mach.h> #include <mach/task.h> #include <mach/semaphore.h> #include <sys/semaphore.h> #include <unistd.h> #undef sem_t #undef sem_init #undef sem_wait #undef sem_post #undef sem_destroy #define sem_t semaphore_t #define sem_init(s, p, c) semaphore_create(mach_task_self(), (s), 0, (c)) #define sem_wait(s) semaphore_wait(*(s)) #define sem_post(s) semaphore_signal(*(s)) #define sem_destroy(s) semaphore_destroy(mach_task_self(), *(s)) #endif #endif Semaphore::Semaphore(int val) { #ifdef _WIN32 semaphore = CreateSemaphore(NULL, val, MAX_SEMAPHORE_COUNT, NULL); #else int ret = sem_init(&semaphore, 0, val); assert(!ret); UNUSED(ret); #endif } Semaphore::~Semaphore() { #ifdef _WIN32 CloseHandle(semaphore); #else int ret = sem_destroy(&semaphore); #ifdef __ANDROID__ // Workaround for broken bionic semaphore implementation! assert(!ret || errno == EBUSY); #else assert(!ret); #endif UNUSED(ret); #endif } void Semaphore::post(unsigned int num) { assert(num > 0); #ifdef _WIN32 ReleaseSemaphore(semaphore, num, NULL); #else for (unsigned i = 0; i < num; i++) { int ret = sem_post(&semaphore); assert(!ret); UNUSED(ret); } #endif } void Semaphore::wait() { #ifdef _WIN32 WaitForSingleObject(semaphore, INFINITE); #else int ret = sem_wait(&semaphore); assert(!ret); UNUSED(ret); #endif } bool Semaphore::wait(unsigned int time_ms) { #ifdef _WIN32 unsigned int ret = WaitForSingleObject(semaphore, time_ms); if (ret == WAIT_OBJECT_0) { return true; } else { assert(ret == WAIT_TIMEOUT); return false; } #else # if defined(__MACH__) && defined(__APPLE__) mach_timespec_t wait_time; wait_time.tv_sec = time_ms / 1000; wait_time.tv_nsec = 1000000 * (time_ms % 1000); errno = 0; int ret = semaphore_timedwait(semaphore, wait_time); switch (ret) { case KERN_OPERATION_TIMED_OUT: errno = ETIMEDOUT; break; case KERN_ABORTED: errno = EINTR; break; default: if (ret) errno = EINVAL; } # else struct timespec wait_time; struct timeval now; if (gettimeofday(&now, NULL) == -1) { std::cerr << "Semaphore::wait(ms): Unable to get time with gettimeofday!" << std::endl; abort(); } wait_time.tv_nsec = ((time_ms % 1000) * 1000 * 1000) + (now.tv_usec * 1000); wait_time.tv_sec = (time_ms / 1000) + (wait_time.tv_nsec / (1000 * 1000 * 1000)) + now.tv_sec; wait_time.tv_nsec %= 1000 * 1000 * 1000; int ret = sem_timedwait(&semaphore, &wait_time); # endif assert(!ret || (errno == ETIMEDOUT || errno == EINTR)); return !ret; #endif }