Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | |
2 | #include <stdlib.h> |
||
3 | |||
4 | #ifdef _WIN32 |
||
5 | #include <io.h> |
||
6 | #include <stdio.h> |
||
7 | #include <windows.h> |
||
8 | #endif |
||
9 | |||
18 | pmbaty | 10 | #include "brender.h" |
1 | pmbaty | 11 | |
18 | pmbaty | 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 | |||
29 | int main (int argc, char *argv[]) |
||
30 | { |
||
1 | pmbaty | 31 | #ifdef _WIN32 |
32 | /* Attach to the console that started us if any */ |
||
18 | pmbaty | 33 | if (AttachConsole (ATTACH_PARENT_PROCESS)) |
34 | { |
||
35 | /* We attached successfully, lets redirect IO to the consoles handles if not already redirected */ |
||
36 | if (_fileno (stdout) == -2 || _get_osfhandle (_fileno (stdout)) == -2) |
||
37 | { |
||
38 | freopen ("CONOUT$", "w", stdout); |
||
39 | } |
||
1 | pmbaty | 40 | |
18 | pmbaty | 41 | if (_fileno (stderr) == -2 || _get_osfhandle (_fileno (stderr)) == -2) |
42 | { |
||
43 | freopen ("CONOUT$", "w", stderr); |
||
44 | } |
||
1 | pmbaty | 45 | |
18 | pmbaty | 46 | if (_fileno (stdin) == -2 || _get_osfhandle (_fileno (stdin)) == -2) |
47 | { |
||
48 | freopen ("CONIN$", "r", stdin); |
||
49 | } |
||
50 | } |
||
1 | pmbaty | 51 | #endif |
52 | |||
18 | pmbaty | 53 | Harness_Init (&argc, argv); |
1 | pmbaty | 54 | |
18 | pmbaty | 55 | return original_main (argc, argv); |
1 | pmbaty | 56 | } |
57 | |||
58 | #ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint |
||
59 | int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { |
||
60 | return main(__argc, __argv); |
||
61 | } |
||
18 | pmbaty | 62 | #endif // _WIN32 |