Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18 | Rev 20 | ||
---|---|---|---|
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 |
|
10 | extern void Harness_Init(int* argc, char* argv[]); |
- | 11 | extern int original_main(int pArgc, char* pArgv[]); |
|
11 | 12 | ||
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 |
13 | int main(int argc, char* argv[]) { |
30 | { |
- | |
31 | #ifdef _WIN32 |
14 | #ifdef _WIN32 |
32 | /* Attach to the console that started us if any */ |
15 | /* Attach to the console that started us if any */ |
33 | if (AttachConsole |
16 | if (AttachConsole(ATTACH_PARENT_PROCESS)) { |
34 | { |
- | |
35 | /* We attached successfully, lets redirect IO to the consoles handles if not already redirected */ |
17 | /* We attached successfully, lets redirect IO to the consoles handles if not already redirected */ |
36 | if (_fileno |
18 | if (_fileno(stdout) == -2 || _get_osfhandle(_fileno(stdout)) == -2) { |
37 | { |
- | |
38 | freopen |
19 | freopen("CONOUT$", "w", stdout); |
39 | } |
20 | } |
40 | 21 | ||
41 | if (_fileno |
22 | if (_fileno(stderr) == -2 || _get_osfhandle(_fileno(stderr)) == -2) { |
42 | { |
- | |
43 | freopen |
23 | freopen("CONOUT$", "w", stderr); |
44 | } |
24 | } |
45 | 25 | ||
46 | if (_fileno |
26 | if (_fileno(stdin) == -2 || _get_osfhandle(_fileno(stdin)) == -2) { |
47 | { |
- | |
48 | freopen |
27 | freopen("CONIN$", "r", stdin); |
49 | } |
28 | } |
50 | } |
29 | } |
51 | #endif |
30 | #endif |
52 | 31 | ||
53 | Harness_Init |
32 | Harness_Init(&argc, argv); |
54 | 33 | ||
55 | return original_main |
34 | return original_main(argc, argv); |
56 | } |
35 | } |
57 | 36 | ||
58 | #ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint |
37 | #ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint |
59 | int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { |
38 | int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { |
60 | return main(__argc, __argv); |
39 | return main(__argc, __argv); |