added nix build stuff
This commit is contained in:
parent
9c7ccfe0b0
commit
b208382e60
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
TARGET = quest
|
||||
LIBS = -lm -luiohook -lcjson
|
||||
LIBS = -lm -luiohook -lcjson -lxcb -lXinerama -lX11
|
||||
CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
INSTALL_PATH = /usr/local
|
||||
|
2
default.nix
Normal file
2
default.nix
Normal file
@ -0,0 +1,2 @@
|
||||
{pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.callPackage ./derivation.nix {}
|
23
derivation.nix
Normal file
23
derivation.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{ stdenv }:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "quest-${version}";
|
||||
version = "0.7";
|
||||
|
||||
src = ./src2/.;
|
||||
|
||||
nativeBuildInputs = [ ];
|
||||
buildInputs = [ ];
|
||||
|
||||
buildPhase = ''
|
||||
gcc server.c -o quest-daemon
|
||||
gcc client.c -o quest-log
|
||||
gcc tui.c -o quest
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp quest-daemon $out/bin
|
||||
cp quest-log $out/bin
|
||||
cp quest $out/bin
|
||||
'';
|
||||
}
|
@ -102,9 +102,9 @@ Runs by themselves are simply a list of events that occured
|
||||
to this data, these more complicated directives are used to define segments
|
||||
that are played between splits and routes made up of these segments.
|
||||
Define all your possible segments first, followed by all routes.
|
||||
If no segments are defined, a single unnamed segment is assumed.
|
||||
If no segments are defined, a single unnamed segment is to be assumed.
|
||||
If no routes are defined, a single unnamed route that passes through all
|
||||
segments in the order of their definition is assumed.
|
||||
segments in the order of their definition is to be assumed.
|
||||
|
||||
Segment
|
||||
Shortname
|
||||
@ -141,7 +141,7 @@ Run Directives
|
||||
These directives are much more complicated and are not intended to be written
|
||||
by a human but rather by the timer software, they will make up the majority
|
||||
of a file as they are the run history which may be quite long.
|
||||
These data passed by these directives exists agnostic of segments, route, games,
|
||||
The data passed by these directives exists agnostic of segments, route, games,
|
||||
or categories, rather they are either explicitly matched with metadata that is
|
||||
applicable, or by default is matched with the last set of metadata declared by
|
||||
the time of the run directive
|
||||
|
@ -22,6 +22,7 @@ struct pastseg *pastRuns;
|
||||
int segCount;
|
||||
int currSeg = -1;
|
||||
char currentTime[10];
|
||||
int *route;
|
||||
|
||||
void sub_timespec(struct timespec t1, struct timespec t2, struct timespec* td)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
struct segment
|
||||
{
|
||||
int id;
|
||||
char *name;
|
||||
int ms;
|
||||
bool isSkipped;
|
||||
@ -49,6 +50,7 @@ extern struct segment *bestsegs;
|
||||
extern struct segment *wrrun;
|
||||
extern struct segment *segments;
|
||||
extern struct timespec notif;
|
||||
extern int *route;
|
||||
|
||||
void sub_timespec(struct timespec t1, struct timespec t2, struct timespec* td);
|
||||
void add_timespec(struct timespec t1, struct timespec t2, struct timespec* td);
|
||||
|
@ -220,10 +220,12 @@ void loadFiles()
|
||||
fgets(buff2, 255, fp);
|
||||
if (buff2[0] == '\t') {
|
||||
valuecount++;
|
||||
|
||||
names = realloc(names, sizeof(char*) * valuecount);
|
||||
names[valuecount - 1] = malloc(strlen(buff) - 1);
|
||||
strncpy(names[valuecount - 1], buff, strlen(buff) - 1);
|
||||
names[valuecount - 1][strlen(buff)] = '\0';
|
||||
|
||||
values = realloc(values, sizeof(char*) * valuecount);
|
||||
values[valuecount - 1] = malloc(strlen(buff2) - 2);
|
||||
strncpy(values[valuecount - 1], buff2 + 1, strlen(buff2) - 1);
|
||||
@ -373,43 +375,18 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Now start listening for the clients, here
|
||||
* process will go in sleep mode and will wait
|
||||
* for the incoming connection
|
||||
*/
|
||||
|
||||
listen(sockfd,5);
|
||||
clilen = sizeof(cli_addr);
|
||||
|
||||
while (alive) {
|
||||
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
|
||||
|
||||
if (newsockfd < 0) {
|
||||
perror("ERROR on accept");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Create child process */
|
||||
//pid = fork();
|
||||
pid = 1;
|
||||
|
||||
if (pid < 0) {
|
||||
perror("ERROR on fork");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
/* This is the child process */
|
||||
//close(sockfd);
|
||||
//doprocessing(newsockfd);
|
||||
//exit(0);
|
||||
}
|
||||
else {
|
||||
doprocessing(newsockfd);
|
||||
close(newsockfd);
|
||||
}
|
||||
|
||||
} /* end of while */
|
||||
doprocessing(newsockfd);
|
||||
close(newsockfd);
|
||||
}
|
||||
free(run);
|
||||
close(sockfd);
|
||||
}
|
||||
|
37
src2/tui.c
37
src2/tui.c
@ -67,30 +67,19 @@ void printbig(int x, int y, int ms)
|
||||
printf("\033[%d;%dH", y + sy, x); //go to position
|
||||
for (int cc = 0; cc < 12; cc++) { //then, for every character
|
||||
int c = small[cc]; //check what character we're on
|
||||
if (c >= 48 && c <= 57) { //if its a number, print 4 pixels
|
||||
for (int xx = 0; xx < 4; xx++) {
|
||||
int xxx = c - 48;
|
||||
if (numbermap[sy][(xxx * 4) + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][(xxx * 4) + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
if (c == 46 || c == 58) { //if its punctuation, print 2 pixels
|
||||
for (int xx = 0; xx < 2; xx++) {
|
||||
if (c == 46) {
|
||||
if (numbermap[sy][42 + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][42 + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
if (c == 58) {
|
||||
if (numbermap[sy][40 + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][40 + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
int mapcharacterwidth = (c >= 48 && c <= 57) ? 4 : 2;//if its a number, print 4 pixels, if its punctuation, print 2 pixels
|
||||
int mapoffset;
|
||||
if (c >= 48 && c <= 57)
|
||||
mapoffset = (c - 48) * 4;
|
||||
else if (c == 46)
|
||||
mapoffset = 42;
|
||||
else
|
||||
mapoffset = 40;
|
||||
for (int xx = 0; xx < mapcharacterwidth; xx++) {
|
||||
if (numbermap[sy][mapoffset + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][mapoffset + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user