Archived
1
0
Fork 0
This repository has been archived on 2025-09-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
skcblitz/program.c

215 lines
6.1 KiB
C
Raw Normal View History

2025-09-02 14:43:36 +02:00
/*
Een net ganz funktionierndes Programm ...
Absolute Mindestanforderungen:
Prozessor : Intel Core i3 530 oder AMD Phenom 2 X2 545
Grafikkarte : NVIDIA GeForce GTS 450 oder AMD Radeon HD 7730
Arbeitsspeicher : Etwa 512 MB ~ 1 GB, 2 - 4 GB empfohlen
Mainboard : Was gerade passt (auch mit Hammer)
Kühler : Ne Klimaanlage oder ordentlich Pusten
Festplatte : Richtet sich nach der Geduld des Nutzers
Netzteil : Atomkraftwerk oder stabiler Energiekern
Gehäuse : Pappkarton, Bierkasten oder auch gar keins
Tastatur : Hlb fktonrnd odr bsr
Maus : Aus Plastik oder mit extra Quietsch-Effekt
Monitor : Olle Röhre oder gebrochener Flachbild (Mindestens 1280x800)
Stuhl : Interessiert niemanden (sonst siehe Gehäuse)
[[oder einfach einen Toaster mit nem LCD und Maus]]
*/
#if !defined(__x86_64) && !defined(__amd64) && !defined(_M_AMD64)
#error "Programm erfordert die Prozessor-Architektur x86_64 ('AMD64' / 'Intel 64')"
#endif
#if !defined(__SSE__)
#error "Die x86_64-Erweiterung SSE ist nicht vorhanden"
#endif
#if !defined(__SSE2__)
#error "Die x86_64-Erweiterung SSE2 ist nicht vorhanden"
#endif
#if !defined(__linux__) && !defined(__gnu_linux__) && !defined(__linux) && !defined(linux)
#error "Programm unterstützt nur Linux als das System / ABI"
#endif
#define SYS_PROGNAME "SKCBlitz"
#define SYS_INFO \
COL_GREEN SYM_BUG SYM_BUG SYM_BUG " " COL_VIOLET FMT_FADE SYS_PROGRAM_FULL FMT_RESET COL_GREEN " " SYM_BUG SYM_BUG SYM_BUG "\n"\
"\n"\
COL_LGRAY "Ein kleine Anwendung zur Simulation, zum Testen, für Spiele, Musik und vieles" "\n"\
"mehr. Optimiert für Geschwindigkeit, Stabilität und" STR_UNK STR_UNK " [Speicherzugriffsfehler]" "\n"\
"\n"\
COL_CYAN "Geschrieben von Sen dem \"kleinen\" Dämonen " COL_CRIMSON SYM_DEMON COL_BLACK SYM_BLKHEART "\n"\
"\n"\
COL_YELLOW "Verwendete Programmbibliotheken:" "\n"\
COL_LGRAY " -> " COL_NEON "axe_ork (Modifiziert: GLFW 3.3.8)" "\n"\
COL_LGRAY " -> " COL_NEON "tcglm (Modifiziert: cglm 0.8.9)" "\n"\
COL_LGRAY " -> " COL_NEON "stb_timage (Modifiziert: stb_image 2.28 + stb_image_write 1.16)" "\n"\
COL_LGRAY " -> " COL_NEON "gl_loader (Modifiziert: glad 0.1.34)" "\n"\
COL_LGRAY " -> " COL_NEON "opl3 (Modifiziert: Nuked-OPL3 f2c9873)" "\n"\
"\n"\
COL_YELLOW "Verwendeter Compiler: " "\n"\
COL_LGRAY " -> " COL_NEON BUILD_COMP "\n"\
"\n"\
COL_YELLOW "Kompiliert auf System: " "\n"\
COL_LGRAY " -> " COL_NEON BUILD_SYS "\n"\
"\n"\
"\n"\
COL_BLACK "#0 " COL_DGRAY "#1 " COL_GRAY "#2 " COL_LGRAY "#3 " COL_WHITE "#4 " COL_RED "#5 " COL_GREEN "#6 " COL_BLUE "#7 " \
COL_YELLOW "#8 " COL_MAGENTA "#9 " COL_CYAN "#A " COL_VIOLET "#B " COL_ORANGE "#C " COL_CRIMSON "#D " COL_MIDNIGHT "#E " COL_NEON "#F " \
COL_LGRAY FMT_ULINE "#G" FMT_RESET " " COL_YELLOW FMT_CLINE "#H" FMT_RESET " " COL_DGRAY FMT_BLINK "#I" FMT_RESET " " COL_BLACK FMT_FADE "#J" FMT_RESET
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <signal.h>
#include <errno.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include <execinfo.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#include <locale.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pthread.h>
#include <alsa/asoundlib.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xcursor/Xcursor.h>
#include <X11/extensions/Xrandr.h>
#include <X11/XKBlib.h>
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/XInput2.h>
#include <X11/Xresource.h>
#include <X11/Xmd.h>
#include <xmmintrin.h>
#include <emmintrin.h>
#include "inttypes.h"
#include "x11_stub.h"
#include "glx_stub.h"
#include "system.h"
#include "gl_types.h"
#include "gl_constants.h"
#include "types.h"
#include "tcglm.h"
#include "stb_timage.h"
#include "argparse.h"
#include "str.h"
#include "list.h"
#include "table.h"
#include "map.h"
#include "smap.h"
#include "locale.h"
#include "locale.h"
#include "locale.h"
#include "locale.h"
#include "timing.h"
#include "log.h"
#include "gl_loader.h"
#include "gl_loader.h"
#include "mem.h"
#include "files.h"
#include "random.h"
#include "noise.h"
#include "texture.h"
#include "shader.h"
#include "buffer.h"
#include "framebuf.h"
#include "strdraw.h"
#include "strdraw.h"
#include "strdraw.h"
#include "strdraw.h"
#include "strdraw.h"
#include "camera.h"
#include "bbox.h"
#include "entity.h"
#include "lighting.h"
#include "cvar.h"
#include "console.h"
#include "render.h"
#include "drawlist.h"
#include "world.h"
#include "axe_ork.h"
#include "gui.h"
#include "window.h"
#include "opl3.h"
#include "dmx.h"
#include "bank.h"
#include "midi.h"
#include "alsasnd.h"
#include "wavfile.h"
#include "sound.h"
#include "player.h"
#include "program.h"
int main(int argc, char **argv) {
SIZE_TEST(void*, 64);
SIZE_TEST(byte, 8);
SIZE_TEST(char, 8);
SIZE_TEST(ushort, 16);
SIZE_TEST(short, 16);
SIZE_TEST(uint, 32);
SIZE_TEST(int, 32);
SIZE_TEST(ulong, 64);
SIZE_TEST(long, 64);
SIZE_TEST(float, 32);
SIZE_TEST(double, 64);
SIZE_TEST(light_t, 704);
uint cpuid;
asm volatile("cpuid" : "=d" (cpuid) : "0" (1));
sys_assert((cpuid & 0x6000000) == 0x6000000);
int loglevel = 0xff;
char *cfgfile = "skc.cfg";
char *langfile = NULL;
int gldebug = 0;
int nosound = 0;
int version = 0;
int n_cmds = 0;
char **cmds = malloc(sizeof(char*) * argc);
argp_t *argspec = arg_alloc(7);
arg_add_vstr(argspec, ARGSTR_COMMANDS, 0, cmds, &n_cmds);
arg_add_bool(argspec, 'v', ARGSTR_VERSION, &version);
arg_add_int(argspec, 'l', ARGSTR_LOGLEVEL, LOG_SILENT, LOG_TRACE, &loglevel);
arg_add_bool(argspec, 'g', ARGSTR_GLDEBUG, &gldebug);
arg_add_bool(argspec, 's', ARGSTR_NOSOUND, &nosound);
arg_add_str(argspec, 'c', ARGSTR_CONFIG, &cfgfile);
arg_add_str(argspec, 't', ARGSTR_LANG, &langfile);
if(!arg_parse(argspec, argc, argv)) {
free(cmds);
return -1;
}
if(version) {
fprintf(stderr, SYS_PROGRAM_FULL "\n* " BUILD_COMP "\n* " BUILD_SYS "\n");
free(cmds);
return 0;
}
if(!init(cfgfile, langfile, loglevel, gldebug, nosound)) {
free(cmds);
return 1;
}
start(cmds, n_cmds);
free(cmds);
run();
finish();
return 0;
}