import gpu_unai from PCSX4ALL project
[pcsx_rearmed.git] / plugins / dfxvideo / menu.c
1 /***************************************************************************
2                          menu.c  -  description
3                              -------------------
4     begin                : Sun Oct 28 2001
5     copyright            : (C) 2001 by Pete Bernert
6     email                : BlackDove@addcom.de
7  ***************************************************************************/
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version. See also the license.txt file for *
14  *   additional informations.                                              *
15  *                                                                         *
16  ***************************************************************************/
17
18 #define _IN_MENU
19
20 #include "externals.h"
21 #include "draw.h"
22 #include "menu.h"
23 #include "gpu.h"
24
25 unsigned long dwCoreFlags = 0;
26
27 // create lists/stuff for fonts (actually there are no more lists, but I am too lazy to change the func names ;)
28 void InitMenu(void)
29 {
30 }
31
32 // kill existing lists/fonts
33 void CloseMenu(void)
34 {
35  DestroyPic();
36 }
37
38 // DISPLAY FPS/MENU TEXT
39
40 #include <time.h>
41 extern time_t tStart;
42
43 int iMPos=0;                                           // menu arrow pos
44
45 void DisplayText(void)                                 // DISPLAY TEXT
46 {
47 }
48
49 // Build Menu buffer (== Dispbuffer without FPS)...
50 void BuildDispMenu(int iInc)
51 {
52  if(!(ulKeybits&KEY_SHOWFPS)) return;                  // mmm, cheater ;)
53
54  iMPos+=iInc;                                          // up or down
55  if(iMPos<0) iMPos=3;                                  // wrap around
56  if(iMPos>3) iMPos=0;
57
58  strcpy(szMenuBuf,"   FL   FS   DI   GF        ");     // main menu items
59
60  if(UseFrameLimit)                                     // set marks
61   {
62    if(iFrameLimit==1) szMenuBuf[2]  = '+';
63    else               szMenuBuf[2]  = '*';
64   }
65  if(iFastFwd)       szMenuBuf[7]  = '~';
66  else
67  if(UseFrameSkip)   szMenuBuf[7]  = '*';
68
69  if(iUseDither)                                        // set marks
70   {
71    if(iUseDither==1) szMenuBuf[12]  = '+';
72    else              szMenuBuf[12]  = '*';
73   }
74
75  if(dwActFixes)     szMenuBuf[17] = '*';
76
77  if(dwCoreFlags&1)  szMenuBuf[23]  = 'A';
78  if(dwCoreFlags&2)  szMenuBuf[23]  = 'M';
79
80  if(dwCoreFlags&0xff00)                                //A/M/G/D   
81   {
82    if((dwCoreFlags&0x0f00)==0x0000)                    // D
83     szMenuBuf[23]  = 'D';
84    else
85    if((dwCoreFlags&0x0f00)==0x0100)                    // A
86     szMenuBuf[23]  = 'A';
87    else
88    if((dwCoreFlags&0x0f00)==0x0200)                    // M
89     szMenuBuf[23]  = 'M';
90    else
91    if((dwCoreFlags&0x0f00)==0x0300)                    // G
92     szMenuBuf[23]  = 'G';
93
94    szMenuBuf[24]='0'+(char)((dwCoreFlags&0xf000)>>12);                         // number
95   }
96
97
98  if(lSelectedSlot)  szMenuBuf[26]  = '0'+(char)lSelectedSlot;   
99
100  szMenuBuf[(iMPos+1)*5]='<';                           // set arrow
101
102 }
103
104 // Some menu action...
105 void SwitchDispMenu(int iStep)                         // SWITCH DISP MENU
106 {
107  if(!(ulKeybits&KEY_SHOWFPS)) return;                  // tststs
108
109  switch(iMPos)
110   {
111    case 0:                                             // frame limit
112     {
113      int iType=0;
114      bInitCap = TRUE;
115
116      if(UseFrameLimit) iType=iFrameLimit;
117      iType+=iStep;
118      if(iType<0) iType=2;
119      if(iType>2) iType=0;
120      if(iType==0) UseFrameLimit=0;
121      else
122       {
123        UseFrameLimit=1;
124        iFrameLimit=iType;
125        SetAutoFrameCap();
126       }
127     } break;
128
129    case 1:                                             // frame skip
130     bInitCap = TRUE;
131     if(iStep>0)
132      {
133       if(!UseFrameSkip) {UseFrameSkip=1;iFastFwd = 0;}
134       else
135        {
136         if(!iFastFwd) iFastFwd=1;
137         else {UseFrameSkip=0;iFastFwd = 0;}
138        }
139      }
140     else
141      {
142       if(!UseFrameSkip) {UseFrameSkip=1;iFastFwd = 1;}
143       else
144        {
145         if(iFastFwd) iFastFwd=0;
146         else {UseFrameSkip=0;iFastFwd = 0;}
147        }
148      }
149     bSkipNextFrame=FALSE;
150     break;
151
152    case 2:                                             // dithering
153     iUseDither+=iStep;
154     if(iUseDither<0) iUseDither=2;
155     if(iUseDither>2) iUseDither=0;
156     break;
157
158    case 3:                                             // special fixes
159     if(iUseFixes) {iUseFixes=0;dwActFixes=0;}
160     else          {iUseFixes=1;dwActFixes=dwCfgFixes;}
161     SetFixes();
162     if(iFrameLimit==2) SetAutoFrameCap();
163     break;
164   }
165
166  BuildDispMenu(0);                                     // update info
167 }