Beispiel #1
0
void main( int argc, char *argv[] ) {
    Parameters          param;
    ExeFile             exeFile;
    bool                ret;

    ret = true;
    defaultParam( &param );
    exeFile.file = NULL;
    exeFile.tabEnt = NULL;

    printBanner();
    if( argc > 1 ) {
        ret = loadParam( &param, argc, argv );
    } else {
        printHelp();
        ret = false;
    }

    if( ret )   ret = openExeFile( &exeFile, &param );
    if( ret )   ret = readExeHeaders( &exeFile );
    if( ret )   {
                printDosHeader( &exeFile, &param );
                printPeHeader( &exeFile, &param );
                ret = findResourceObject( &exeFile );
    }
    if( ret )   ret = loadAllResources( &exeFile );
    if( ret )   {
                printResObject( &exeFile, &param );
                printTableContents( exeFile.tabEnt, &exeFile,
                                    &param, exeFile.resObj.physical_offset,
                                    0 );
    }
    freeAllResources( &exeFile );
}
Beispiel #2
0
void acceptFunc(){
    dialog->close();
    setResourceLocation("games/"+gameDirs[combo->currentIndex()]+"/");
    MainWindow::getInstance()->viewport->makeCurrent();
    loadAllResources();
    MainWindow::getInstance()->updateAvailableObjects();
    MainWindow::getInstance()->viewport->world = new World();
    MainWindow::getInstance()->viewport->world->addObject(getWorldObject("prop:vanilla:blaster"));
    MainWindow::getInstance()->viewport->setupCamera();
}
Beispiel #3
0
int initEverything( void )
{
#ifndef _DEBUG
	logFile = SDL_RWFromFile( "log.txt", "w" );
	if( logFile != NULL ) {
		SDL_LogSetOutputFunction( LogOutput, NULL );
	}
#endif

	// memory first, won't be used everywhere at first so lets keep the initial allocation low, 64 MB
	mem_Init( 64 * 1024 * 1024 );

	/* then SDL */
	SDL_SetMainReady( );
	if( SDL_Init( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS ) != 0 ) {
		SDL_LogError( SDL_LOG_CATEGORY_APPLICATION, SDL_GetError( ) );
		return -1;
	}
	SDL_LogInfo( SDL_LOG_CATEGORY_APPLICATION, "SDL successfully initialized" );
	atexit( cleanUp );

	// set up opengl
	// try opening and parsing the config file
	int majorVersion;
	int minorVersion;
	int redSize;
	int greenSize;
	int blueSize;
	int depthSize;

	void* oglCFGFile = cfg_OpenFile( "opengl.cfg" );
	cfg_GetInt( oglCFGFile, "MAJOR", 3, &majorVersion );
	cfg_GetInt( oglCFGFile, "MINOR", 3, &minorVersion );
	cfg_GetInt( oglCFGFile, "RED_SIZE", 8, &redSize );
	cfg_GetInt( oglCFGFile, "GREEN_SIZE", 8, &greenSize );
	cfg_GetInt( oglCFGFile, "BLUE_SIZE", 8, &blueSize );
	cfg_GetInt( oglCFGFile, "DEPTH_SIZE", 16, &depthSize );
	cfg_CloseFile( oglCFGFile );

	majorVersion = 2;
	minorVersion = 1;
	// want the core functionality
	SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
	SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, majorVersion );
	SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, minorVersion );
	// want 8 bits minimum per color
	SDL_GL_SetAttribute( SDL_GL_RED_SIZE, redSize );
    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, greenSize );
    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, blueSize );
	// want 16 bit depth buffer
    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, depthSize );
	// want it to be double buffered
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

	window = SDL_CreateWindow( windowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
		WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );
	if( window == NULL ) {
		SDL_LogError( SDL_LOG_CATEGORY_VIDEO, SDL_GetError( ) );
		return -1;
	}
	SDL_LogInfo( SDL_LOG_CATEGORY_APPLICATION, "SDL OpenGL window successfully created" );

	/* Load and create images */
	if( gfx_Init( window ) < 0 ) {
		return -1;
	}
	SDL_LogInfo( SDL_LOG_CATEGORY_APPLICATION, "Rendering successfully initialized" );

	/* Load and create sounds and music */
	if( initMixer( ) < 0 ) {
		return -1;
	}
	SDL_LogInfo( SDL_LOG_CATEGORY_APPLICATION, "Mixer successfully initialized" );

	cam_Init( );
	cam_SetProjectionMatrices( window );
	SDL_LogInfo( SDL_LOG_CATEGORY_APPLICATION, "Cameras successfully initialized" );

	loadAllResources( );

	return 0;
}