2 //#include "FileMenu.h"
\r
5 static FILE *DebugFile=NULL;
\r
7 static void UpdateSound(int len);
\r
14 // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
\r
15 // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites
\r
20 ret=DirectInit(); if (ret) { error("DirectX video init failed"); return 1; }
\r
23 // Init DirectSound:
\r
26 ret=EmuInit(); if (ret) return 1;
\r
30 PicoWriteSound = UpdateSound;
\r
35 extern "C" char *debugString();
\r
39 dprintf(debugString());
\r
43 DSoundExit(); PsndLen=0;
\r
47 if (DebugFile) fclose(DebugFile);
\r
51 // ----------------------------------------------------------------
\r
57 if (Inp.held[7]==1) LoopMode=2; // Right thumb = Toggle Menu
\r
61 // ----------------------------------------------------------------
\r
64 static int MenuUpdate()
\r
68 if (Inp.repeat[0]) delta-=0x100;
\r
69 if (Inp.repeat[1]) delta+=0x100;
\r
71 if (Inp.button[14]>30) delta-=Inp.button[14]-30;
\r
72 if (Inp.button[15]>30) delta+=Inp.button[15]-30;
\r
74 if (delta) FileMenu.scroll(delta);
\r
76 if (Inp.held[8]==1 || Inp.held[10]==1 || Inp.held[4]==1) // A, X or Start
\r
79 //FileMenu.getFilePath(RomName);
\r
81 //LoopMode=8; // Go to game
\r
84 if (Inp.held[7]==1) LoopMode=8; // Right thumb = Toggle Menu
\r
89 static int MenuRender()
\r
92 wsprintfW(text,L"%.40S v%x.%.3x",AppName,PicoVer>>12,PicoVer&0xfff);
\r
93 FontSetColour(0x60c0ff);
\r
94 FontText(text,64,48);
\r
102 // ----------------------------------------------------------------
\r
104 static int ModeUpdate()
\r
106 if (Inp.held[14] && Inp.held[15] && Inp.held[12]==1) LoopQuit=1; // L+R+black to quit:
\r
107 if (Inp.button[4]>30 && Inp.button[5]>30) LoopQuit=1; // Start and back to quit
\r
109 if (LoopMode==8) { DoGame(); return 0; }
\r
111 // if (DSoundNext) memset(DSoundNext,0,PsndLen<<2);
\r
113 // if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; }
\r
114 // if (LoopMode==3) { MenuUpdate(); return 0; }
\r
115 // if (LoopMode==4) { LightCalUpdate(); return 0; }
\r
117 LoopMode=2; // Unknown mode, go to rom menu
\r
122 static int ModeRender()
\r
125 // if (LoopMode==3) MenuRender();
\r
126 // if (LoopMode==4) LightCalRender();
\r
131 static void UpdateSound(int len)
\r
133 while (DSoundUpdate() > 0) { Sleep(1); }
\r
134 while (DSoundUpdate()== 0) { }
\r
155 // -------------------------------------------------------------------------------------
\r
158 extern "C" int dprintf(char *format, ...)
\r
164 name="d:\\zout.txt";
\r
169 if (DebugFile==NULL) DebugFile=fopen(name,"wt");
\r
170 if (DebugFile==NULL) return 1;
\r
172 fprintf(DebugFile, "%05i: ", emu_frame);
\r
173 va_start(val,format);
\r
174 vfprintf(DebugFile,format,val);
\r
175 fprintf(DebugFile, "\n");
\r
183 extern "C" int dprintf2(char *format, ...)
\r
188 va_start(val,format);
\r
189 vsprintf(str,format,val);
\r
191 OutputDebugString(str);
\r