1 Patch tint 0.03b to be usable as coreboot payload, linked against
2 the libpayload library.
4 Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
6 diff -Naur tint-0.03b.orig/config.h tint-0.03b/config.h
7 --- tint-0.03b.orig/config.h 2001-12-08 00:03:24.000000000 +0100
8 +++ tint-0.03b/config.h 2008-04-11 22:19:35.000000000 +0200
10 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 +#include <libpayload.h>
15 +#define random(x) rand(x)
16 +#define srandom(x) srand(x)
22 const char scorefile[] = SCOREFILE;
25 #endif /* #ifndef CONFIG_H */
26 diff -Naur tint-0.03b.orig/engine.c tint-0.03b/engine.c
27 --- tint-0.03b.orig/engine.c 2005-07-17 13:26:22.000000000 +0200
28 +++ tint-0.03b/engine.c 2008-04-11 22:19:35.000000000 +0200
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 diff -Naur tint-0.03b.orig/io.c tint-0.03b/io.c
43 --- tint-0.03b.orig/io.c 2001-12-07 16:48:20.000000000 +0100
44 +++ tint-0.03b/io.c 2008-04-11 22:19:35.000000000 +0200
46 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 #include <stdarg.h> /* va_list(), va_start(), va_end() */
53 #include <sys/time.h> /* gettimeofday() */
54 #include <unistd.h> /* gettimeofday() */
60 /* Initialize screen */
63 + curses_enable_serial(0);
64 + curses_enable_vga(1);
69 curs_set (CURSOR_INVISIBLE);
72 /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
76 struct timeval starttv,endtv;
80 timeout (in_timeleft / 1000);
81 gettimeofday (&starttv,NULL);
86 gettimeofday (&endtv,NULL);
90 in_timeleft -= endtv.tv_usec;
91 if (in_timeleft <= 0) in_timeleft = in_timetotal;
97 diff -Naur tint-0.03b.orig/Makefile tint-0.03b/Makefile
98 --- tint-0.03b.orig/Makefile 2005-07-17 13:30:54.000000000 +0200
99 +++ tint-0.03b/Makefile 2008-04-11 22:19:35.000000000 +0200
101 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
102 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104 +LIBPAYLOAD_DIR := ../libpayload
105 +CC := $(LIBPAYLOAD_DIR)/bin/lpgcc
106 +AS := $(LIBPAYLOAD_DIR)/bin/lpas
107 +# CFLAGS := -Wall -Werror -Os
110 +OBJS := $(TARGET).o engine.o io.o utils.o
114 +$(TARGET).elf: $(OBJS)
115 + $(CC) -o $@ $(OBJS)
118 + $(CC) $(CFLAGS) -c -o $@ $<
121 + $(AS) --32 -o $@ $<
124 + rm -f $(TARGET).elf *.o
136 bindir = $(DESTDIR)/usr/games
139 $(MAKE) -C debian clean
142 diff -Naur tint-0.03b.orig/tint.c tint-0.03b/tint.c
143 --- tint-0.03b.orig/tint.c 2005-07-17 13:26:43.000000000 +0200
144 +++ tint-0.03b/tint.c 2008-04-11 22:19:35.000000000 +0200
146 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
155 #include <sys/types.h>
159 #include "typedefs.h"
166 static void getname (char *name)
168 struct passwd *pw = getpwuid (geteuid ());
170 name[NAMELEN - 1] = '\0';
178 fprintf (stderr,"Error creating %s\n",scorefile);
179 @@ -349,10 +354,11 @@
180 fprintf (stderr,"Error writing to %s\n",scorefile);
185 void showplayerstats (engine_t *engine)
189 "\n\t PLAYER STATISTICS\n\n\t"
191 "Efficiency %11d\n\t"
193 GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
197 static void createscores (int score)
201 fprintf (stderr,"%s",scoretitle);
202 fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
207 static int cmpscores (const void *a,const void *b)
211 /* timestamps is equal */
217 static void savescores (int score)
220 @@ -490,11 +501,13 @@
222 fprintf (stderr,"\n");
226 /***************************************************************************/
227 /***************************************************************************/
228 /***************************************************************************/
231 static void showhelp ()
233 fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n");
235 fprintf (stderr," -d Draw vertical dotted lines\n");
240 static void parse_options (int argc,char *argv[])
246 @@ -536,10 +551,12 @@
253 static void choose_level ()
260 buf[strlen (buf) - 1] = '\0';
262 while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
267 /***************************************************************************/
271 showplayerstats (&engine);
273 savescores (GETSCORE (engine.score));
276 + mvprintw(10, 10, "Bye.");
284 diff -Naur tint-0.03b.orig/utils.c tint-0.03b/utils.c
285 --- tint-0.03b.orig/utils.c 2001-12-07 16:49:19.000000000 +0100
286 +++ tint-0.03b/utils.c 2008-04-11 22:19:35.000000000 +0200
288 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299 #include "typedefs.h"
306 srandom (time (NULL));
314 * Convert an str to long. Returns TRUE if successful,
318 bool str2int (int *i,const char *str)