1 diff -rupN tint-0.05/config.h tint/config.h
2 --- tint-0.05/config.h 2001-12-08 00:03:24.000000000 +0100
3 +++ tint/config.h 2021-02-09 08:00:00.000000000 +0200
5 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 +#include <libpayload.h>
16 const char scorefile[] = SCOREFILE;
19 #endif /* #ifndef CONFIG_H */
20 diff -rupN tint-0.05/engine.c tint/engine.c
21 --- tint-0.05/engine.c 2005-07-17 13:26:22.000000000 +0200
22 +++ tint/engine.c 2021-02-09 08:00:00.000000000 +0200
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 -#include "typedefs.h"
38 diff -rupN tint-0.05/engine.h tint/engine.h
39 --- tint-0.05/engine.h 2001-12-07 16:48:08.000000000 +0100
40 +++ tint/engine.h 2021-02-09 08:00:00.000000000 +0200
42 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 -#include "typedefs.h" /* bool */
46 +#include "curses.h" /* bool */
50 diff -rupN tint-0.05/io.c tint/io.c
51 --- tint-0.05/io.c 2010-06-23 15:05:12.000000000 +0100
52 +++ tint/io.c 2021-02-09 08:00:00.000000000 +0200
54 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 #include <stdarg.h> /* va_list(), va_start(), va_end() */
61 #include <sys/time.h> /* gettimeofday() */
62 #include <unistd.h> /* gettimeofday() */
67 @@ -68,7 +72,11 @@ static int in_timeleft;
68 /* Initialize screen */
71 + curses_enable_serial(0);
72 + curses_enable_vga(1);
77 curs_set (CURSOR_INVISIBLE);
79 @@ -177,11 +185,17 @@ void out_beep ()
80 /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
84 struct timeval starttv,endtv;
88 timeout (in_timeleft / 1000);
89 gettimeofday (&starttv,NULL);
94 gettimeofday (&endtv,NULL);
97 @@ -199,6 +213,7 @@ int in_getch ()
98 in_timeleft -= endtv.tv_usec;
99 if (in_timeleft <= 0) in_timeleft = in_timetotal;
105 diff -rupN tint-0.05/io.h tint/io.h
106 --- tint-0.05/io.h 2010-06-23 14:55:03.000000000 +0100
107 +++ tint/io.h 2021-02-09 08:00:00.000000000 +0200
116 diff -rupN tint-0.05/Makefile tint/Makefile
117 --- tint-0.05/Makefile 2010-06-23 15:06:11.000000000 +0200
118 +++ tint/Makefile 2021-02-09 08:00:00.000000000 +0200
123 +# Copyright (c) Abraham vd Merwe <abz@blio.net>
124 +# All rights reserved.
126 +# Redistribution and use in source and binary forms, with or without
127 +# modification, are permitted provided that the following conditions
129 +# 1. Redistributions of source code must retain the above copyright
130 +# notice, this list of conditions and the following disclaimer.
132 +# 2. Redistributions in binary form must reproduce the above copyright
133 +# notice, this list of conditions and the following disclaimer in the
134 +# documentation and/or other materials provided with the distribution.
135 +# 3. Neither the name of the author nor the names of other contributors
136 +# may be used to endorse or promote products derived from this software
137 +# without specific prior written permission.
139 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
140 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
141 +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
142 +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
143 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
144 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
145 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
146 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
147 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
148 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
150 +# in addition to the dependency below, create the file if it doesn't exist
151 +# to silence warnings about a file that would be generated anyway.
152 +$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
153 +.xcompile: ../../../../util/xcompile/xcompile
155 +CONFIG_COMPILER_GCC := y
162 +tint_obj := $(src)/build
164 +LIBCONFIG_PATH := $(realpath ../../../libpayload)
165 +LIBPAYLOAD_DIR := $(tint_obj)/libpayload
166 +HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/lib/libpayload.a)
167 +LIB_CONFIG ?= configs/defconfig-tinycurses
169 +# CFLAGS := -Wall -Werror -Os
170 +CFLAGS := -Wall -g -Os
172 +OBJS := $(TARGET).o engine.o io.o utils.o
176 +CC := $(CC_$(ARCH-y))
177 +AS := $(AS_$(ARCH-y))
178 +OBJCOPY := $(OBJCOPY_$(ARCH-y))
180 +LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/bin/lpgcc
181 +LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/bin/lpas
183 +# Make is silent per default, but 'make V=1' will show all compiler calls.
189 +# printf" CC $(CC)\n"
191 +$(TARGET).elf: $(OBJS) libpayload
192 + $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
193 + $(Q)$(LPCC) -o $@ $(OBJS)
194 + $(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug
195 + $(Q)$(OBJCOPY) --strip-debug $@
196 + $(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@
199 + $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
200 + $(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
202 +%.S.o: %.S libpayload
203 + $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
204 + $(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $<
206 +ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
208 + $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
211 + $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
212 + $(Q)make -C $(LIBCONFIG_PATH) distclean
213 + $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
214 + $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
218 + $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
222 + $(Q)rm -rf $(tint_obj)
225 +.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
226 diff -rupN tint-0.05/tint.c tint/tint.c
227 --- tint-0.05/tint.c 2010-08-08 19:42:50.000000000 +0200
228 +++ tint/tint.c 2021-02-09 08:00:00.000000000 +0200
232 * Copyright (c) Abraham vd Merwe <abz@blio.net>
233 * All rights reserved.
235 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244 #include <sys/types.h>
248 -#include "typedefs.h"
252 @@ -304,7 +304,7 @@ static void showstatus (engine_t *engine
253 /***************************************************************************/
255 /* Header for scorefile */
256 -#define SCORE_HEADER "Tint 0.02b (c) Abraham vd Merwe - Scores"
257 +#define SCORE_HEADER "Tint 0.05 (c) Abraham vd Merwe - Scores"
259 /* Header for score title */
260 static const char scoretitle[] = "\n\t TINT HIGH SCORES\n\n\tRank Score Name\n\n";
261 @@ -322,6 +322,7 @@ typedef struct
266 static void getname (char *name)
268 struct passwd *pw = getpwuid (geteuid ());
269 @@ -338,7 +339,9 @@ static void getname (char *name)
270 name[NAMELEN - 1] = '\0';
278 fprintf (stderr,"Error creating %s\n",scorefile);
279 @@ -350,10 +353,11 @@ static void err2 ()
280 fprintf (stderr,"Error writing to %s\n",scorefile);
285 void showplayerstats (engine_t *engine)
289 "\n\t PLAYER STATISTICS\n\n\t"
291 "Efficiency %11d\n\t"
292 @@ -361,6 +365,7 @@ void showplayerstats (engine_t *engine)
293 GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
297 static void createscores (int score)
300 @@ -395,7 +400,9 @@ static void createscores (int score)
301 fprintf (stderr,"%s",scoretitle);
302 fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
307 static int cmpscores (const void *a,const void *b)
310 @@ -413,7 +420,9 @@ static int cmpscores (const void *a,cons
311 /* timestamps is equal */
317 static void savescores (int score)
320 @@ -491,11 +500,13 @@ static void savescores (int score)
322 fprintf (stderr,"\n");
326 /***************************************************************************/
327 /***************************************************************************/
328 /***************************************************************************/
331 static void showhelp ()
333 fprintf (stderr,"USAGE: tint [-h] [-l level] [-n] [-d] [-b char]\n");
334 @@ -506,9 +517,11 @@ static void showhelp ()
335 fprintf (stderr," -b <char> Use this character to draw blocks instead of spaces\n");
340 static void parse_options (int argc,char *argv[])
346 @@ -544,10 +557,12 @@ static void parse_options (int argc,char
353 static void choose_level ()
359 @@ -557,6 +572,8 @@ static void choose_level ()
360 buf[strlen (buf) - 1] = '\0';
362 while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
367 /***************************************************************************/
368 @@ -569,6 +586,8 @@ int main (int argc,char *argv[])
372 + if (CONFIG(LP_USB))
374 rand_init (); /* must be called before engine_init () */
375 engine_init (&engine,score_function); /* must be called before using engine.curshape */
376 finished = shownext = FALSE;
377 @@ -632,12 +651,14 @@ int main (int argc,char *argv[])
380 out_setcolor (COLOR_WHITE,COLOR_BLACK);
381 - out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
382 + out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
383 out_printf ("Paused - Press any key to continue");
385 while ((ch = in_getch ()) == ERR) ; /* Wait for a key to be pressed */
386 in_flush (); /* Clear keyboard buffer */
387 - out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
388 + out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
392 /* unknown keypress */
394 @@ -672,12 +693,32 @@ int main (int argc,char *argv[])
396 /* Restore console settings and exit */
399 /* Don't bother the player if he want's to quit */
403 showplayerstats (&engine);
405 savescores (GETSCORE (engine.score));
408 + printf("Press 'q' to reboot...\n");
412 + while ((ch = in_getch ()) == ERR) ; /* Wait for a key to be pressed */
413 + if (ch == 'q') { /* reboot */
427 diff -rupN tint-0.05/utils.c tint/utils.c
428 --- tint-0.05/utils.c 2001-12-07 16:49:19.000000000 +0100
429 +++ tint/utils.c 2021-02-09 08:00:00.000000000 +0200
431 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
441 -#include "typedefs.h"
445 * Initialize random number generator
446 @@ -61,6 +63,7 @@ int rand_value (int range)
447 * Convert an str to long. Returns TRUE if successful,
451 bool str2int (int *i,const char *str)
454 @@ -69,3 +72,4 @@ bool str2int (int *i,const char *str)
459 diff -rupN tint-0.05/utils.h tint/utils.h
460 --- tint-0.05/utils.h 2001-12-07 16:49:35.000000000 +0100
461 +++ tint/utils.h 2021-02-09 08:00:00.000000000 +0200
463 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
466 -#include "typedefs.h"
470 * Initialize random number generator