Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * |
| 9 | * Copyright (C) 2005 Karl Kurbjun |
| 10 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version 2 |
| 14 | * of the License, or (at your option) any later version. |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 15 | * |
| 16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 17 | * KIND, either express or implied. |
| 18 | * |
| 19 | * H300 Port by Karl Kurbjun |
| 20 | * IPod port by Dave Chapman and Paul Louden |
| 21 | * Additional code contributed by Thom Johansen |
| 22 | * Based off work by: Digita Doom, IDoom, Prboom, lSDLDoom, LxDoom, |
| 23 | * MBF, Boom, DosDoom, |
| 24 | * and of course Original Doom by ID Software |
| 25 | * See: http://prboom.sourceforge.net/about.html for the history |
| 26 | * |
| 27 | * |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | #include "d_main.h" |
| 31 | #include "doomdef.h" |
| 32 | #include "settings.h" |
| 33 | #include "m_fixed.h" |
| 34 | #include "m_argv.h" |
| 35 | #include "m_misc.h" |
| 36 | #include "g_game.h" |
| 37 | #include "rockmacros.h" |
| 38 | #include "doomstat.h" |
| 39 | #include "i_system.h" |
Karl Kurbjun | 65c15eb | 2006-04-22 03:48:15 +0000 | [diff] [blame] | 40 | #include "hu_stuff.h" |
| 41 | #include "st_stuff.h" |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 42 | #include "lib/oldmenuapi.h" |
Jens Arnold | 2aa0c4c | 2008-01-06 14:05:55 +0000 | [diff] [blame] | 43 | #include "lib/helper.h" |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 44 | |
| 45 | PLUGIN_HEADER |
Michael Sevakis | acc29d9 | 2006-11-18 02:18:29 +0000 | [diff] [blame] | 46 | PLUGIN_IRAM_DECLARE |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 47 | |
| 48 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough |
| 49 | |
| 50 | int filearray[9]; |
| 51 | int fpoint=1; // save 0 for closing |
| 52 | |
| 53 | int fileexists(const char * fname) |
| 54 | { |
| 55 | int fd; |
| 56 | fd = open(fname,O_RDONLY); |
| 57 | |
| 58 | if (fd>=0) |
| 59 | { |
| 60 | close(fd); |
| 61 | return 0; |
| 62 | } |
| 63 | return -1; |
| 64 | } |
| 65 | |
| 66 | #ifndef SIMULATOR |
| 67 | int my_open(const char *file, int flags) |
| 68 | { |
| 69 | if(fpoint==8) |
| 70 | return -1; |
| 71 | #undef open |
| 72 | filearray[fpoint]=rb->open(file, flags); |
| 73 | |
| 74 | if(filearray[fpoint]<0) |
| 75 | return filearray[fpoint]; |
| 76 | |
| 77 | fpoint++; |
| 78 | return filearray[fpoint-1]; |
| 79 | } |
| 80 | |
| 81 | int my_close(int id) |
| 82 | { |
| 83 | int i=0; |
| 84 | if(id<0) |
| 85 | return id; |
| 86 | while(filearray[i]!=id && i<8) |
| 87 | i++; |
| 88 | |
| 89 | if(i==8) |
| 90 | { |
| 91 | printf("A requested FID did not exist!!!!"); |
| 92 | return -9; |
| 93 | } |
| 94 | #undef close |
| 95 | rb->close(id); |
| 96 | |
| 97 | for(; i<fpoint-1; i++) |
| 98 | filearray[i]=filearray[i+1]; |
| 99 | |
| 100 | fpoint--; |
| 101 | return 0; |
| 102 | } |
| 103 | #endif |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 104 | const struct plugin_api* rb; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 105 | #define MAXARGVS 100 |
| 106 | |
Karl Kurbjun | 6e33711 | 2006-04-03 17:11:42 +0000 | [diff] [blame] | 107 | bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates |
| 108 | |
Karl Kurbjun | aec5814 | 2007-06-03 22:03:36 +0000 | [diff] [blame] | 109 | #ifndef SIMULATOR |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 110 | // Here is a hacked up printf command to get the output from the game. |
| 111 | int printf(const char *fmt, ...) |
| 112 | { |
| 113 | static int p_xtpt; |
| 114 | char p_buf[50]; |
| 115 | bool ok; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 116 | rb->yield(); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 117 | va_list ap; |
| 118 | |
| 119 | va_start(ap, fmt); |
| 120 | ok = vsnprintf(p_buf,sizeof(p_buf), fmt, ap); |
| 121 | va_end(ap); |
| 122 | |
| 123 | rb->lcd_putsxy(1,p_xtpt, (unsigned char *)p_buf); |
Karl Kurbjun | 6e33711 | 2006-04-03 17:11:42 +0000 | [diff] [blame] | 124 | if (!noprintf) |
| 125 | rb->lcd_update(); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 126 | |
| 127 | p_xtpt+=8; |
| 128 | if(p_xtpt>LCD_HEIGHT-8) |
| 129 | { |
| 130 | p_xtpt=0; |
Karl Kurbjun | 6e33711 | 2006-04-03 17:11:42 +0000 | [diff] [blame] | 131 | if (!noprintf) |
| 132 | rb->lcd_clear_display(); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 133 | } |
| 134 | return 1; |
| 135 | } |
Karl Kurbjun | aec5814 | 2007-06-03 22:03:36 +0000 | [diff] [blame] | 136 | #endif |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 137 | |
| 138 | char *my_strtok( char * s, const char * delim ) |
| 139 | { |
| 140 | register char *spanp; |
| 141 | register int c, sc; |
| 142 | char *tok; |
| 143 | static char *lasts; |
| 144 | |
| 145 | |
| 146 | if (s == NULL && (s = lasts) == NULL) |
| 147 | return (NULL); |
| 148 | |
| 149 | /* |
| 150 | * Skip (span) leading delimiters (s += strspn(s, delim), sort of). |
| 151 | */ |
| 152 | cont: |
| 153 | c = *s++; |
| 154 | for (spanp = (char *)delim; (sc = *spanp++) != 0;) { |
| 155 | if (c == sc) |
| 156 | goto cont; |
| 157 | } |
| 158 | |
| 159 | if (c == 0) { /* no non-delimiter characters */ |
| 160 | lasts = NULL; |
| 161 | return (NULL); |
| 162 | } |
| 163 | tok = s - 1; |
| 164 | |
| 165 | /* |
| 166 | * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). |
| 167 | * Note that delim must have one NUL; we stop if we see that, too. |
| 168 | */ |
| 169 | for (;;) { |
| 170 | c = *s++; |
| 171 | spanp = (char *)delim; |
| 172 | do { |
| 173 | if ((sc = *spanp++) == c) { |
| 174 | if (c == 0) |
| 175 | s = NULL; |
| 176 | else |
| 177 | s[-1] = 0; |
| 178 | lasts = s; |
| 179 | return (tok); |
| 180 | } |
| 181 | } while (sc != 0); |
| 182 | } |
| 183 | /* NOTREACHED */ |
| 184 | } |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 185 | |
| 186 | inline void* memcpy(void* dst, const void* src, size_t size) |
| 187 | { |
| 188 | return rb->memcpy(dst, src, size); |
| 189 | } |
| 190 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 191 | struct argvlist |
| 192 | { |
| 193 | int timedemo; // 1 says there's a timedemo |
| 194 | int demonum; |
| 195 | int addonnum; |
| 196 | } argvlist; |
| 197 | |
| 198 | const unsigned char versions_builtin[7][20] = |
| 199 | { |
| 200 | "Doom Shareware", |
| 201 | "Doom Registered", |
| 202 | "Ultimate Doom", |
| 203 | "Doom 2", |
Paul Louden | d17de72 | 2007-02-17 17:51:44 +0000 | [diff] [blame] | 204 | "Freedoom", |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 205 | "Plutonia", |
| 206 | "TNT" |
| 207 | }; |
| 208 | |
| 209 | const unsigned char wads_builtin[7][30] = |
| 210 | { |
| 211 | GAMEBASE"doom1.wad", |
| 212 | GAMEBASE"doom.wad", |
| 213 | GAMEBASE"doomu.wad", |
| 214 | GAMEBASE"doom2.wad", |
Paul Louden | d17de72 | 2007-02-17 17:51:44 +0000 | [diff] [blame] | 215 | GAMEBASE"doomf.wad", |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 216 | GAMEBASE"plutonia.wad", |
| 217 | GAMEBASE"tnt.wad" |
| 218 | }; |
| 219 | |
| 220 | int namemap[7]; |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 221 | static struct menu_item *addons; |
| 222 | static struct menu_item *demolmp; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 223 | char addon[200]; |
| 224 | // This sets up the base game and builds up myargv/c |
| 225 | bool Dhandle_ver (int dver) |
| 226 | { |
| 227 | switch (dver) { |
| 228 | case 0: /* Doom Shareware */ |
| 229 | gamemode = shareware; |
| 230 | gamemission = doom; |
| 231 | D_AddFile(wads_builtin[0],source_iwad); |
| 232 | break; |
| 233 | case 1: /* Doom registered */ |
| 234 | gamemode = registered; |
| 235 | gamemission = doom; |
| 236 | D_AddFile(wads_builtin[1],source_iwad); |
| 237 | break; |
| 238 | case 2: /* Ultimate Doom */ |
| 239 | gamemode = retail; |
| 240 | gamemission = doom; |
| 241 | D_AddFile(wads_builtin[2],source_iwad); |
| 242 | break; |
| 243 | case 3: /* Doom2 */ |
| 244 | gamemode = commercial; |
| 245 | gamemission = doom2; |
| 246 | D_AddFile(wads_builtin[3],source_iwad); |
| 247 | break; |
| 248 | case 4: /* Doom2f */ |
| 249 | gamemode = commercial; |
| 250 | gamemission = doom2; |
| 251 | D_AddFile(wads_builtin[4],source_iwad); |
| 252 | break; |
| 253 | case 5: /* Plutonia */ |
| 254 | gamemode = commercial; |
| 255 | gamemission = pack_plut; |
| 256 | D_AddFile(wads_builtin[5],source_iwad); |
| 257 | break; |
| 258 | case 6: /* TNT */ |
| 259 | gamemode = commercial; |
| 260 | gamemission = pack_tnt; |
| 261 | D_AddFile(wads_builtin[6],source_iwad); |
| 262 | break; |
| 263 | default: |
| 264 | gamemission = none; |
| 265 | return 0; |
| 266 | } |
| 267 | // Start adding to myargv |
| 268 | if(argvlist.timedemo && (gamemode == shareware)) |
| 269 | { |
| 270 | singletics = true; |
| 271 | timingdemo = true; // show stats after quit |
| 272 | G_DeferedPlayDemo("demo3"); |
| 273 | singledemo = true; // quit after one demo |
| 274 | } |
| 275 | |
| 276 | if(argvlist.addonnum) |
| 277 | { |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 278 | snprintf(addon,sizeof(addon),"%s%s", GAMEBASE"addons/", addons[argvlist.addonnum].desc); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 279 | D_AddFile(addon,source_pwad); |
| 280 | modifiedgame = true; |
| 281 | } |
| 282 | |
| 283 | if(argvlist.demonum) |
| 284 | { |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 285 | snprintf(addon, sizeof(addon),"%s%s", GAMEBASE"demos/", demolmp[argvlist.demonum].desc); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 286 | D_AddFile(addon, source_lmp); |
| 287 | G_DeferedPlayDemo(addon); |
| 288 | singledemo = true; // quit after one demo |
| 289 | } |
| 290 | return 1; |
| 291 | } |
| 292 | |
| 293 | // This function builds up the basegame list for use in the options selection |
| 294 | // it also sets the defaults for the argvlist |
Karl Kurbjun | 1123ab6 | 2006-04-03 20:03:02 +0000 | [diff] [blame] | 295 | // Now checking for rcokdoom.wad based on prboom.wad |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 296 | int Dbuild_base (struct opt_items *names) |
| 297 | { |
Karl Kurbjun | 1123ab6 | 2006-04-03 20:03:02 +0000 | [diff] [blame] | 298 | if ( fileexists(GAMEBASE"rockdoom.wad") ) |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 299 | return 0; |
| 300 | |
Karl Kurbjun | 1123ab6 | 2006-04-03 20:03:02 +0000 | [diff] [blame] | 301 | D_AddFile (GAMEBASE"rockdoom.wad", source_pwad); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 302 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 303 | int i=0, j; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 304 | /* Doom Shareware */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 305 | /* Doom registered */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 306 | /* Ultimate Doom */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 307 | /* Doom2 */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 308 | /* Doom2f */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 309 | /* Plutonia */ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 310 | /* TNT */ |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 311 | for(j=0;j<7;j++) |
| 312 | if ( !fileexists (wads_builtin[j]) ) |
| 313 | { |
| 314 | names[i].string=versions_builtin[j]; |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 315 | names[i].voice_id=-1; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 316 | namemap[i]=j; |
| 317 | i++; |
| 318 | } |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 319 | // Set argvlist defaults |
| 320 | argvlist.timedemo=0; |
| 321 | |
| 322 | return i; |
| 323 | } |
| 324 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 325 | // This is a general function that takes in a menu_item structure and makes a list |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 326 | // of files within it based on matching the string stringmatch to the files. |
| 327 | int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory, char *stringmatch) |
| 328 | { |
| 329 | int i=0; |
| 330 | DIR *filedir; |
| 331 | struct dirent *dptr; |
| 332 | char *startpt; |
| 333 | struct menu_item *temp; |
| 334 | |
Kevin Ferrare | 011a325 | 2007-07-20 17:06:55 +0000 | [diff] [blame] | 335 | filedir=rb->opendir(directory); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 336 | |
| 337 | if(filedir==NULL) |
| 338 | { |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 339 | temp=malloc(sizeof(struct menu_item)); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 340 | temp[0].desc=firstentry; |
| 341 | temp[0].function=0; |
| 342 | *names=temp; |
| 343 | return 1; |
| 344 | } |
| 345 | |
| 346 | // Get the total number of entries |
| 347 | while((dptr=rb->readdir(filedir))) |
| 348 | i++; |
| 349 | |
| 350 | // Reset the directory |
Kevin Ferrare | 011a325 | 2007-07-20 17:06:55 +0000 | [diff] [blame] | 351 | rb->closedir(filedir); |
| 352 | filedir=rb->opendir(directory); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 353 | |
| 354 | i++; |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 355 | temp=malloc(i*sizeof(struct menu_item)); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 356 | temp[0].desc=firstentry; |
| 357 | temp[0].function=0; |
| 358 | i=1; |
| 359 | |
| 360 | while((dptr=rb->readdir(filedir))) |
| 361 | { |
| 362 | if(rb->strcasestr(dptr->d_name, stringmatch)) |
| 363 | { |
| 364 | startpt=malloc(strlen(dptr->d_name)*sizeof(char)); |
| 365 | strcpy(startpt,dptr->d_name); |
| 366 | temp[i].desc=startpt; |
| 367 | temp[i].function=0; |
| 368 | i++; |
| 369 | } |
| 370 | } |
Kevin Ferrare | 011a325 | 2007-07-20 17:06:55 +0000 | [diff] [blame] | 371 | rb->closedir(filedir); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 372 | *names=temp; |
| 373 | return i; |
| 374 | } |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 375 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 376 | static int translatekey(int key) __attribute__ ((noinline)); |
| 377 | |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 378 | // This key configuration code is not the cleanest or the most efficient, but it works |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 379 | static int translatekey(int key) |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 380 | { |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 381 | if (key<31) |
| 382 | { |
| 383 | switch(key) |
| 384 | { |
| 385 | case 0: |
| 386 | return 0; |
| 387 | case 1: |
| 388 | return KEY_RIGHTARROW; |
| 389 | case 2: |
| 390 | return KEY_LEFTARROW; |
| 391 | case 3: |
| 392 | return KEY_UPARROW; |
| 393 | case 4: |
| 394 | return KEY_DOWNARROW; |
| 395 | case 5: |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 396 | return KEY_ENTER; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 397 | case 6: |
| 398 | return KEY_RCTRL; |
| 399 | case 7: |
| 400 | return ' '; |
| 401 | case 8: |
| 402 | return KEY_ESCAPE; |
| 403 | case 9: |
| 404 | return 'w'; |
Karl Kurbjun | 8ae6802 | 2006-04-04 23:13:50 +0000 | [diff] [blame] | 405 | case 10: |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 406 | return KEY_TAB; |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 407 | default: |
| 408 | return 0; |
| 409 | } |
| 410 | } |
| 411 | else |
| 412 | { |
| 413 | switch(key) |
| 414 | { |
| 415 | case 0: |
| 416 | return 0; |
| 417 | case KEY_RIGHTARROW: |
| 418 | return 1; |
| 419 | case KEY_LEFTARROW: |
| 420 | return 2; |
| 421 | case KEY_UPARROW: |
| 422 | return 3; |
| 423 | case KEY_DOWNARROW: |
| 424 | return 4; |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 425 | case KEY_ENTER: |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 426 | return 5; |
| 427 | case KEY_RCTRL: |
| 428 | return 6; |
| 429 | case ' ': |
| 430 | return 7; |
| 431 | case KEY_ESCAPE: |
| 432 | return 8; |
| 433 | case 'w': |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 434 | return 9; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 435 | case KEY_TAB: |
| 436 | return 10; |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 437 | default: |
| 438 | return 0; |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | // I havn't added configurable keys for enter or escape because this requires some modification to |
| 444 | // m_menu.c which hasn't been done yet. |
| 445 | |
| 446 | int Oset_keys() |
| 447 | { |
| 448 | int m, result; |
| 449 | int menuquit=0; |
| 450 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 451 | |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 452 | static const struct opt_items doomkeys[] = { |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 453 | { "Unmapped", -1 }, |
| 454 | { "Key Right", -1 }, |
| 455 | { "Key Left", -1 }, |
| 456 | { "Key Up", -1 }, |
| 457 | { "Key Down", -1 }, |
| 458 | { "Key Select", -1 }, |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 459 | #if defined(TOSHIBA_GIGABEAT_F) |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 460 | { "Key A", -1 }, |
| 461 | { "Key Menu", -1 }, |
| 462 | { "Key Power", -1 }, |
| 463 | { "Key Volume Down", -1 }, |
| 464 | { "Key Volume Up", -1 }, |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 465 | #else |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 466 | { "Key Record", -1 }, |
| 467 | { "Key Mode", -1 }, |
| 468 | { "Key Off", -1 }, |
| 469 | { "Key On", -1 }, |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 470 | #endif |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 471 | }; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 472 | |
| 473 | int *keys[]={ |
| 474 | &key_right, |
| 475 | &key_left, |
| 476 | &key_up, |
| 477 | &key_down, |
| 478 | &key_fire, |
| 479 | &key_use, |
| 480 | &key_strafe, |
| 481 | &key_weapon, |
| 482 | &key_map |
| 483 | }; |
| 484 | |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 485 | int numdoomkeys=sizeof(doomkeys) / sizeof(*doomkeys); |
| 486 | |
| 487 | static const struct menu_item items[] = { |
| 488 | { "Game Right", NULL }, |
| 489 | { "Game Left", NULL }, |
| 490 | { "Game Up", NULL }, |
| 491 | { "Game Down", NULL }, |
| 492 | { "Game Shoot", NULL }, |
| 493 | { "Game Open", NULL }, |
| 494 | { "Game Strafe", NULL }, |
| 495 | { "Game Weapon", NULL }, |
Karl Kurbjun | 8ae6802 | 2006-04-04 23:13:50 +0000 | [diff] [blame] | 496 | { "Game Automap", NULL }, |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 497 | }; |
| 498 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 499 | m = menu_init(rb, items, sizeof(items) / sizeof(*items), |
Karl Kurbjun | 26dd5c5 | 2006-06-10 18:47:11 +0000 | [diff] [blame] | 500 | NULL, NULL, NULL, NULL); |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 501 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 502 | while(!menuquit) |
| 503 | { |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 504 | result=menu_show(m); |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 505 | if(result<0) |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 506 | menuquit=1; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 507 | else |
| 508 | { |
| 509 | *keys[result]=translatekey(*keys[result]); |
| 510 | rb->set_option(items[result].desc, keys[result], INT, doomkeys, numdoomkeys, NULL ); |
| 511 | *keys[result]=translatekey(*keys[result]); |
| 512 | } |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 513 | } |
| 514 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 515 | menu_exit(m); |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 516 | |
| 517 | return (1); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 518 | } |
| 519 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 520 | extern int fake_contrast; |
| 521 | |
| 522 | static bool Doptions() |
| 523 | { |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 524 | static const struct opt_items onoff[2] = { |
Jens Arnold | a4f0de0 | 2007-10-02 19:53:35 +0000 | [diff] [blame] | 525 | { "Off", -1 }, |
| 526 | { "On", -1 }, |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 527 | }; |
| 528 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 529 | int m, result; |
| 530 | int menuquit=0; |
| 531 | |
| 532 | static const struct menu_item items[] = { |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 533 | { "Set Keys", NULL }, |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 534 | { "Sound", NULL }, |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 535 | { "Timedemo", NULL }, |
| 536 | { "Player Bobbing", NULL }, |
| 537 | { "Weapon Recoil", NULL }, |
| 538 | { "Translucency", NULL }, |
| 539 | { "Fake Contrast", NULL }, |
Karl Kurbjun | 6f8af21 | 2006-04-17 00:37:51 +0000 | [diff] [blame] | 540 | { "Always Run", NULL }, |
Karl Kurbjun | 65c15eb | 2006-04-22 03:48:15 +0000 | [diff] [blame] | 541 | { "Headsup Display", NULL }, |
| 542 | { "Statusbar Always Red", NULL }, |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 543 | #if(LCD_HEIGHT>LCD_WIDTH) |
| 544 | { "Rotate Screen 90 deg", NULL }, |
| 545 | #endif |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 546 | }; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 547 | |
| 548 | void *options[]={ |
| 549 | &enable_sound, |
| 550 | &argvlist.timedemo, |
| 551 | &default_player_bobbing, |
| 552 | &default_weapon_recoil, |
| 553 | &default_translucency, |
| 554 | &fake_contrast, |
| 555 | &autorun, |
| 556 | &hud_displayed, |
| 557 | &sts_always_red, |
| 558 | #if(LCD_HEIGHT>LCD_WIDTH) |
| 559 | &rotate_screen, |
| 560 | #endif |
| 561 | }; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 562 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 563 | m = menu_init(rb, items, sizeof(items) / sizeof(*items), |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 564 | NULL, NULL, NULL, NULL); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 565 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 566 | while(!menuquit) |
| 567 | { |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 568 | result=menu_show(m); |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 569 | if(result==0) |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 570 | Oset_keys(); |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 571 | else if (result > 0) |
| 572 | rb->set_option(items[result].desc, options[result-1], INT, onoff, 2, NULL ); |
| 573 | else |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 574 | menuquit=1; |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 575 | } |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 576 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 577 | menu_exit(m); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 578 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 579 | return (1); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 580 | } |
| 581 | |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 582 | int menuchoice(struct menu_item *menu, int items) |
| 583 | { |
| 584 | int m, result; |
| 585 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 586 | m = menu_init(rb, menu, items,NULL, NULL, NULL, NULL); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 587 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 588 | result= menu_show(m); |
| 589 | menu_exit(m); |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 590 | if(result<items && result>=0) |
| 591 | return result; |
| 592 | return 0; |
| 593 | } |
| 594 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 595 | // |
| 596 | // Doom Menu |
| 597 | // |
| 598 | int doom_menu() |
| 599 | { |
| 600 | int m; |
| 601 | int result; |
| 602 | int status; |
| 603 | int gamever; |
| 604 | bool menuquit=0; |
| 605 | |
| 606 | static struct opt_items names[7]; |
| 607 | |
| 608 | static const struct menu_item items[] = { |
| 609 | { "Game", NULL }, |
| 610 | { "Addons", NULL }, |
| 611 | { "Demos", NULL }, |
| 612 | { "Options", NULL }, |
| 613 | { "Play Game", NULL }, |
| 614 | { "Quit", NULL }, |
| 615 | }; |
| 616 | |
| 617 | if( (status=Dbuild_base(names)) == 0 ) // Build up the base wad files (select last added file) |
| 618 | { |
Jens Arnold | 4d6374c | 2007-03-16 21:56:08 +0000 | [diff] [blame] | 619 | rb->splash(HZ*2, "Missing Base WAD!"); |
Karl Kurbjun | 9f2be9b | 2006-04-17 05:01:33 +0000 | [diff] [blame] | 620 | return -2; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 621 | } |
| 622 | |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 623 | int numadd=Dbuild_filelistm(&addons, "No Addon", GAMEBASE"addons/", ".WAD" ); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 624 | |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 625 | int numdemos=Dbuild_filelistm(&demolmp, "No Demo", GAMEBASE"demos/", ".LMP" ); |
Karl Kurbjun | c87f98c | 2006-04-17 03:09:29 +0000 | [diff] [blame] | 626 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 627 | argvlist.demonum=0; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 628 | argvlist.addonnum=0; |
| 629 | |
| 630 | gamever=status-1; |
| 631 | |
Karl Kurbjun | 26dd5c5 | 2006-06-10 18:47:11 +0000 | [diff] [blame] | 632 | /* Clean out the button Queue */ |
| 633 | while (rb->button_get(false) != BUTTON_NONE) |
| 634 | rb->yield(); |
| 635 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 636 | m = menu_init(rb, items, sizeof(items) / sizeof(*items), |
Karl Kurbjun | 26dd5c5 | 2006-06-10 18:47:11 +0000 | [diff] [blame] | 637 | NULL, NULL, NULL, NULL); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 638 | |
| 639 | while(!menuquit) |
| 640 | { |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 641 | result=menu_show(m); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 642 | switch (result) { |
| 643 | case 0: /* Game picker */ |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 644 | rb->set_option("Game WAD", &gamever, INT, names, status, NULL ); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 645 | break; |
| 646 | |
| 647 | case 1: /* Addon picker */ |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 648 | argvlist.addonnum=menuchoice(addons,numadd); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 649 | break; |
| 650 | |
Karl Kurbjun | 0926f64 | 2006-04-04 17:53:29 +0000 | [diff] [blame] | 651 | case 2: /* Demos */ |
Karl Kurbjun | b0722d1 | 2006-04-17 04:38:26 +0000 | [diff] [blame] | 652 | argvlist.demonum=menuchoice(demolmp,numdemos); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 653 | break; |
| 654 | |
| 655 | case 3: /* Options */ |
| 656 | Doptions(); |
| 657 | break; |
| 658 | |
| 659 | case 4: /* Play Game */ |
| 660 | menuquit=1; |
| 661 | break; |
| 662 | |
| 663 | case 5: /* Quit */ |
| 664 | menuquit=1; |
| 665 | gamever=-1; |
| 666 | break; |
| 667 | |
| 668 | default: |
| 669 | break; |
| 670 | } |
| 671 | } |
| 672 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 673 | menu_exit(m); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 674 | |
| 675 | return (gamever); |
| 676 | } |
| 677 | |
| 678 | extern int systemvol; |
| 679 | /* this is the plugin entry point */ |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 680 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 681 | { |
Tomasz Malesinski | 80da8b1 | 2006-11-26 18:31:41 +0000 | [diff] [blame] | 682 | PLUGIN_IRAM_INIT(api) |
| 683 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 684 | rb = api; |
| 685 | (void)parameter; |
| 686 | |
Karl Kurbjun | 4e2a74c | 2006-04-15 22:08:36 +0000 | [diff] [blame] | 687 | doomexit=0; |
| 688 | |
Christian Gmeiner | a91b794 | 2006-04-09 15:00:30 +0000 | [diff] [blame] | 689 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 690 | rb->cpu_boost(true); |
| 691 | #endif |
| 692 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 693 | rb->lcd_setfont(0); |
| 694 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 695 | // We're using doom's memory management since it implements a proper free (and re-uses the memory) |
| 696 | // and now with prboom's code: realloc and calloc |
Karl Kurbjun | c87f98c | 2006-04-17 03:09:29 +0000 | [diff] [blame] | 697 | printf ("Z_Init: Init zone memory allocation daemon.\n"); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 698 | Z_Init (); |
| 699 | |
| 700 | printf ("M_LoadDefaults: Load system defaults.\n"); |
| 701 | M_LoadDefaults (); // load before initing other systems |
| 702 | |
Jens Arnold | 4d6374c | 2007-03-16 21:56:08 +0000 | [diff] [blame] | 703 | rb->splash(HZ*2, "Welcome to RockDoom"); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 704 | |
Karl Kurbjun | c87f98c | 2006-04-17 03:09:29 +0000 | [diff] [blame] | 705 | myargv =0; |
| 706 | myargc=0; |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 707 | |
Karl Kurbjun | 9f2be9b | 2006-04-17 05:01:33 +0000 | [diff] [blame] | 708 | rb->lcd_clear_display(); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 709 | |
Karl Kurbjun | 9f2be9b | 2006-04-17 05:01:33 +0000 | [diff] [blame] | 710 | int result = doom_menu(); |
Karl Kurbjun | 4caa676 | 2006-10-01 01:07:45 +0000 | [diff] [blame] | 711 | if (result < 0) |
| 712 | { |
| 713 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
Jens Arnold | 2aa0c4c | 2008-01-06 14:05:55 +0000 | [diff] [blame] | 714 | rb->cpu_boost(false); |
Karl Kurbjun | 4caa676 | 2006-10-01 01:07:45 +0000 | [diff] [blame] | 715 | #endif |
Jens Arnold | 2aa0c4c | 2008-01-06 14:05:55 +0000 | [diff] [blame] | 716 | if( result == -1 ) |
| 717 | return PLUGIN_OK; // Quit was selected |
| 718 | else |
| 719 | return PLUGIN_ERROR; // Missing base wads |
Karl Kurbjun | 4caa676 | 2006-10-01 01:07:45 +0000 | [diff] [blame] | 720 | } |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 721 | |
Karl Kurbjun | b47a43a | 2007-01-17 18:52:24 +0000 | [diff] [blame] | 722 | #if(LCD_HEIGHT>LCD_WIDTH) |
| 723 | if(rotate_screen) |
| 724 | { |
| 725 | SCREENHEIGHT=LCD_WIDTH; |
| 726 | SCREENWIDTH=LCD_HEIGHT; |
| 727 | } |
| 728 | else |
| 729 | { |
| 730 | SCREENHEIGHT=LCD_HEIGHT; |
| 731 | SCREENWIDTH=LCD_WIDTH; |
| 732 | } |
| 733 | #endif |
| 734 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 735 | Dhandle_ver( namemap[ result ] ); |
| 736 | |
| 737 | rb->lcd_setfont(0); |
| 738 | |
| 739 | rb->lcd_clear_display(); |
| 740 | |
Karl Kurbjun | 546d96c | 2006-04-02 20:45:24 +0000 | [diff] [blame] | 741 | systemvol= rb->global_settings->volume-rb->global_settings->volume%((rb->sound_max(SOUND_VOLUME)-rb->sound_min(SOUND_VOLUME))/15); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 742 | general_translucency = default_translucency; // phares |
Karl Kurbjun | 993545b | 2006-04-14 21:07:56 +0000 | [diff] [blame] | 743 | |
Jens Arnold | 2aa0c4c | 2008-01-06 14:05:55 +0000 | [diff] [blame] | 744 | backlight_force_on(rb); |
Karl Kurbjun | 993545b | 2006-04-14 21:07:56 +0000 | [diff] [blame] | 745 | #ifdef RB_PROFILE |
| 746 | rb->profile_thread(); |
| 747 | #endif |
| 748 | |
Robert Kukla | 1317ebb | 2008-04-07 22:09:14 +0000 | [diff] [blame] | 749 | #if LCD_DEPTH>1 |
Karl Kurbjun | d6b0c97 | 2006-11-15 06:14:27 +0000 | [diff] [blame] | 750 | rb->lcd_set_backdrop(NULL); |
Robert Kukla | 1317ebb | 2008-04-07 22:09:14 +0000 | [diff] [blame] | 751 | #endif |
Karl Kurbjun | d6b0c97 | 2006-11-15 06:14:27 +0000 | [diff] [blame] | 752 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 753 | D_DoomMain (); |
| 754 | |
Karl Kurbjun | 993545b | 2006-04-14 21:07:56 +0000 | [diff] [blame] | 755 | #ifdef RB_PROFILE |
| 756 | rb->profstop(); |
| 757 | #endif |
Jens Arnold | 2aa0c4c | 2008-01-06 14:05:55 +0000 | [diff] [blame] | 758 | backlight_use_settings(rb); |
Karl Kurbjun | 993545b | 2006-04-14 21:07:56 +0000 | [diff] [blame] | 759 | |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 760 | M_SaveDefaults (); |
| 761 | |
| 762 | I_Quit(); // Make SURE everything was closed out right |
| 763 | |
Karl Kurbjun | 6f8af21 | 2006-04-17 00:37:51 +0000 | [diff] [blame] | 764 | printf("There were still: %d files open\n", fpoint); |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 765 | while(fpoint>0) |
| 766 | { |
Nicolas Pennequin | 9ff4057 | 2007-10-09 18:44:07 +0000 | [diff] [blame] | 767 | #ifdef SIMULATOR |
| 768 | close(filearray[fpoint]); |
| 769 | #else |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 770 | rb->close(filearray[fpoint]); |
Nicolas Pennequin | 9ff4057 | 2007-10-09 18:44:07 +0000 | [diff] [blame] | 771 | #endif |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 772 | fpoint--; |
| 773 | } |
| 774 | |
Christian Gmeiner | a91b794 | 2006-04-09 15:00:30 +0000 | [diff] [blame] | 775 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
Dave Chapman | 47f4a45 | 2006-03-28 15:44:01 +0000 | [diff] [blame] | 776 | rb->cpu_boost(false); |
| 777 | #endif |
| 778 | |
| 779 | return PLUGIN_OK; |
| 780 | } |