1 /*----------------
2 Stuff to finish:
3
4 It wouldn't be a stretch of the imagination to think the whole of the sdl 'port' needs a redo but here are the main things wrong with this version:
5
6
7 There is OSD of any kind which makes it hard to display info to the users.
8 There are lots of problems with the audio output code.
9 There are lots of problems with the opengl renderer
10 probably many other things.
11 ------------------*/
12 #include "burner.h"
13
14 int nAppVirtualFps = 6000; // App fps * 100
15 bool bRunPause=0;
16 bool bAlwaysProcessKeyboardInput=0;
17
CheckFirstTime()18 void CheckFirstTime()
19 {
20
21 }
22
ProcessCommandLine(int argc,char * argv[])23 void ProcessCommandLine(int argc, char *argv[])
24 {
25
26 }
27
28 #undef main
29
main(int argc,char * argv[])30 int main(int argc, char *argv[])
31 {
32 UINT32 i=0;
33
34 ConfigAppLoad();
35
36 CheckFirstTime(); // check for first time run
37
38 SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO);
39
40 BurnLibInit();
41
42 SDL_WM_SetCaption( "FBA, SDL port.", "FBA, SDL port.");
43 SDL_ShowCursor(SDL_DISABLE);
44
45 if (argc < 2)
46 {
47 int c;
48 printf ("Usage: fbasdl <romname>\n ie: fbasdl uopoko\n Note: no extension.\n\n");
49
50 return 0;
51 }
52
53 if (argc == 2)
54 {
55 for (i = 0; i < nBurnDrvCount; i++) {
56 //nBurnDrvSelect[0] = i;
57 nBurnDrvActive = i;
58 if (strcmp(BurnDrvGetTextA(0), argv[1]) == 0) {
59 break;
60 }
61 }
62
63 if (i == nBurnDrvCount) {
64 printf("%s is not supported by FB Alpha.",argv[1]);
65 return 1;
66 }
67 }
68
69 bBurnUseASMCPUEmulation = 0;
70 bCheatsAllowed = false;
71 ConfigAppLoad();
72 ConfigAppSave();
73
74 DrvInit(i, 0);
75
76 RunMessageLoop();
77
78 DrvExit();
79 MediaExit();
80
81 ConfigAppSave();
82 BurnLibExit();
83 //SDL_Quit();
84
85 return 0;
86 }
87
88
ANSIToTCHAR(const char * pszInString,TCHAR * pszOutString,int nOutSize)89 /* const */ TCHAR* ANSIToTCHAR(const char* pszInString, TCHAR* pszOutString, int nOutSize)
90 {
91 #if defined (UNICODE)
92 static TCHAR szStringBuffer[1024];
93
94 TCHAR* pszBuffer = pszOutString ? pszOutString : szStringBuffer;
95 int nBufferSize = pszOutString ? nOutSize * 2 : sizeof(szStringBuffer);
96
97 if (MultiByteToWideChar(CP_ACP, 0, pszInString, -1, pszBuffer, nBufferSize)) {
98 return pszBuffer;
99 }
100
101 return NULL;
102 #else
103 if (pszOutString) {
104 _tcscpy(pszOutString, pszInString);
105 return pszOutString;
106 }
107
108 return (TCHAR*)pszInString;
109 #endif
110 }
111
112
TCHARToANSI(const TCHAR * pszInString,char * pszOutString,int nOutSize)113 /* const */ char* TCHARToANSI(const TCHAR* pszInString, char* pszOutString, int nOutSize)
114 {
115 #if defined (UNICODE)
116 static char szStringBuffer[1024];
117 memset(szStringBuffer, 0, sizeof(szStringBuffer));
118
119 char* pszBuffer = pszOutString ? pszOutString : szStringBuffer;
120 int nBufferSize = pszOutString ? nOutSize * 2 : sizeof(szStringBuffer);
121
122 if (WideCharToMultiByte(CP_ACP, 0, pszInString, -1, pszBuffer, nBufferSize, NULL, NULL)) {
123 return pszBuffer;
124 }
125
126 return NULL;
127 #else
128 if (pszOutString) {
129 strcpy(pszOutString, pszInString);
130 return pszOutString;
131 }
132
133 return (char*)pszInString;
134 #endif
135 }
136
137
AppProcessKeyboardInput()138 bool AppProcessKeyboardInput()
139 {
140 return true;
141 }
142