OpenBarnyard
 
Loading...
Searching...
No Matches
AppBoot.cpp File Reference

Go to the source code of this file.

Macros

#define TOSHI_ENTRY   int main( int argc, TCHAR** argv )
 

Functions

int main (int argc, TCHAR **argv)
 

Variables

AApplication g_oTheApp
 

Macro Definition Documentation

◆ TOSHI_ENTRY

#define TOSHI_ENTRY   int main( int argc, TCHAR** argv )

Definition at line 36 of file AppBoot.cpp.

Function Documentation

◆ main()

int main ( int argc,
TCHAR ** argv )

Definition at line 66 of file AppBoot.cpp.

67{
68 static AToshiClassReferenceHelper s_ToshiClassReferencer;
69 static TMemoryInitialiser s_MemoryInitialiser;
70
71 TCHAR* szCommandLine = GetCommandLineA();
72
73 TUtil::TOSHIParams toshiParams;
74 toshiParams.szCommandLine = szCommandLine;
75 toshiParams.szLogFileName = "barnyard";
76
77 TUtil::ToshiCreate( toshiParams );
78
79 g_oSystemManager.SetQuitCallback( []() {
81 exit( 0 );
82 } );
83
85 TUtil::Log( "Build Version %s\n", "0.28" );
86
87 OSVERSIONINFOEX osVersionInfo = { sizeof( osVersionInfo ) };
88
89 const TCHAR* osName = "unknown";
90 HMODULE ntdll = GetModuleHandleW( L"ntdll.dll" );
91
92 if ( ntdll != NULL )
93 {
94 typedef void( WINAPI * t_RtlGetVersion )( OSVERSIONINFOEX* );
95 auto RtlGetVersion = TREINTERPRETCAST( t_RtlGetVersion, GetProcAddress( ntdll, "RtlGetVersion" ) );
96
97 if ( RtlGetVersion != NULL )
98 {
99 RtlGetVersion( &osVersionInfo );
100 osName = GetOSName( osVersionInfo );
101 }
102 }
103
104 TUtil::Log( "Command Line: %s\n", szCommandLine );
105 TUtil::Log( "OS Name: %s\n", osName );
106 TUtil::Log( "OS Version: %d.%d Build:%d %s\n", osVersionInfo.dwMajorVersion, osVersionInfo.dwMinorVersion, osVersionInfo.dwBuildNumber, osVersionInfo.szCSDVersion );
107
108 TUtil::GetGlobalMutex() = CreateMutexA( NULL, TTRUE, "BARNYARD" );
109
110 if ( GetLastError() == ERROR_ALREADY_EXISTS )
111 {
112 MessageBoxA( NULL, "Game is already running", "Barnyard", MB_OK );
113 return 0;
114 }
115
116 if ( g_oTheApp.Create( "The Barnyard - (c) Blue Tongue Entertainment", 0, 0 ) )
117 {
118 g_oTheApp.Execute();
119 }
120
122
123 return 0;
124}
#define TREINTERPRETCAST(TYPE, VALUE)
Definition Defines.h:68
char TCHAR
Definition Typedefs.h:20
#define TTRUE
Definition Typedefs.h:25
AApplication g_oTheApp
Definition AppBoot.cpp:31
TSystemManager g_oSystemManager
Definition TSystem.cpp:15
static void Log(const TCHAR *a_szFormat,...)
Definition TUtil.cpp:65
static TBOOL ToshiCreate(const TOSHIParams &a_rToshiParams)
Definition TUtil.cpp:149
static TMutex & GetGlobalMutex()
Definition TUtil.h:119
static void ToshiDestroy()
Definition TUtil.cpp:167
const TCHAR * szCommandLine
Definition TUtil.h:61
const TCHAR * szLogFileName
Definition TUtil.h:62
@ POOL_StringPool
Definition AMemory.h:34
static void CreatePool(POOL a_ePool)
Definition AMemory.cpp:12

Variable Documentation

◆ g_oTheApp

AApplication g_oTheApp

Definition at line 31 of file AppBoot.cpp.