2 //#include "FileMenu.h"
\r
4 extern char *romname;
\r
9 static FILE *DebugFile=NULL;
\r
11 static void UpdateSound(int len);
\r
18 // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
\r
19 // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites
\r
22 //PsndLen=PsndRate/60; // calculated later by pico itself
\r
25 ret=DirectInit(); if (ret) { error("Direct3D init failed"); return 1; }
\r
28 // Init DirectSound:
\r
31 ret=EmuInit(); if (ret) return 1;
\r
35 PicoWriteSound = UpdateSound;
\r
40 extern "C" char *debugString();
\r
44 dprintf(debugString());
\r
48 DSoundExit(); PsndLen=0;
\r
52 if (DebugFile) fclose(DebugFile);
\r
56 // ----------------------------------------------------------------
\r
62 if(fastForward) { PicoSkipFrame+=1; PicoSkipFrame&=7; }
\r
63 else PicoSkipFrame=0;
\r
65 if(frameStep==1) return 0;
\r
66 else if(frameStep==3) frameStep=1;
\r
71 if (Inp.held[7]==1) LoopMode=2; // Right thumb = Toggle Menu
\r
75 // ----------------------------------------------------------------
\r
78 static int MenuUpdate()
\r
82 if (Inp.repeat[0]) delta-=0x100;
\r
83 if (Inp.repeat[1]) delta+=0x100;
\r
85 if (Inp.button[14]>30) delta-=Inp.button[14]-30;
\r
86 if (Inp.button[15]>30) delta+=Inp.button[15]-30;
\r
88 if (delta) FileMenu.scroll(delta);
\r
90 if (Inp.held[8]==1 || Inp.held[10]==1 || Inp.held[4]==1) // A, X or Start
\r
93 //FileMenu.getFilePath(RomName);
\r
95 //LoopMode=8; // Go to game
\r
98 if (Inp.held[7]==1) LoopMode=8; // Right thumb = Toggle Menu
\r
103 static int MenuRender()
\r
105 WCHAR text[80]={0};
\r
106 wsprintfW(text,L"%.40S v%x.%.3x",AppName,PicoVer>>12,PicoVer&0xfff);
\r
107 FontSetColour(0x60c0ff);
\r
108 FontText(text,64,48);
\r
116 // ----------------------------------------------------------------
\r
118 static int ModeUpdate()
\r
120 if (Inp.held[14] && Inp.held[15] && Inp.held[12]==1) LoopQuit=1; // L+R+black to quit:
\r
121 if (Inp.button[4]>30 && Inp.button[5]>30) LoopQuit=1; // Start and back to quit
\r
123 if (LoopMode==8) { DoGame(); return 0; }
\r
125 if (DSoundNext) memset(DSoundNext,0,PsndLen<<2);
\r
127 // if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; }
\r
128 // if (LoopMode==3) { MenuUpdate(); return 0; }
\r
129 // if (LoopMode==4) { LightCalUpdate(); return 0; }
\r
131 LoopMode=2; // Unknown mode, go to rom menu
\r
136 static int ModeRender()
\r
139 // if (LoopMode==3) MenuRender();
\r
140 // if (LoopMode==4) LightCalRender();
\r
145 static void UpdateSound(int len)
\r
147 if(fastForward) return;
\r
148 while (DSoundUpdate()) { Sleep(1); }
\r
149 while (DSoundUpdate()==0) { }
\r
170 // -------------------------------------------------------------------------------------
\r
173 extern "C" int dprintf(char *format, ...)
\r
179 name="d:\\zout.txt";
\r
184 if (DebugFile==NULL) DebugFile=fopen(name,"wt");
\r
185 if (DebugFile==NULL) return 1;
\r
187 fprintf(DebugFile, "%05i: ", emu_frame);
\r
188 va_start(val,format);
\r
189 vfprintf(DebugFile,format,val);
\r
190 fprintf(DebugFile, "\n");
\r
198 extern "C" int dprintf2(char *format, ...)
\r
203 va_start(val,format);
\r
204 vsprintf(str,format,val);
\r
206 OutputDebugString(str);
\r