#include <stdlib.h>
#ifdef _WIN32
#include <io.h>
#include <stdio.h>
#include <windows.h>
#endif
#include "brender.h"
extern void Harness_Init (int *argc, char *argv[]);
extern int original_main (int pArgc, char *pArgv[]);
void BR_CALLBACK _BrBeginHook (void)
{
struct br_device *BR_EXPORT BrDrv1SoftPrimBegin (char *arguments);
struct br_device *BR_EXPORT BrDrv1SoftRendBegin (char *arguments);
BrDevAddStatic (NULL, BrDrv1SoftPrimBegin, NULL);
BrDevAddStatic (NULL, BrDrv1SoftRendBegin, NULL);
// BrDevAddStatic(NULL, BrDrv1SDL2Begin, NULL);
}
void BR_CALLBACK _BrEndHook (void)
{
}
int main (int argc, char *argv[])
{
#ifdef _WIN32
/* Attach to the console that started us if any */
if (AttachConsole (ATTACH_PARENT_PROCESS))
{
/* We attached successfully, lets redirect IO to the consoles handles if not already redirected */
if (_fileno (stdout) == -2 || _get_osfhandle (_fileno (stdout)) == -2)
{
}
if (_fileno (stderr) == -2 || _get_osfhandle (_fileno (stderr)) == -2)
{
}
if (_fileno (stdin) == -2 || _get_osfhandle (_fileno (stdin)) == -2)
{
}
}
#endif
Harness_Init (&argc, argv);
return original_main (argc, argv);
}
#ifdef _WIN32 // Pierre-Marie Baty -- missing entrypoint
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
return main(__argc, __argv);
}
#endif // _WIN32