1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 #include "src/lib/16_head.h"
\r
25 /* Function: Wait **********************************************************
\r
27 * Parameters: wait - time in microseconds
\r
29 * Description: pauses for a specified number of microseconds.
\r
32 void wait(clock_t wait){
\r
37 goal = wait + clock();
\r
38 while((goal > clock()) && !kbhit()) ;
\r
44 long int save_pos, size_of_file;
\r
46 save_pos = ftell(fp);
\r
47 fseek(fp, 0L, SEEK_END);
\r
48 size_of_file = ftell(fp);
\r
49 fseek(fp, save_pos, SEEK_SET);
\r
50 return(size_of_file);
\r
53 void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free)
\r
56 strcat(strc,pee); strcat(strc," "); ultoa((dword)h_total,str,10); strcat(strc,str);
\r
57 if(strlen(str)<=4) strcat(strc," "); //printf("%u\n", strlen(str));
\r
58 strcat(strc," "); ultoa((dword)h_used,str,10); strcat(strc,str); strcat(strc," "); strcat(strc," ");
\r
59 ultoa((dword)h_free,str,10); strcat(strc,str);
\r
63 ///////////////////////////////////////////////////////////////////////////
\r
65 // US_CheckParm() - checks to see if a string matches one of a set of
\r
66 // strings. The check is case insensitive. The routine returns the
\r
67 // index of the string that matched, or -1 if no matches were found
\r
69 ///////////////////////////////////////////////////////////////////////////
\r
71 US_CheckParm(char *parm,char **strings)
\r
77 while (!isalpha(*parm)) // Skip non-alphas
\r
80 for (i = 0;*strings && **strings;i++)
\r
82 for (s = *strings++,p = parm,cs = cp = 0;cs == cp;)
\r
99 ==========================
\r
103 ==========================
\r
106 /*void Quit(char *error, ...)
\r
109 unsigned finscreen;
\r
113 va_start(ap,error);
\r
119 CA_CacheGrChunk (PIRACY);
\r
120 finscreen = (unsigned)grsegs[PIRACY];
\r
126 if (error && *error)
\r
135 movedata (finscreen,0,0xb800,0,4000);
\r
146 _argv[1] = "LAST.SHL";
\r
147 _argv[2] = "ENDSCN.SCN";
\r
149 if (execv("LOADSCN.EXE", _argv) == -1)
\r
152 puts("Couldn't find executable LOADSCN.EXE.\n");
\r
161 byte dirchar(byte in)
\r