// memory sizes #define MEM_CATS 12 #define LOG_BUF 65536 #define WORK_BUF 65536 #define LOCALE_SIZE 512 #define LOCALE_ELEM 128 #define GUI_MAX_ELEM 512 #define GUI_STR_SIZE 256 #define SHD_INCLUDE 256 #define KEY_MAXBINDS 64 #define PERF_SECTIONS 10 #define CVAR_MAX 256 #define CCMD_MAX 256 #define CON_BUF 32768 #define CON_LINE 1024 #define HUD_MSGS 128 #define HUD_BUF 16384 #define VID_MODES 28 #define VID_MODE_STR 32 #define SND_QUEUE 1024 #define SND_LOG 256 #define SND_LOG_LEN 256 #define COLL_MAX 1024 #define MATERIAL_MAX 4096 #define SND_INFO 64 #define SND_KAR 72 #define SND_KLOG 5 #define BANK_MAX 64 #define GUI_AUX_STR 320 // numerical constants #define GLM_E 2.71828182845904523536028747135266250 /* e */ #define GLM_LOG2E 1.44269504088896340735992468100189214 /* log2(e) */ #define GLM_LOG10E 0.434294481903251827651128918916605082 /* log10(e) */ #define GLM_LN2 0.693147180559945309417232121458176568 /* loge(2) */ #define GLM_LN10 2.30258509299404568401799145468436421 /* loge(10) */ #define GLM_PI 3.14159265358979323846264338327950288 /* pi */ #define GLM_PI_2 1.57079632679489661923132169163975144 /* pi/2 */ #define GLM_PI_4 0.785398163397448309615660845819875721 /* pi/4 */ #define GLM_1_PI 0.318309886183790671537767526745028724 /* 1/pi */ #define GLM_2_PI 0.636619772367581343075535053490057448 /* 2/pi */ #define GLM_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */ #define GLM_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */ #define GLM_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */ #define GLM_Ef ((float)GLM_E) #define GLM_LOG2Ef ((float)GLM_LOG2E) #define GLM_LOG10Ef ((float)GLM_LOG10E) #define GLM_LN2f ((float)GLM_LN2) #define GLM_LN10f ((float)GLM_LN10) #define GLM_PIf ((float)GLM_PI) #define GLM_PI_2f ((float)GLM_PI_2) #define GLM_PI_4f ((float)GLM_PI_4) #define GLM_1_PIf ((float)GLM_1_PI) #define GLM_2_PIf ((float)GLM_2_PI) #define GLM_2_SQRTPIf ((float)GLM_2_SQRTPI) #define GLM_SQRT2f ((float)GLM_SQRT2) #define GLM_SQRT1_2f ((float)GLM_SQRT1_2) #define FILE_FLAG_IGNMISS 0x01 #define FILE_FLAG_IGNEMPTY 0x02 #define FILE_FLAG_STRING 0x04 #define TEX_FLAG_FLIP 0x01 #define TEX_FLAG_FILTER 0x02 #define TEX_FLAG_MIPMAP 0x04 #define TEX_FLAG_NMIPMAP 0x08 #define WIN_BORDER 2 #define WIN_TITLEBAR 20 #define WIN_MINX (WIN_BORDER * 2) #define WIN_MINY (WIN_TITLEBAR + WIN_BORDER * 2) #define SHD_FLAG_UL 0x01 #define SHD_FLAG_CL 0x02 #define SHD_FLAG_BL 0x04 #define SHD_FLAG_FD 0x08 #define SHD_TRACE_SIZE 1024 #define ERR_LOG_SIZE 1024 #define CCMD_UNLIMITED 65535 #define GUI_SCROLL_LN 3 #define KEY_BINDS 20 #define CHUNK_SIZE 32 #define CHUNK_POLY_GROW 32 // #define CHUNK_LIGHT_WIDTH (CHUNK_SIZE * 2) // #define CHUNK_LIGHT_BORDER 2 // #define CHUNK_LIGHT_SIZE (CHUNK_LIGHT_WIDTH + (CHUNK_LIGHT_BORDER * 2)) #define WORLD_CLAMP_XZ 0x01 #define WORLD_CLAMP_Y 0x02 #define MID_DEFTEMPO 500000 #define BANK_KEEP 0x01 #define BANK_UNKN 0x02 #define BANK_PBRANGE 2.0 #define RSM_FRAC 10 #define WAV_HDRSIZE 44 #define BNK_IDX_MELO_ONLY 25 #define BNK_IDX_DRUM_ONLY 30 #define SND_VOLUMES 4 #define SND_LOGX 8 #define MOUSE_BTNS 8 // #define GUI_REFRESH 0xfd #define GUI_INVALID 0xff #define UNI_MAX_PAGES 4352 #define LIGHT_SSIZE (sizeof(float) * 20) // strings, characters, ... #define COL_RESET "\x01" #define COL_AUX1 "\x02" #define COL_AUX2 "\x03" #define COL_AUX3 "\x04" #define COL_AUX4 "\x05" #define COL_AUX5 "\x06" #define COL_AUX6 "\x07" #define COL_AUX7 "\x08" #define COL_AUX8 "\x09" #define STR_NLN "\x0a" #define FMT_RESET "\x0b" #define FMT_ULINE "\x0c" #define FMT_CLINE "\x0d" #define FMT_BLINK "\x0e" #define FMT_FADE "\x0f" #define COL_BLACK "\x10" #define COL_DGRAY "\x11" #define COL_GRAY "\x12" #define COL_LGRAY "\x13" #define COL_WHITE "\x14" #define COL_RED "\x15" #define COL_GREEN "\x16" #define COL_BLUE "\x17" #define COL_YELLOW "\x18" #define COL_MAGENTA "\x19" #define COL_CYAN "\x1a" #define COL_VIOLET "\x1b" #define COL_ORANGE "\x1c" #define COL_CRIMSON "\x1d" #define COL_MIDNIGHT "\x1e" #define COL_NEON "\x1f" #define STR_SPC "\x20" #define STR_UNK "\x7f" #define STR_WSPC "\u3000" #define CHR_CRESET 0x01 #define CHR_COLORS2 0x02 #define CHR_COLORE2 0x09 #define CHR_NLN 0x0a #define CHR_FRESET 0x0b #define CHR_ULINE 0x0c #define CHR_CLINE 0x0d #define CHR_BLINK 0x0e #define CHR_FADE 0x0f #define CHR_COLORS1 0x10 #define CHR_COLORE1 0x1f #define CHR_SPC 0x20 #define CHR_UNK 0x7f #define CHR_WSPC 0x3000 #define LOG_SYS "SYS" #define LOG_MEM "MEM" #define LOG_GFX "OGL" #define LOG_IO "FIO" #define LOG_CON "CON" #define LOG_TIC "TIC" #define LOG_SND "SND" #define LOG_X11 "X11" #define LOG_GLX "GLX" #define DIR_SCREENSHOTS "screenshots" #define DIR_BANKS "banks" #define DIR_SHADERS "shaders" #define SHD_VERSION "450 core" #define SYM_IMP "\U0001f47f" #define SYM_BLKHEART "\U0001f5a4" #define SYM_DEMON "\U0001f608" #define SYM_HORNS "\U0001f918" #define SYM_PLAY "\U00100000" #define SYM_STOP "\U00100001" #define SYM_PAUSE "\U00100002" #define SYM_NEXT "\U00100003" #define SYM_PREV "\U00100004" #define SYM_FFORWARD "\U00100005" #define SYM_FREVERSE "\U00100006" #define SYM_CONTINUOS "\U00100007" #define SYM_REPEAT "\U00100008" #define SYM_LOOPED "\U00100009" #define SYM_SHUFFLE "\U0010000a" #define SYM_PRANDOM "\U0010000b" #define SYM_JUMPTO "\U0010000c" #define SYM_FOLDER "\U0010000d" #define SYM_DELETE "\U0010000e" #define SYM_SAVEDISK "\U0010000f" #define SYM_BUG "\U00100010" #define SYM_INVALID "\U00100011" #define KEYSYM_0 1 #define KEYSYM_1 2 #define KEYSYM_2 3 #define KEYSYM_3 4 #define KEYSYM_4 5 #define KEYSYM_5 6 #define KEYSYM_6 7 #define KEYSYM_7 8 #define KEYSYM_8 9 #define KEYSYM_9 10 #define KEYSYM_A 11 #define KEYSYM_B 12 #define KEYSYM_C 13 #define KEYSYM_D 14 #define KEYSYM_E 15 #define KEYSYM_F 16 #define KEYSYM_G 17 #define KEYSYM_H 18 #define KEYSYM_I 19 #define KEYSYM_J 20 #define KEYSYM_K 21 #define KEYSYM_L 22 #define KEYSYM_M 23 #define KEYSYM_N 24 #define KEYSYM_O 25 #define KEYSYM_P 26 #define KEYSYM_Q 27 #define KEYSYM_R 28 #define KEYSYM_S 29 #define KEYSYM_T 30 #define KEYSYM_U 31 #define KEYSYM_V 32 #define KEYSYM_W 33 #define KEYSYM_X 34 #define KEYSYM_Y 35 #define KEYSYM_Z 36 #define KEYSYM_F1 37 #define KEYSYM_F2 38 #define KEYSYM_F3 39 #define KEYSYM_F4 40 #define KEYSYM_F5 41 #define KEYSYM_F6 42 #define KEYSYM_F7 43 #define KEYSYM_F8 44 #define KEYSYM_F9 45 #define KEYSYM_F10 46 #define KEYSYM_F11 47 #define KEYSYM_F12 48 #define KEYSYM_KP_0 49 #define KEYSYM_KP_1 50 #define KEYSYM_KP_2 51 #define KEYSYM_KP_3 52 #define KEYSYM_KP_4 53 #define KEYSYM_KP_5 54 #define KEYSYM_KP_6 55 #define KEYSYM_KP_7 56 #define KEYSYM_KP_8 57 #define KEYSYM_KP_9 58 #define KEYSYM_SPACE 59 #define KEYSYM_CIRCUMFLEX 60 #define KEYSYM_SHARP_S 61 #define KEYSYM_ACUTE 62 #define KEYSYM_UE 63 #define KEYSYM_PLUS 64 #define KEYSYM_OE 65 #define KEYSYM_AE 66 #define KEYSYM_NUMBER_SIGN 67 #define KEYSYM_LESS_THAN 68 #define KEYSYM_COMMA 69 #define KEYSYM_PERIOD 70 #define KEYSYM_HYPHEN 71 #define KEYSYM_KP_DECIMAL 72 #define KEYSYM_KP_DIVIDE 73 #define KEYSYM_KP_MULTIPLY 74 #define KEYSYM_KP_SUBTRACT 75 #define KEYSYM_KP_ADD 76 #define KEYSYM_KP_ENTER 77 #define KEYSYM_KP_EQUAL 78 #define KEYSYM_CAPS_LOCK 79 #define KEYSYM_SCROLL_LOCK 80 #define KEYSYM_NUM_LOCK 81 #define KEYSYM_ESCAPE 82 #define KEYSYM_RETURN 83 #define KEYSYM_TAB 84 #define KEYSYM_BACKSPACE 85 #define KEYSYM_INSERT 86 #define KEYSYM_DELETE 87 #define KEYSYM_RIGHT 88 #define KEYSYM_LEFT 89 #define KEYSYM_DOWN 90 #define KEYSYM_UP 91 #define KEYSYM_PAGE_UP 92 #define KEYSYM_PAGE_DOWN 93 #define KEYSYM_HOME 94 #define KEYSYM_END 95 #define KEYSYM_PRINT_SCREEN 96 #define KEYSYM_PAUSE 97 #define KEYSYM_LEFT_SHIFT 98 #define KEYSYM_LEFT_CONTROL 99 #define KEYSYM_ALT 100 #define KEYSYM_LEFT_META 101 #define KEYSYM_RIGHT_SHIFT 102 #define KEYSYM_RIGHT_CONTROL 103 #define KEYSYM_ALT_GRAPH 104 #define KEYSYM_RIGHT_META 105 #define KEYSYM_MENU 106 #define KEYSYM_FIRST KEYSYM_SPACE #define KEYSYM_LAST KEYSYM_MENU #define KEY_MOUSE_OFFSET (1 + KEYSYM_LAST - KEYSYM_FIRST) #define STR_ARG_USAGE "Verwendung" #define STR_ARG_HELP "Diese Hilfe anzeigen" #define STR_ARG_OPVEC "Option %s (-%c)" #define STR_ARG_OPPOS "Option %s (#%d)" #define STR_ARG_EINT "muss ein ganzzahliger Wert sein" #define STR_ARG_ERANGE "muss sich im Bereich %d .. %d befinden" #define STR_ARG_UNKNOWN "Unbekannte Option -%c" #define STR_ARG_EMORE "Zu viele Argumente, Maximum %d" #define STR_ARG_ELESS "Nicht genug Argumente, Minimum %d" #define STR_ARG_EREQARG STR_ARG_OPVEC " benoetigt ein Argument" #define STR_ARG_EINT_V STR_ARG_OPVEC " " STR_ARG_EINT #define STR_ARG_EINT_P STR_ARG_OPPOS " " STR_ARG_EINT #define STR_ARG_ERANGE_V STR_ARG_OPVEC " " STR_ARG_ERANGE #define STR_ARG_ERANGE_P STR_ARG_OPPOS " " STR_ARG_ERANGE #define ARGSTR_COMMANDS "Befehle" #define ARGSTR_VERSION "Version ausgeben und beenden" #define ARGSTR_LOGLEVEL "Ausgabestufe" #define ARGSTR_GLDEBUG "OpenGL-Debugging" #define ARGSTR_NOSOUND "Tonausgabe deaktivieren" #define ARGSTR_CONFIG "Konfigurationsdatei" #define ARGSTR_LANG "Sprachdatei" #define SYS_BUILD "D" STRINGIZE(BUILD_ID) #define SYS_PROGRAM SYS_PROGNAME " " SYS_BUILD #define SYS_PROGRAM_FULL SYS_PROGRAM " [" BUILD_DATE "]" // macros #define SIZE_TEST(t, s) assert((sizeof(t) * 8) == s) #define STRINGIZE(s) ISTRINGIZE(s) #define ISTRINGIZE(s) #s #define f_inline static inline __attribute((always_inline)) #define f_align(x) __attribute((aligned(x))) #define LOG_FUNC(func, level) void func(const char *prefix, const char *fmt, ...) { va_list ap; va_start(ap, fmt); log_msg(prefix, level, fmt, ap); va_end(ap); } #define SLOG_FUNC(func, level) void func(const char *fmt, ...) { va_list ap; va_start(ap, fmt); snd_log(level, fmt, ap); va_end(ap); } #define file_read(d, f) file_read_hdr(d, f, NULL, 0, 0) #define file_sread(d, f) file_read_hdr((byte**)(d), f, NULL, 0, FILE_FLAG_IGNMISS | FILE_FLAG_STRING) #define LOAD_SHADER(f, r, s) if(!shd_load(&(gdr.shd_ ## f), DIR_SHADERS "/" STRINGIZE(f) ".vsh", DIR_SHADERS "/" STRINGIZE(f) ".fsh", r, (shd_dfunc*)s)) { loge(LOG_GFX, STR_SHD_ELOAD, STRINGIZE(f)); return 0; } #define FONT_STRIDE(x, y, c) ((((c & 15) * width + x) + (((c >> 4) & 15) * height + y) * (width << 4)) << 2) #define PERF_FIRST() sys.tmr_atime = tmr_time(); #define PERF_START(s) sys.tmr_ftime = sys.tmr_stime = tmr_time(); sys.perf_pos = s; #define PERF_SEC(s) sys.tmr_dtime = tmr_time() - sys.tmr_ftime; sys.tmr_ftime = tmr_time(); sys.tmr_total[sys.perf_pos] += sys.tmr_profile[sys.perf_swap + sys.perf_pos] = sys.tmr_dtime; sys.perf_pos = s; #define PERF_END() sys.tmr_dtime = (sys.tmr_etime = tmr_time()) - sys.tmr_ftime; sys.tmr_total[sys.perf_pos] += sys.tmr_profile[sys.perf_swap + sys.perf_pos] = sys.tmr_dtime; sys.tmr_ttime = sys.tmr_etime - sys.tmr_stime; sys.tmr_iters += 1; sys.perf_swap = sys.perf_swap ? 0 : PERF_SECTIONS; #define PERF_LAST() sys.tmr_atime = tmr_time() - sys.tmr_atime; #define CLAMP_VALUE(v, a, b) ((v) < (a) ? (a) : ((v) > (b) ? (b) : (v))) #define MIN_VALUE(a, b) ((a) < (b) ? (a) : (b)) #define MAX_VALUE(a, b) ((a) > (b) ? (a) : (b)) #define VEC3_SET(v, x, y, z) v[0] = x; v[1] = y; v[2] = z; #define AABB_OFFSET(bb, x, y, z) bb.x1 += x; bb.x2 += x; bb.y1 += y; bb.y2 += y; bb.z1 += z; bb.z2 += z; #define AABB_SET(bb, px1, py1, pz1, px2, py2, pz2) bb.x1 = px1; bb.x2 = px2; bb.y1 = py1; bb.y2 = py2; bb.z1 = pz1; bb.z2 = pz2; #define AABB_PSET(bb, px1, py1, pz1, px2, py2, pz2) bb->x1 = px1; bb->x2 = px2; bb->y1 = py1; bb->y2 = py2; bb->z1 = pz1; bb->z2 = pz2; #define AABB_COPY(aa, bb) memcpy(&bb, &aa, sizeof(bbox_t)) #define AABB_PCOPY(aa, bb) memcpy(bb, aa, sizeof(bbox_t)) // #define CHUNK_STRIDE(w, x, y, z) (((x) + w->size_x / 2) + w->size_x * (((z) + w->size_z / 2) + (w->size_z * ((y) + w->size_y / 2)))) // #define CHUNK_OUT(w, x, y, z) ((x) < -(w->size_x / 2) || (y) < -(w->size_y / 2) || (z) < -(w->size_z / 2) || (x) >= ((w->size_x + 1) / 2) || (y) >= ((w->size_y + 1) / 2) || (z) >= ((w->size_z + 1) / 2)) // #define CHUNK_CLAMP(w, v, c) CLAMP_VALUE(v, -(w->size_ ## c / 2), ((w->size_ ## c + 1) / 2) - 1) #define BANK_VELOFUNC(x, n) (1.0-log(1.0+((1.0-pow(x,n))*(M_E-1.0)))) /* input: [0, 256), output: [0, 65536] */ #define OPL_SIN(x) ((int)(sin((x) * M_PI / 512.0) * 65536.0)) #define SYS_BASE (sizeof(sys_t) + sizeof(gfx_t) + sizeof(isnd_t) + sizeof(snd_t) + sizeof(wcf_t)) #define DL_LOPEN(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define X [0] #define Y [1] #define Z [2] #define NEG_OFFSET(x, d) (x < 0 ? ((x / d) - 1) : (x / d)) #define sys_assert(expr) if(!(expr)){sys_panic("ASSERTION_FAILURE", "Falsch: " STRINGIZE(expr));} #define CHUNK_ID(x, y, z) (((ulong)(x & 0xfffff) | (x < 0 ? 0x100000ULL : 0ULL)) | (((ulong)(y & 0xfffff) | (y < 0 ? 0x100000ULL : 0ULL)) << 21) | \ (((ulong)(z & 0xfffff) | (z < 0 ? 0x100000ULL : 0ULL)) << 42) | 0x8000000000000000) // enums enum mem_category { MEM_SYSTEM, MEM_IMAGE, MEM_FONT, MEM_DRAW, MEM_FILE, MEM_LIGHTS, MEM_WORLD, MEM_POLY, MEM_CHUNK, MEM_OBJECT, MEM_OBJMAP, MEM_MISC }; enum log_level { LOG_SILENT, LOG_USER, LOG_ERROR, LOG_WARN, LOG_INFO, LOG_PERF, LOG_DEBUG, LOG_TRACE }; enum gui_type { GUI_LABEL, GUI_BUTTON, GUI_TOGGLE_OFF, GUI_TOGGLE_ON, GUI_ENUM, GUI_SLIDER, GUI_SLIDER_HANDLE, GUI_DROPDOWN, GUI_DROPDOWN_HANDLE, GUI_FIELD, GUI_CUSTOM }; enum key_event { KEY_RELEASE, KEY_PRESS, KEY_REPEAT }; enum key_bind { KEY_QUIT, KEY_SCREENSHOT, KEY_CONSOLE, KEY_SHOW, KEY_FULLSCREEN, KEY_SYNC, KEY_MENU, KEY_DOWN, KEY_UP, KEY_FORWARD, KEY_BACKWARD, KEY_LEFT, KEY_RIGHT, KEY_FAST, KEY_NOCLIP, KEY_FLY, KEY_ZOOM_IN, KEY_ZOOM_OUT, KEY_CAMERA, KEY_PLAYER }; enum mouse_button { MOUSE_LEFT = 1, MOUSE_RIGHT, MOUSE_MIDDLE, MOUSE_BTN_X, MOUSE_BTN_Y, MOUSE_BTN_A, MOUSE_BTN_B, MOUSE_BTN_C, SCROLL_UP, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT }; enum perf_section { PERF_TIMING, PERF_INPUT, PERF_TICK, PERF_UPDATE, PERF_RENDER, PERF_GUI, PERF_REST, PERF_SWAP, PERF_EVENTS, PERF_WAIT }; enum cvar_type { CVAR_BOOL, CVAR_INT, CVAR_FLOAT, CVAR_ENUM, CVAR_COLOR, CVAR_COLOR_ALPHA, CVAR_KEY }; enum cvar_category { CVAR_SYSTEM, CVAR_WINDOW, CVAR_GUI, CVAR_STYLE, CVAR_RENDER, CVAR_BIND, CVAR_CONSOLE, CVAR_PHYSICS, CVAR_WORLD, CVAR_SOUND }; enum move_dir { DIR_LEFT, DIR_RIGHT, DIR_DOWN, DIR_UP, DIR_BACKWARD, DIR_FORWARD }; enum cardinal_dir { FACE_WEST, FACE_EAST, FACE_DOWN, FACE_UP, FACE_NORTH, FACE_SOUTH }; enum mipmap_type { MIP_NONE, MIP_NEAREST, MIP_LINEAR }; enum geom_type { GEOM_TRI, GEOM_QUAD, GEOM_PLANE }; enum mid_event { midev_noteoff = 0x80, midev_noteon = 0x90, midev_aftertouch = 0xa0, midev_control = 0xb0, midev_progchg = 0xc0, midev_chnpressure = 0xd0, midev_pitchbend = 0xe0, midev_sysex = 0xf0, midev_songpos = 0xf2, midev_songsel = 0xf3, midev_tunereq = 0xf6, midev_endsysex = 0xf7, midev_clock = 0xf8, midev_start = 0xfa, midev_continue = 0xfb, midev_stop = 0xfc, midev_actsense = 0xfe, midev_meta = 0xff }; enum mid_meta { midmt_seqnum = 0x00, // nn nn midmt_text = 0x01, // text... midmt_copyright = 0x02, // text... midmt_trackname = 0x03, // text... midmt_instrname = 0x04, // text... midmt_lyric = 0x05, // text... midmt_marker = 0x06, // text... midmt_cuepoint = 0x07, // text... midmt_chnprefix = 0x20, // cc midmt_endtrack = 0x2f, // midmt_tempo = 0x51, // tt tt tt midmt_smpte = 0x54, // hr mn se fr ff midmt_timesig = 0x58, // nn dd cc bb midmt_keysig = 0x59, // sf mi midmt_seqspec = 0x7f // data... }; enum bank_op { b_op2, b_op4, b_op22, b_op0 }; enum opl3_op { ch_2op = 0, ch_4op = 1, ch_4op2 = 2 }; enum envelope_gen_num { envelope_gen_num_attack = 0, envelope_gen_num_decay = 1, envelope_gen_num_sustain = 2, envelope_gen_num_release = 3 }; enum snd_volume { SND_VOL_MASTER, SND_VOL_MUSIC, SND_VOL_SFX, SND_VOL_GUI }; // types typedef int ivec2[2]; typedef int ivec3[3]; typedef int ivec4[4]; typedef float vec2[2]; typedef float vec3[3]; typedef f_align(16) float vec4[4]; typedef f_align(16) vec2 mat2[2]; typedef vec3 mat3[3]; typedef f_align(16) vec4 mat4[4]; // arrays static const char *mem_types[] = {"system", "textures", "fonts", "rendering", "files", "lighting", "worlds", "polys", "chunks", "objects", "mapping", "misc"}; static const char *log_levels[] = {"UNK?", "USER", "ERR!", "WARN", "INFO", "PERF", "DBG#", "TRC#"}; static const char *log_elevels[] = {"silent", "user", "error", "warn", "info", "perf", "debug", "trace"}; static const char *log_colors[] = {"", COL_WHITE, COL_RED, COL_YELLOW, COL_BLUE, COL_CYAN, COL_MAGENTA, COL_VIOLET}; static const char *perf_sections[] = {"Timing", "Input", "Tick", "Update", "Render", "Gui", "Rest", "Swap", "Events", "Wait"}; static const char *cvar_types[] = {COL_MAGENTA"bool", COL_GREEN"int", COL_YELLOW"float", COL_CYAN"enum", COL_LGRAY"color", COL_GRAY"color32", COL_VIOLET"key"}; static const char *cvar_categories[] = {COL_RED"system", COL_BLUE"window", COL_GREEN"gui", COL_VIOLET"style", COL_NEON"render", COL_ORANGE"bind", COL_YELLOW"console", COL_CYAN"physics", COL_MAGENTA"world", COL_CRIMSON"sound"}; // BLACK DGRAY GRAY LGRAY WHITE RED GREEN BLUE YELLOW MAGENTA CYAN VIOLET ORANGE CRIMSON MIDNIGHT NEON static const uint text_colors[] = {0x000000, 0x585858, 0x808080, 0xc0c0c0, 0xffffff, 0xcf0000, 0x00cf00, 0x0000cf, 0xbfbf00, 0xbf00bf, 0x00bfbf, 0x6000ff, 0xff7000, 0x601010, 0x000080, 0x80c0f0}; static const uint aux_colors[] = {0x80f0c0, 0x3000c0, 0x56250b, 0x80ff00, 0x202020, 0x606060, 0xa0a0a0, 0xe0e0e0}; static const char dc32_ascii[] = { // 0x1f -> AUX1 0, ' ', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'G', // $00, $80 'H', 'I', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'V', 'W', 'X', 'Z', 0 // $10, $90 }; static const char dc32_aux1[] = { // 0x01 -> lc / UC, 0x1f -> AUX2 0, 0, '!', '"', '#', '$', '%', '&', '\'', '*', '+', ',', '-', '.', '/', 'F', // $20, $A0 ':', '1', 'J', ';', '=', '?', '0', '\\', 'Q', '^', '_', 'U', '|', '~', 'Y', 0 // $30, $B0 }; static const char dc32_aux2[] = { // 0x0f -> [0x10 ~ 0x1f ... 0x0f -> UTF] | [0x01 ~ 0x0e -> AUX3], 0x0c -> STR_WSPC 0, 0x01, '(', ')', '<', '>', '@', '[', ']', '`', '{', '}', 0, 0x7f, 0x0a, 0, // $40 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f // $50 }; static const char dc32_aux3[] = { // 0x01 -> SYM_DEMON 0, 0, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0 // $60 }; static const char plr_wheel[] = { '/', '-', '\\', '|'}; static const byte ascii_dc32[] = { 0x00, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x4e, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x01, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x42, 0x43, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x36, 0x31, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x30, 0x33, 0x44, 0x34, 0x45, 0x35, 0x46, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x2f, 0x0f, 0x10, 0x11, 0x32, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x38, 0x18, 0x19, 0x1a, 0x3b, 0x1b, 0x1c, 0x1d, 0x3e, 0x1e, 0x47, 0x37, 0x48, 0x39, 0x3a, 0x49, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0xaf, 0x8f, 0x90, 0x91, 0xb2, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0xb8, 0x98, 0x99, 0x9a, 0xbb, 0x9b, 0x9c, 0x9d, 0xbe, 0x9e, 0x4a, 0x3c, 0x4b, 0x3d, 0x4d }; static const byte ascii_dc32s[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x16, 0x11, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0, 0, 0, 0, 0, 0, 0, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x1b, 0x0f, 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x16, 0x18, 0x19, 0x1a, 0x1b, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0, 0, 0, 0, 0, 0, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x1b, 0x0f, 0x10, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x16, 0x18, 0x19, 0x1a, 0x1b, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0, 0, 0, 0, 0 }; static const float vert_quad[] = {0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f}; /* static const float vert_box[] = { // x y z nx ny nz u v -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // -Z 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // +Z 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // -X -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // +X 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // -Y 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // +Y 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f }; */ static const char *mipmap_etype[] = {"off", "nearest", "linear"}; static const char *snd_eformat[] = {"s16le", "s32le"}; static const char *snd_edevice[] = {"default", "null", "jack", "pulse", "hw", "plughw", "none"}; static const char *con_epositions[] = {"top", "bottom"}; static const char *mid_extensions[] = {"mid", "kar", "midi"}; static const char *snd_cvar_volume[] = {"snd_volume_master", "snd_volume_music", "snd_volume_sfx", "snd_volume_gui"}; static const char *key_names[] = { "space", "^", "ß", "´", "ü", "+", "ö", "ä", "#", "<", ",", ".", "-", "kp.", "kp/", "kp*", "kp-", "kp+", "enter", "kp=", "caps", "scroll", "num", "esc", "return", "tab", "bksp", "ins", "del", "right", "left", "down", "up", "pgup", "pgdn", "home", "end", "print", "pause", "lshift", "lctrl", "alt", "lmeta", "rshift", "rctrl", "altgr", "rmeta", "menu", "lmb", "rmb", "mmb", "xmb", "ymb", "m6", "m7", "m8", "scrup", "scrdn", "scrl", "scrr" }; static const char *snd_banknames[] = { "dmx_dmx", "dmx_doom1", "dmx_doom2", "dmx_raptor", "dmx_strife", "wolfinstein", "std_o3", "std_sb", "hmi_144", "cyberpuck", "d3dtimbr", "d3dtimbr_mod", "gmoconel", "gmopl_mod", "swtimbr", "tmb_default", "wallence", "fat2", "fat4", "op2x2", "wallace", "earthsieg", "warcraft", "nemesis", "bank49", "jv_2op", "gmopl", "mt32", "insmaker_std", "bank53", "drumopl" }; static const char *snd_bankfiles[] = { DIR_BANKS"/dmx_dmx.op2", DIR_BANKS"/dmx_doom1.op2", DIR_BANKS"/dmx_doom2.op2", DIR_BANKS"/dmx_raptor.op2", DIR_BANKS"/dmx_strife.op2", DIR_BANKS"/wolfinstein.op2", DIR_BANKS"/std_o3.skb", DIR_BANKS"/std_sb.skb", DIR_BANKS"/hmi_144.skb", DIR_BANKS"/cyberpuck.tmb", DIR_BANKS"/d3dtimbr.tmb", DIR_BANKS"/d3dtimbr_mod.tmb", DIR_BANKS"/gmoconel.tmb", DIR_BANKS"/gmopl_mod.tmb", DIR_BANKS"/swtimbr.tmb", DIR_BANKS"/tmb_default.tmb", DIR_BANKS"/wallence.op3", DIR_BANKS"/fat2.op3", DIR_BANKS"/fat4.op3", DIR_BANKS"/op2x2.op3", DIR_BANKS"/wallace.op3", DIR_BANKS"/earthsieg.ad", DIR_BANKS"/warcraft.ad", DIR_BANKS"/nemesis.opl", DIR_BANKS"/bank49.opl", DIR_BANKS"/jv_2op.op3", DIR_BANKS"/gmopl.ibk", DIR_BANKS"/mt32.ibk", DIR_BANKS"/insmaker_std.bnk", DIR_BANKS"/bank53.opl", DIR_BANKS"/drumopl.tmb" }; static const char *mid_hdr = "MThd"; static const char *mid_trk = "MTrk"; static const uint bank_notes[] = { 8175, 8661, 9177, 9722, 10300, 10913, 11562, 12249, 12978, 13750, 14567, 15433, 16351, 17323, 18354, 19445, 20601, 21826, 23124, 24499, 25956, 27500, 29135, 30867, 32703, 34647, 36708, 38890, 41203, 43653, 46249, 48999, 51913, 55000, 58270, 61735, 65406, 69295, 73416, 77781, 82406, 87307, 92498, 97998, 103826, 110000, 116540, 123470, 130812, 138591, 146832, 155563, 164813, 174614, 184997, 195997, 207652, 220000, 233081, 246941, 261625, 277182, 293664, 311126, 329627, 349228, 369994, 391995, 415304, 440000, 466163, 493883, 523251, 554365, 587329, 622253, 659255, 698456, 739988, 783990, 830609, 880000, 932327, 987766, 1046502, 1108730, 1174659, 1244507, 1318510, 1396912, 1479977, 1567981, 1661218, 1760000, 1864655, 1975533, 2093004, 2217461, 2349318, 2489015, 2637020, 2793825, 2959955, 3135963, 3322437, 3520000, 3729310, 3951066, 4186009, 4434922, 4698636, 4978031, 5274040, 5587651, 5919910, 6271926, 6644875, 7040000, 7458620, 7902132, 8372018, 8869844, 9397272, 9956063, 10548081, 11175303, 11839821, 12543853 }; static const uint opl3_maxfreq[] = { 48503, 97006, 194013, 388026, 776053, 1552107, 3104215, 6208431 }; static const ushort logsinrom[256] = { 0x859, 0x6c3, 0x607, 0x58b, 0x52e, 0x4e4, 0x4a6, 0x471, 0x443, 0x41a, 0x3f5, 0x3d3, 0x3b5, 0x398, 0x37e, 0x365, 0x34e, 0x339, 0x324, 0x311, 0x2ff, 0x2ed, 0x2dc, 0x2cd, 0x2bd, 0x2af, 0x2a0, 0x293, 0x286, 0x279, 0x26d, 0x261, 0x256, 0x24b, 0x240, 0x236, 0x22c, 0x222, 0x218, 0x20f, 0x206, 0x1fd, 0x1f5, 0x1ec, 0x1e4, 0x1dc, 0x1d4, 0x1cd, 0x1c5, 0x1be, 0x1b7, 0x1b0, 0x1a9, 0x1a2, 0x19b, 0x195, 0x18f, 0x188, 0x182, 0x17c, 0x177, 0x171, 0x16b, 0x166, 0x160, 0x15b, 0x155, 0x150, 0x14b, 0x146, 0x141, 0x13c, 0x137, 0x133, 0x12e, 0x129, 0x125, 0x121, 0x11c, 0x118, 0x114, 0x10f, 0x10b, 0x107, 0x103, 0x0ff, 0x0fb, 0x0f8, 0x0f4, 0x0f0, 0x0ec, 0x0e9, 0x0e5, 0x0e2, 0x0de, 0x0db, 0x0d7, 0x0d4, 0x0d1, 0x0cd, 0x0ca, 0x0c7, 0x0c4, 0x0c1, 0x0be, 0x0bb, 0x0b8, 0x0b5, 0x0b2, 0x0af, 0x0ac, 0x0a9, 0x0a7, 0x0a4, 0x0a1, 0x09f, 0x09c, 0x099, 0x097, 0x094, 0x092, 0x08f, 0x08d, 0x08a, 0x088, 0x086, 0x083, 0x081, 0x07f, 0x07d, 0x07a, 0x078, 0x076, 0x074, 0x072, 0x070, 0x06e, 0x06c, 0x06a, 0x068, 0x066, 0x064, 0x062, 0x060, 0x05e, 0x05c, 0x05b, 0x059, 0x057, 0x055, 0x053, 0x052, 0x050, 0x04e, 0x04d, 0x04b, 0x04a, 0x048, 0x046, 0x045, 0x043, 0x042, 0x040, 0x03f, 0x03e, 0x03c, 0x03b, 0x039, 0x038, 0x037, 0x035, 0x034, 0x033, 0x031, 0x030, 0x02f, 0x02e, 0x02d, 0x02b, 0x02a, 0x029, 0x028, 0x027, 0x026, 0x025, 0x024, 0x023, 0x022, 0x021, 0x020, 0x01f, 0x01e, 0x01d, 0x01c, 0x01b, 0x01a, 0x019, 0x018, 0x017, 0x017, 0x016, 0x015, 0x014, 0x014, 0x013, 0x012, 0x011, 0x011, 0x010, 0x00f, 0x00f, 0x00e, 0x00d, 0x00d, 0x00c, 0x00c, 0x00b, 0x00a, 0x00a, 0x009, 0x009, 0x008, 0x008, 0x007, 0x007, 0x007, 0x006, 0x006, 0x005, 0x005, 0x005, 0x004, 0x004, 0x004, 0x003, 0x003, 0x003, 0x002, 0x002, 0x002, 0x002, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000 }; static const ushort exprom[256] = { 0x7fa, 0x7f5, 0x7ef, 0x7ea, 0x7e4, 0x7df, 0x7da, 0x7d4, 0x7cf, 0x7c9, 0x7c4, 0x7bf, 0x7b9, 0x7b4, 0x7ae, 0x7a9, 0x7a4, 0x79f, 0x799, 0x794, 0x78f, 0x78a, 0x784, 0x77f, 0x77a, 0x775, 0x770, 0x76a, 0x765, 0x760, 0x75b, 0x756, 0x751, 0x74c, 0x747, 0x742, 0x73d, 0x738, 0x733, 0x72e, 0x729, 0x724, 0x71f, 0x71a, 0x715, 0x710, 0x70b, 0x706, 0x702, 0x6fd, 0x6f8, 0x6f3, 0x6ee, 0x6e9, 0x6e5, 0x6e0, 0x6db, 0x6d6, 0x6d2, 0x6cd, 0x6c8, 0x6c4, 0x6bf, 0x6ba, 0x6b5, 0x6b1, 0x6ac, 0x6a8, 0x6a3, 0x69e, 0x69a, 0x695, 0x691, 0x68c, 0x688, 0x683, 0x67f, 0x67a, 0x676, 0x671, 0x66d, 0x668, 0x664, 0x65f, 0x65b, 0x657, 0x652, 0x64e, 0x649, 0x645, 0x641, 0x63c, 0x638, 0x634, 0x630, 0x62b, 0x627, 0x623, 0x61e, 0x61a, 0x616, 0x612, 0x60e, 0x609, 0x605, 0x601, 0x5fd, 0x5f9, 0x5f5, 0x5f0, 0x5ec, 0x5e8, 0x5e4, 0x5e0, 0x5dc, 0x5d8, 0x5d4, 0x5d0, 0x5cc, 0x5c8, 0x5c4, 0x5c0, 0x5bc, 0x5b8, 0x5b4, 0x5b0, 0x5ac, 0x5a8, 0x5a4, 0x5a0, 0x59c, 0x599, 0x595, 0x591, 0x58d, 0x589, 0x585, 0x581, 0x57e, 0x57a, 0x576, 0x572, 0x56f, 0x56b, 0x567, 0x563, 0x560, 0x55c, 0x558, 0x554, 0x551, 0x54d, 0x549, 0x546, 0x542, 0x53e, 0x53b, 0x537, 0x534, 0x530, 0x52c, 0x529, 0x525, 0x522, 0x51e, 0x51b, 0x517, 0x514, 0x510, 0x50c, 0x509, 0x506, 0x502, 0x4ff, 0x4fb, 0x4f8, 0x4f4, 0x4f1, 0x4ed, 0x4ea, 0x4e7, 0x4e3, 0x4e0, 0x4dc, 0x4d9, 0x4d6, 0x4d2, 0x4cf, 0x4cc, 0x4c8, 0x4c5, 0x4c2, 0x4be, 0x4bb, 0x4b8, 0x4b5, 0x4b1, 0x4ae, 0x4ab, 0x4a8, 0x4a4, 0x4a1, 0x49e, 0x49b, 0x498, 0x494, 0x491, 0x48e, 0x48b, 0x488, 0x485, 0x482, 0x47e, 0x47b, 0x478, 0x475, 0x472, 0x46f, 0x46c, 0x469, 0x466, 0x463, 0x460, 0x45d, 0x45a, 0x457, 0x454, 0x451, 0x44e, 0x44b, 0x448, 0x445, 0x442, 0x43f, 0x43c, 0x439, 0x436, 0x433, 0x430, 0x42d, 0x42a, 0x428, 0x425, 0x422, 0x41f, 0x41c, 0x419, 0x416, 0x414, 0x411, 0x40e, 0x40b, 0x408, 0x406, 0x403, 0x400 }; static const byte op_mt[16] = { 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 20, 24, 24, 30, 30 }; static const byte kslrom[16] = { 0, 32, 40, 45, 48, 51, 53, 55, 56, 58, 59, 60, 61, 62, 63, 64 }; static const byte kslshift[4] = { 8, 1, 2, 0 }; static const byte eg_incstep[4][4] = { { 0, 0, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 1, 0 }, { 1, 1, 1, 0 } }; static const char *wav_hdr = "RIFF"; static const char *wav_hdr_fmt = "fmt "; static const char *wav_hdr_data = "data"; static const char *wav_format = "WAVE"; static const byte rng_table[256] = { 0x95, 0xbc, 0x64, 0x99, 0xc3, 0x31, 0x68, 0xc5, 0xba, 0xe2, 0x67, 0x66, 0xd1, 0x14, 0xce, 0xd7, 0x4c, 0xdb, 0x78, 0x41, 0xb9, 0xf3, 0x38, 0x55, 0x71, 0x1b, 0x5f, 0x83, 0x3c, 0xaf, 0xa7, 0x9c, 0x16, 0x9d, 0xe0, 0x54, 0x93, 0x5d, 0xaa, 0x2a, 0xef, 0xff, 0x6b, 0x4a, 0xfa, 0x39, 0x08, 0xcb, 0x97, 0x8b, 0x86, 0x2c, 0x60, 0xa0, 0xac, 0x4e, 0x7a, 0xc9, 0xd3, 0x1e, 0xee, 0xbb, 0x9b, 0x09, 0xca, 0x33, 0x9e, 0x0d, 0xbe, 0x75, 0x9a, 0x29, 0xf7, 0x88, 0xdd, 0x5c, 0x7e, 0xa3, 0x58, 0x94, 0x00, 0x74, 0xad, 0x17, 0x07, 0x84, 0x7c, 0x63, 0x76, 0xb6, 0x1c, 0xa1, 0xb8, 0x79, 0xf0, 0xf9, 0xb3, 0x98, 0x3e, 0xeb, 0x8a, 0x5e, 0x6e, 0x6a, 0x70, 0x7d, 0xc8, 0xa4, 0x01, 0x42, 0x2f, 0xd9, 0x2b, 0xf1, 0x90, 0x44, 0xea, 0xa6, 0xcd, 0x72, 0x18, 0x91, 0x22, 0xf4, 0x03, 0x2d, 0xe1, 0xb0, 0xda, 0xb1, 0x6d, 0xe6, 0x37, 0xc0, 0xfb, 0x65, 0x8d, 0xe9, 0xfe, 0x28, 0xfc, 0x47, 0xd2, 0xe4, 0xdf, 0x19, 0x4d, 0x8e, 0x80, 0x56, 0x1d, 0x21, 0xc1, 0x82, 0xc2, 0x27, 0x7b, 0x24, 0xa8, 0x8c, 0x11, 0x43, 0xd8, 0xdc, 0xb7, 0x48, 0x85, 0x30, 0xf5, 0x0e, 0xd4, 0x89, 0x4b, 0x0c, 0x45, 0x87, 0x04, 0x0b, 0xfd, 0x53, 0xd5, 0xf6, 0x06, 0xcf, 0xf2, 0xe7, 0x51, 0xe5, 0x50, 0x25, 0xed, 0x12, 0x4f, 0x20, 0x96, 0x81, 0xae, 0x8f, 0xd0, 0x36, 0xc6, 0x3b, 0x1a, 0xb5, 0xa2, 0x13, 0x1f, 0x2e, 0x0f, 0x34, 0x9f, 0x61, 0x05, 0x0a, 0xbf, 0xc7, 0x10, 0xa9, 0x23, 0x15, 0x5b, 0xf8, 0x6c, 0xd6, 0xb4, 0xab, 0x49, 0x5a, 0x6f, 0xb2, 0x02, 0x59, 0x92, 0x73, 0xde, 0x3f, 0x3d, 0x46, 0x57, 0xe8, 0x77, 0xcc, 0xa5, 0x3a, 0x62, 0x69, 0x35, 0xec, 0x26, 0x52, 0x7f, 0xc4, 0xe3, 0x40, 0xbd, 0x32 }; // struct prototypes typedef struct _table_e table_e; typedef struct _itable_t itable_t; typedef struct _list_e list_e; typedef struct _list_t list_t; typedef struct _map_t map_t; typedef struct _smap_t smap_t; typedef struct _gui_t gui_t; typedef struct _cvar_t cvar_t; typedef struct _ccmd_t ccmd_t; typedef struct _chunk_t chunk_t; typedef struct _world_t world_t; typedef struct _geometry_t geometry_t; typedef struct _bank_voice bank_voice; typedef struct _bank_key bank_key; typedef struct _bank_channel bank_channel; typedef struct _bank_handle bank_handle; typedef struct _opl3_slot opl3_slot; typedef struct _opl3_channel opl3_channel; typedef struct _opl3_chip opl3_chip; typedef struct _window_t window_t; typedef struct _monitor_t monitor_t; typedef struct _cursor_t cursor_t; // function types typedef uint map_hashfunc(void*); typedef byte map_eqfunc(void*, void*); typedef void gui_func(gui_t*, int); typedef void clear_func(void*); typedef byte clear_sfunc(void*); typedef void cvar_func(cvar_t*, int); typedef void ccmd_func(ccmd_t*, const char**, int); typedef byte (*cvar_parse_func)(const char *, int *); typedef void (*cvar_fmt_func)(char *, int); typedef void shd_func(); typedef void shd_dfunc(void*); typedef short(*envelope_sinfunc)(ushort phase, ushort envelope); typedef void(*envelope_genfunc)(opl3_slot *slott); typedef float graph_func(void*, float); typedef float graph2_func(void*, float, float); typedef byte gui_initfnc(window_t*, int, int, byte); // structs typedef struct { char spec; char arg; int min; int max; int *value; char **str; const char *name; } arg_t; typedef struct { uint arg_min; uint arg_max; uint arg_count; arg_t *arg_vec; } argp_t; struct _table_e { table_e *u_next; table_e *u_prev; table_e *f_next; table_e *f_prev; // void *value; uint cid; uint eid; }; struct _itable_t { table_e *elems; void **data; uint *sizes; table_e *used; table_e *free; uint size; uint load; uint chunks; uint stride; uint alloc; uint stored; byte cat; byte pad[7]; }; typedef struct { itable_t *nodes; uint load; uint block; uint stride; uint size; uint stored; byte cat; byte pad[3]; } table_t; struct _list_e { list_e *u_next; list_e *u_prev; list_e *f_next; list_e *f_prev; uint id; uint pad; }; struct _list_t { list_e *elems; list_e *used; list_e *free; uint size; uint stored; }; struct _map_t { map_hashfunc *hash_func; map_eqfunc *eq_func; void **elems; uint load; uint stored; byte cat; byte pad[7]; }; struct _smap_t { void *elems[27]; uint load; uint stored; byte cat; byte pad[7]; }; typedef struct { uint *id; const char *path; ushort width; ushort height; byte filter; byte mipmap; byte fallback; byte system; } tex_t; typedef struct { uint *vao; uint *vbo; uint size; byte stride; byte groups; byte dynamic; byte system; } buf_t; typedef struct { uint *fbo; uint *tex; uint *rbo; window_t *resize; int xsize; int ysize; byte linear; byte pad[7]; } fbo_t; typedef struct { const char *vpath; const char *fpath; shd_func *init; shd_dfunc *draw; uint id; uint pad; } shd_t; typedef struct { byte s; byte t; byte u; byte v; } fchar_t; typedef struct { uint textures[UNI_MAX_PAGES]; fchar_t *sizes[UNI_MAX_PAGES]; int xsize; int ysize; int xglyph; int yglyph; } font_t; struct _gui_t { window_t *window; gui_func *func; gui_func *format; font_t *font; char *text; const char *format_text; void *aux_data; const char ***format_data; cvar_t *cv_data; uint color_fill_t; uint color_fill_b; uint color_brdr_t; uint color_brdr_b; uint color_text; int border; uint texture; int font_size; int pos_x; int pos_y; int size_x; int size_y; int text_x; int text_y; int tsize_x; int tsize_y; int margin_x1; // slider fill top int margin_y1; // slider fill bottom int margin_x2; // slider border top int margin_y2; // slider border bottom int sel_start; // slider handle pos int sel_end; // slider handle width int sel_drag; // slider border int capacity; int value; int def; int min; int max; int line_space; int id; byte type; byte visible; byte enabled; byte t_dirty; byte r_dirty; byte pad; byte xbreak; byte precision; }; typedef struct { const char *name; uint brdr_top; uint brdr_btm; uint wbrdr_top; uint wbrdr_btm; uint win_top; uint win_btm; uint fill_top; uint fill_btm; uint field_top; uint field_btm; uint text_label; uint text_base; uint text_field; uint text_win; int slider_width; int border; uint bg_top; uint bg_btm; uint press_top; uint press_btm; uint hover_top; uint hover_btm; uint select; uint cursor; } style_t; typedef struct { int key; byte id; byte pressed; byte active; byte last_state; } bind_t; struct _cvar_t { const char *name; cvar_func *func; void *data; void *aux_data; int value; int def; int min; int max; int id; byte readonly; byte type; byte category; byte startup; }; struct _ccmd_t { const char *name; const char *args; ccmd_func *func; int id; ushort min; ushort max; }; typedef struct { int width; int height; int refresh; int pad; } vidmode_t; struct _window_t { window_t* next; monitor_t* monitor; cursor_t* cursor; gui_t *selected; const char *title; gui_initfnc *initializer; world_t *world; ulong tmr_scroll; ulong tmr_leftmb; uint fb_gui; uint fbtex_gui; int video_width; int video_height; int video_refresh; int pad1; int minwidth; int minheight; int maxwidth; int maxheight; int width; int height; int xpos; int ypos; int last_cur_x; int last_cur_y; int warp_cur_x; int warp_cur_y; int virtual_cur_x; int virtual_cur_y; int scrollx; int scrolly; int min_x; int min_y; int max_x; int max_y; int n_elems; int mouse_clickx; int mouse_clicky; int offset_x; int offset_y; int frame_x; int frame_y; int mouse_x; int mouse_y; int xsize; int ysize; int saved_xpos; int saved_ypos; int fb_x; int fb_y; byte resizable; byte floating; byte override_redir; byte iconified; byte cursor_set; byte redraw; byte open; byte queue; byte drag_x; byte drag_y; byte focused; byte mouse; byte scroll; byte pad2[3]; gui_t elems[GUI_MAX_ELEM]; char strings[GUI_STR_SIZE*GUI_MAX_ELEM]; char str_aux[GUI_AUX_STR]; char buttons[MOUSE_BTNS]; char keys[KEYSYM_LAST + 1]; Time key_times[256]; GLXWindow window; Colormap colormap; Window handle; Window parent; XIC ic; }; struct _monitor_t { window_t* window; vidmode_t* modes; int n_modes; int index; vidmode_t current_mode; RROutput output; RRCrtc crtc; RRMode old_mode; }; struct _cursor_t { cursor_t* next; Cursor handle; }; typedef struct { char *message; window_t *window; ulong time; int offset; int length; } conmsg_t; typedef struct { void *buffer; short command; short address; uint param; } snd_cmd_t; typedef struct { vec3 front; vec3 up; vec3 right; vec3 world_up; double pos_x; double pos_y; double pos_z; float yaw; float pitch; float zoom; float pad; } camera_t; typedef struct { double x1; double y1; double z1; double x2; double y2; double z2; } bbox_t; typedef struct { double pos_x; double pos_y; double pos_z; double motion_x; double motion_y; double motion_z; double width; double height; double jump_motion; double fly_base_speed; double walk_base_speed; double air_base_speed; double fly_speed; double walk_speed; double air_speed; double speed; bbox_t box; double forward; double strafe; double eye; double rot_yaw; double step_height; double fall_distance; double last_x; double last_y; double last_z; float yaw; float pitch; int fly_timer; int jump_ticks; byte jump; byte sprint; byte sneak; byte use; byte blocked; byte braked; byte pad[2]; byte first_tick; byte last_jump; byte flying; byte sprinting; byte ground; byte collided; byte collided_h; byte collided_v; world_t *world; } entity_t; typedef struct { shd_t *shader; uint texture; float density; uint spec_color; float shine; } material_t; typedef struct { uint color; float amb_fact; float dif_fact; float range_xz; float range_y; float constant; float linear; float quadratic; } light_b; typedef struct { vec3 pos; vec2 coord; } vertex_b; typedef struct { vertex_b vertices[3]; float pad; material_t *material; } polygon_b; typedef struct { vec3 pos; float pad1; vec3 ambient; float constant; vec3 diffuse; float linear; vec3 specular; float quadratic; vec3 range; float pad2; ulong id; } light_t; typedef struct { vec3 pos; vec3 normal; vec2 coord; } vertex_t; typedef struct { vertex_t vertices[3]; material_t *material; uint next; uint pad; } polygon_t; struct _geometry_t { geometry_t **global; bbox_t collision; ulong id; uint polys; int chunk_x; int chunk_y; int chunk_z; }; typedef struct { material_t *material; int size; int offset; } draw_t; typedef struct { uint vao; uint vbo; draw_t *draws; buf_t *bind; int size; vec3 position; } drawlist_t; struct _chunk_t { table_t obj_table; table_t light_table; list_t poly_list; bbox_t box; world_t *world; polygon_t *poly_pool; drawlist_t *drawlist; chunk_t *next_dirty; int x; int y; int z; int size; byte dirty; byte pad[7]; }; struct _world_t { chunk_t *dirty_first; chunk_t *dirty_queue; entity_t *entity; shd_t *shader; fbo_t *post_buf; ulong pointed; ulong obj_id; double gravity; double friction; vec3 look_pos; uint fb_post; uint fbtex_post; uint rbo_post; uint light_buf; int s_lights; int n_chunks; int n_objects; int n_lights; int last_cx; int last_cy; int last_cz; byte light_dirty; byte chunks_dirty; byte noclip; byte camonly; table_t global_geom; table_t chunk_table; map_t chunk_map; map_t obj_map; camera_t camera; entity_t entity_base; }; typedef struct { FILE *fd; const char *filename; byte buffer[8]; uint samplerate; uint samples; ushort channels; ushort bytes; ushort pad[2]; } wav_handle; typedef struct { byte *buffer; uint size; uint pos; byte status; byte ending; uint wait; ushort trknum; } mid_track; typedef struct { mid_track *track; ushort tracks; uint tpqn; uint uspb; uint ticktime; } mid_handle; typedef struct { byte tremolo; byte vibrato; byte sustaining; byte ksr; byte mult; byte ksl; byte level; byte attack; byte decay; byte sustain; byte release; byte waveform; } bank_operator; typedef struct { bank_operator ops[2]; short detune; short offset; byte feedback; byte am; } bank_pair; typedef struct { bank_pair channels[2]; byte op; byte fixed; byte percnum; char name[32]; } bank_instr; struct _bank_voice { bank_channel *channel; opl3_channel *opl; byte note; byte op; short detune; bank_voice *pair; }; struct _bank_key { byte note; byte velocity; bank_voice *voice; }; struct _bank_channel { bank_handle *bank; bank_key keys[BANK_MAX]; byte notes[128]; byte keyindex; byte active; ushort pbank; char pan; byte volume; short pitch; byte program; bank_instr *instr; byte ch_num; }; struct _bank_handle { bank_channel channel[16]; bank_voice *voices; bank_instr *bdata; ushort voiceindex; ushort v_avail; ushort v_used; byte flags; char velo_func; }; struct _opl3_slot { opl3_channel *channel; opl3_chip *chip; short out; short fbmod; short *mod; short prout; ushort eg_rout; ushort eg_out; // byte eg_inc; byte eg_gen; // byte eg_rate; byte eg_ksl; byte *trem; byte reg_vib; byte reg_type; byte reg_ksr; byte reg_mult; byte reg_ksl; byte reg_tl; byte reg_ar; byte reg_dr; byte reg_sl; byte reg_rr; byte reg_wf; byte key; byte detrigger; byte retrigger; uint pg_reset; uint pg_phase; ushort pg_phase_out; byte slot_num; }; struct _opl3_channel { opl3_slot *slots[2]; opl3_channel *pair; opl3_chip *chip; short *out[4]; int level[2]; byte chtype; ushort f_num; byte block; byte fb; byte con; byte alg; byte ksv; byte ch_num; }; struct _opl3_chip { opl3_channel *channel; opl3_slot *slot; ushort timer; ulong eg_timer; byte eg_timerrem; byte eg_state; byte eg_add; byte nts; byte vibpos; byte vibshift; byte tremolo; byte tremolopos; byte tremoloshift; byte n_voices; uint noise; short zeromod; int mixbuff[4]; int rateratio; int samplecnt; short oldsamples[2]; short samples[2]; }; typedef struct { window_t *console; const char *cfg_file; style_t *style_def; window_t *keywin; window_t *win_full; ulong mem_pool_sizes[MEM_CATS]; ulong mem_pool_blocks[MEM_CATS]; ulong mem_alloc; ulong mem_blocks; ulong mem_peak; ulong sync_limit; ulong tmr_timer; ulong tmr_start; ulong tmr_current; ulong tmr_last; ulong tmr_delta; ulong tmr_update; ulong tmr_frames; ulong tmr_iters; ulong tmr_stime; ulong tmr_etime; ulong tmr_ttime; ulong tmr_ftime; ulong tmr_dtime; ulong tmr_atime; ulong tick_torun; ulong tick_done; ulong tick_total; ulong tick_time; ulong tick_stime; ulong tick_ftime; ulong tick_ttime; ulong tick_update; ulong rng_uniq; double tick_fraction; ulong tmr_profile[PERF_SECTIONS*2]; ulong tmr_total[PERF_SECTIONS]; float tmr_framerate; float tick_tickrate; float fdelta; float sensitivity; float speed; int n_cvars; int key_release; int log_len; int n_modes; int vid_mode; int n_ccmds; int tick_target; int tick_timeout; int win_xfull; int win_yfull; int win_refresh; int font_pages; int tick_frame; int dclick_delay; int hud_pos; int hud_size; int hud_fadeout; int hud_len; byte hud_overlay; byte hud_bottom; byte hud_opacity; byte mouse_first; byte input; byte mouse_bind; byte nograb; byte cfg_dirty; byte ticked; byte win_vsync; byte sync_limited; byte interrupted; byte screenshot; byte draw_fps; byte draw_debug; byte gl_flush; byte log_level; byte log_set; byte perf_pos; byte perf_swap; byte keywait; byte con_timestamps; byte con_autoscroll; bind_t binds[KEY_MAXBINDS]; font_t font; cvar_t cvars[CVAR_MAX]; ccmd_t ccmds[CCMD_MAX]; smap_t cvar_map; smap_t ccmd_map; vidmode_t vid_modes[VID_MODES]; conmsg_t hud_msgs[HUD_MSGS]; bbox_t collision_list[COLL_MAX]; style_t style; table_t themes; const char *str_format[LOCALE_SIZE]; char log_buf[LOG_BUF]; char work_buf[WORK_BUF]; char con_buf[CON_BUF]; char con_line[CON_LINE]; char con_tok[CON_LINE]; char *con_arg[CON_LINE / 2]; char hud_buf[HUD_BUF]; char str_table[LOCALE_SIZE*LOCALE_ELEM]; char vid_mode_list[VID_MODES*VID_MODE_STR]; } sys_t; typedef struct { shd_t *shd_rect; shd_t *shd_text; shd_t *shd_blit; shd_t *shd_world; shd_t *shd_vis; shd_t *shd_grid; uint aux_colors[8]; uint shader; uint vbo_quad; uint vao_quad; uint tex_fallback; uint tex_logo; uint tex_crosshair; float clear_r; float clear_g; float clear_b; float clear_a; float clip_near; float clip_far; float aniso_max; float tex_aniso; float fov; float light_blend; float light_dist_vert; float light_dist_cam; float ambient_x; float ambient_y; float ambient_z; byte tex_miptype; byte tex_miplevel; byte tex_filter; byte wireframe; byte post; // byte aniso_avail; ulong tex_mem; ulong tex_peak; ulong buf_mem; ulong buf_peak; ulong fb_mem; ulong fb_peak; int light_dist_chunk; int ldist_chunk_xz; int ldist_chunk_y; int light_max; int tex_loaded; int shd_loaded; int buf_loaded; int fb_loaded; int lists_drawn; int tris_drawn; table_t textures; table_t buffers; table_t shaders; table_t framebufs; table_t drawlists; table_t materials; char shd_include[SHD_INCLUDE]; } gfx_t; typedef struct { pthread_t thread; pthread_mutex_t lock; pthread_mutex_t log_lock; ulong mid_time; uint cmd_push; uint cmd_queue; uint log_push; uint log_queue; uint log_pop; uint query; uint mid_tick; byte waiting; byte disabled; byte pad1[2]; snd_cmd_t cmds[SND_QUEUE]; char logs[SND_LOG * SND_LOG_LEN]; byte interrupt; byte playing; byte nowait; byte paused; byte stopped; byte log_debug; byte capture; ushort volumes[SND_VOLUMES]; wav_handle wav; mid_handle mid; opl3_chip *chip; bank_handle *bank; bank_instr ibank[256]; } isnd_t; typedef struct { window_t *player; ulong mid_poll; char **mid_queue; char *mid_list; byte mid_nowait; byte mid_repeat; byte mid_bank; int mid_queued; int mid_playpos; int mid_prevpos; byte mid_keep; byte mid_unknown; byte mid_visual; int mid_velo; int mid_voices; byte mid_debug; byte mid_karaoke; uint mid_klog_pos; uint mid_klog_offs; uint mid_info_offs[6]; char mid_klogger[SND_KLOG * SND_KAR]; char mid_info[SND_INFO * 6]; } snd_t; typedef struct { cursor_t* cursor_list; window_t* window_list; window_t* current; window_t* active; window_t* grab_cur_window; Display* display; void* handle; char* primary_str; char* clipboard_str; monitor_t** monitors; int n_monitors; int screen; int major; int minor; int event_base; int error_base; int restore_cur_x; int restore_cur_y; int error_code; int depth; byte debug; byte pad1[7]; char keycodes[256]; Window root; Window helper_window; Cursor empty_cursor; XContext context; XIM im; XErrorHandler error_handler; Visual* visual; GLXFBConfig native; GLXContext glx; // Window manager atoms Atom NET_SUPPORTED; Atom NET_SUPPORTING_WM_CHECK; Atom WM_PROTOCOLS; Atom WM_STATE; Atom WM_DELETE_WINDOW; Atom NET_WM_NAME; Atom NET_WM_ICON_NAME; Atom NET_WM_ICON; Atom NET_WM_PID; Atom NET_WM_PING; Atom NET_WM_WINDOW_TYPE; Atom NET_WM_WINDOW_TYPE_NORMAL; Atom NET_WM_STATE; Atom NET_WM_STATE_ABOVE; Atom NET_WM_STATE_FULLSCREEN; Atom NET_WM_BYPASS_COMPOSITOR; Atom NET_WM_FULLSCREEN_MONITORS; Atom NET_WM_WINDOW_OPACITY; Atom NET_WM_CM_Sx; Atom NET_CURRENT_DESKTOP; Atom NET_ACTIVE_WINDOW; Atom NET_FRAME_EXTENTS; Atom NET_REQUEST_FRAME_EXTENTS; Atom MOTIF_WM_HINTS; // Xdnd (drag and drop) atoms Atom XdndAware; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; Atom XdndActionCopy; Atom XdndDrop; Atom XdndFinished; Atom XdndSelection; Atom XdndTypeList; Atom text_uri_list; // Selection (clipboard) atoms Atom TARGETS; Atom MULTIPLE; Atom INCR; Atom CLIPBOARD; Atom PRIMARY; Atom CLIPBOARD_MANAGER; Atom SAVE_TARGETS; Atom NULL_; Atom UTF8_STRING; Atom COMPOUND_STRING; Atom ATOM_PAIR; Atom WCF_SELECTION; // GLX 1.3 functions PFNGLXGETFBCONFIGSPROC GetFBConfigs; PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib; PFNGLXGETCLIENTSTRINGPROC GetClientString; PFNGLXQUERYEXTENSIONPROC QueryExtension; PFNGLXQUERYVERSIONPROC QueryVersion; PFNGLXDESTROYCONTEXTPROC DestroyContext; PFNGLXMAKECURRENTPROC MakeCurrent; PFNGLXSWAPBUFFERSPROC SwapBuffers; PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString; PFNGLXCREATENEWCONTEXTPROC CreateNewContext; PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig; PFNGLXCREATEWINDOWPROC CreateWindow; PFNGLXDESTROYWINDOWPROC DestroyWindow; // GLX 1.4 and extension functions PFNGLXGETPROCADDRESSPROC GetProcAddress; PFNGLXGETPROCADDRESSPROC GetProcAddressARB; PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; byte SGI_swap_control; byte EXT_swap_control; byte MESA_swap_control; byte ARB_multisample; // byte ARB_create_context_no_error; byte pad2[4]; struct { byte available; byte monitor_broken; void* handle; int event_base; int error_base; int major; int minor; PFN_XRRFreeCrtcInfo FreeCrtcInfo; PFN_XRRFreeOutputInfo FreeOutputInfo; PFN_XRRFreeScreenResources FreeScreenResources; PFN_XRRGetCrtcInfo GetCrtcInfo; PFN_XRRGetOutputInfo GetOutputInfo; PFN_XRRGetOutputPrimary GetOutputPrimary; PFN_XRRGetScreenResourcesCurrent GetScreenResourcesCurrent; PFN_XRRQueryExtension QueryExtension; PFN_XRRQueryVersion QueryVersion; PFN_XRRSelectInput SelectInput; PFN_XRRSetCrtcConfig SetCrtcConfig; PFN_XRRUpdateConfiguration UpdateConfiguration; } randr; struct { byte available; byte detectable; int major_opcode; int event_base; int error_base; int major; int minor; uint group; } xkb; struct { int version; Window source; Atom format; } xdnd; struct { void* handle; PFN_XcursorImageCreate ImageCreate; PFN_XcursorImageDestroy ImageDestroy; PFN_XcursorImageLoadCursor ImageLoadCursor; } xcursor; struct { byte available; void* handle; int major; int minor; PFN_XineramaIsActive IsActive; PFN_XineramaQueryExtension QueryExtension; PFN_XineramaQueryScreens QueryScreens; } xinerama; struct { void* handle; PFN_XGetXCBConnection GetXCBConnection; } x11xcb; struct { byte available; void* handle; int event_base; int error_base; PFN_XF86VidModeQueryExtension QueryExtension; } vidmode; struct { byte available; void* handle; int major_opcode; int event_base; int error_base; int major; int minor; PFN_XIQueryVersion QueryVersion; PFN_XISelectEvents SelectEvents; } xi; struct { byte available; void* handle; int major; int minor; int event_base; int error_base; PFN_XRenderQueryExtension QueryExtension; PFN_XRenderQueryVersion QueryVersion; PFN_XRenderFindVisualFormat FindVisualFormat; } xrender; } wcf_t; // global state sys_t sys; gfx_t gdr; isnd_t sgt; snd_t snd; wcf_t wcf;