Subversion Repositories Games.Carmageddon

Rev

Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 18
Line 5... Line 5...
5
#include <io.h>
5
#include <io.h>
6
#include <stdio.h>
6
#include <stdio.h>
7
#include <windows.h>
7
#include <windows.h>
8
#endif
8
#endif
9
 
9
 
10
extern void Harness_Init(int* argc, char* argv[]);
10
#include "brender.h"
11
extern int original_main(int pArgc, char* pArgv[]);
-
 
12
 
11
 
-
 
12
extern void Harness_Init (int *argc, char *argv[]);
-
 
13
extern int original_main (int pArgc, char *pArgv[]);
-
 
14
 
-
 
15
void BR_CALLBACK _BrBeginHook (void)
-
 
16
{
-
 
17
   struct br_device *BR_EXPORT BrDrv1SoftPrimBegin (char *arguments);
-
 
18
   struct br_device *BR_EXPORT BrDrv1SoftRendBegin (char *arguments);
-
 
19
 
-
 
20
   BrDevAddStatic (NULL, BrDrv1SoftPrimBegin, NULL);
-
 
21
   BrDevAddStatic (NULL, BrDrv1SoftRendBegin, NULL);
-
 
22
   // BrDevAddStatic(NULL, BrDrv1SDL2Begin, NULL);
-
 
23
}
-
 
24
 
-
 
25
void BR_CALLBACK _BrEndHook (void)
-
 
26
{
-
 
27
}
-
 
28
 
13
int main(int argc, char* argv[]) {
29
int main (int argc, char *argv[])
-
 
30
{
14
#ifdef _WIN32
31
#ifdef _WIN32
15
    /* Attach to the console that started us if any */
32
    /* Attach to the console that started us if any */
16
    if (AttachConsole(ATTACH_PARENT_PROCESS)) {
33
   if (AttachConsole (ATTACH_PARENT_PROCESS))
-
 
34
   {
17
        /* We attached successfully, lets redirect IO to the consoles handles if not already redirected */
35
/* We attached successfully, lets redirect IO to the consoles handles if not already redirected */
18
        if (_fileno(stdout) == -2 || _get_osfhandle(_fileno(stdout)) == -2) {
36
      if (_fileno (stdout) == -2 || _get_osfhandle (_fileno (stdout)) == -2)
-
 
37
      {
19
            freopen("CONOUT$", "w", stdout);
38
         freopen ("CONOUT$", "w", stdout);
20
        }
39
      }
21
 
40
 
22
        if (_fileno(stderr) == -2 || _get_osfhandle(_fileno(stderr)) == -2) {
41
      if (_fileno (stderr) == -2 || _get_osfhandle (_fileno (stderr)) == -2)
-
 
42
      {
23
            freopen("CONOUT$", "w", stderr);
43
         freopen ("CONOUT$", "w", stderr);
24
        }
44
      }
25
 
45
 
26
        if (_fileno(stdin) == -2 || _get_osfhandle(_fileno(stdin)) == -2) {
46
      if (_fileno (stdin) == -2 || _get_osfhandle (_fileno (stdin)) == -2)
-
 
47
      {
27
            freopen("CONIN$", "r", stdin);
48
         freopen ("CONIN$", "r", stdin);
28
        }
49
      }
29
    }
50
   }
30
#endif
51
#endif
31
 
52
 
32
    Harness_Init(&argc, argv);
53
   Harness_Init (&argc, argv);
33
 
54
 
34
    return original_main(argc, argv);
55
   return original_main (argc, argv);
35
}
56
}
36
 
57
 
37
#ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint
58
#ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint
38
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
59
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
39
   return main(__argc, __argv);
60
   return main(__argc, __argv);