Ejemplo n.º 1
0
void display()
{
	glViewport(0, 0, 640, 480);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  MenuContext *mc = kengine->userInput->Menu();

  if (mc == 0)
  {
    // Draw all 3D-placed objects
    kengine->shader->Enable();
	  glEnable(GL_DEPTH_TEST);
    // Send new values to the shaders
	  glUniform3fv(kengine->shader->eye, 1, (GLfloat*) kengine->c[kengine->activeCamera]->GetPosition());
	  glUniformMatrix4fv(kengine->shader->mat_camera, 1, GL_FALSE, (GLfloat*) kengine->c[kengine->activeCamera]->Matrix());
	  glUniformMatrix4fv(kengine->shader->mat_projection, 1, GL_FALSE, (GLfloat*) kengine->_projection->Matrix());

    kengine->_levelMgr->Render(kengine->c[kengine->activeCamera], kengine->shader);

    glUseProgram(0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glOrtho(0,640,0,480,-5,5);
    glTranslatef(0.f, 460.f, 0.f);
    glScalef(1.f, -1.f, 1.f);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    glDisable(GL_TEXTURE);
    glDisable(GL_TEXTURE_2D);
    kengine->userInput->InGameHUD()->Render();
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_TEXTURE);
    glEnable(GL_LIGHTING);
  }
  else
  {
    glUseProgram(0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glOrtho(0,640,0,480,-5,5);
    glTranslatef(0.f, 460.f, 0.f);
    glScalef(1.f, -1.f, 1.f);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    glDisable(GL_TEXTURE);
    glDisable(GL_TEXTURE_2D);
    mc->Render();
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_TEXTURE);
    glEnable(GL_LIGHTING);
  }
  // Time to draw the HUD!
  //glDisable(GL_DEPTH_TEST);

	glutSwapBuffers();
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]) 
{
	/* INITIALIZE */
#ifdef HW_RVL
	DI_UseCache(false);
	if (!__di_check_ahbprot()) {
		s32 preferred = IOS_GetPreferredVersion();
		if (preferred == 58 || preferred == 61)
			IOS_ReloadIOS(preferred);
		else DI_LoadDVDX(true);
	}
	
	DI_Init();    // first
#endif
	
	loadSettings(argc, argv);
	MenuContext *menu = new MenuContext(vmode);
	VIDEO_SetPostRetraceCallback (ScanPADSandReset);

#ifndef WII
	DVD_Init();
#endif

#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	control_info_init(); //Perform controller auto assignment at least once at startup.

	// Start up AESND (inited here because its used in SPU and CD)
	AESND_Init();

#ifdef HW_RVL
	// Initialize the network if the user has specified something in their SMB settings
	if(strlen(&smbShareName[0]) && strlen(&smbIpAddr[0])) {
	  init_network_thread();
  }
#endif
	
	while (menu->isRunning()) {}
	
	// Shut down AESND
	AESND_Reset();

	delete menu;

	return 0;
}
Ejemplo n.º 3
0
int main(int argc, char* argv[]){
	/* INITIALIZE */
#ifdef HW_RVL
  DI_Init();    // first
#endif

#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	Initialise(); // Stock OGC initialization
//	vmode = VIDEO_GetPreferredMode(NULL);
	MenuContext *menu = new MenuContext(vmode);
	VIDEO_SetPostRetraceCallback (ScanPADSandReset);
#ifndef WII
	DVD_Init();
#endif
//	menuInit();
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
//	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
//	_break();
#endif

	// Default Settings
	audioEnabled     = 1; // Audio
#ifdef RELEASE
	showFPSonScreen  = 0; // Show FPS on Screen
#else
	showFPSonScreen  = 1; // Show FPS on Screen
#endif
	printToScreen    = 1; // Show DEBUG text on screen
	printToSD        = 0; // Disable SD logging
	Timers.limitVIs  = 0; // Sync to Audio
	saveEnabled      = 0; // Don't save game
	nativeSaveDevice = 0; // SD
	saveStateDevice	 = 0; // SD
	autoSave         = 1; // Auto Save Game
	creditsScrolling = 0; // Normal menu for now
	dynacore         = 1; // Dynarec
	screenMode		 = 0; // Stretch FB horizontally
	padAutoAssign	 = PADAUTOASSIGN_AUTOMATIC;
	padType[0]		 = PADTYPE_NONE;
	padType[1]		 = PADTYPE_NONE;
	padType[2]		 = PADTYPE_NONE;
	padType[3]		 = PADTYPE_NONE;
	padAssign[0]	 = PADASSIGN_INPUT0;
	padAssign[1]	 = PADASSIGN_INPUT1;
	padAssign[2]	 = PADASSIGN_INPUT2;
	padAssign[3]	 = PADASSIGN_INPUT3;
	pakMode[0]		 = PAKMODE_MEMPAK; // memPak plugged into controller 1
	pakMode[1]		 = PAKMODE_MEMPAK;
	pakMode[2]		 = PAKMODE_MEMPAK;
	pakMode[3]		 = PAKMODE_MEMPAK;
	loadButtonSlot	 = LOADBUTTON_DEFAULT;
#ifdef GLN64_GX
// glN64 specific  settings
 	glN64_useFrameBufferTextures = 0; // Disable FrameBuffer textures
	glN64_use2xSaiTextures = 0;	// Disable 2xSai textures
	renderCpuFramebuffer = 0; // Disable CPU Framebuffer Rendering
#endif //GLN64_GX
	menuActive = 1;

	//config stuff
	fileBrowser_file* configFile_file;
	int (*configFile_init)(fileBrowser_file*) = fileBrowser_libfat_init;
#ifdef HW_RVL
	if(argv[0][0] == 'u') {  //assume USB
		configFile_file = &saveDir_libfat_USB;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "usb:/wii64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "usb:/wii64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
#endif
	{ //assume SD
		configFile_file = &saveDir_libfat_Default;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "sd:/wii64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "sd:/wii64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
#ifdef HW_RVL
	// Handle options passed in through arguments
	int i;
	for(i=1; i<argc; ++i){
		handleConfigPair(argv[i]);
	}
#endif
	while (menu->isRunning()) {}

	delete menu;

	return 0;
}
Ejemplo n.º 4
0
uint8_t UserInput::KeyboardRead(MenuContext& status)
{
	//shift last readings
	cPB[0]=cPB[1];
	cPB[1]=cPB[2];
	cPB[2]= sampleButtons(&sample);
	//3 scans for debounce
	if ((cPB[0]==cPB[1]) && (cPB[0]==cPB[2]))
	{
		if (cScanCode != cPB[2])
		{
			status.setContextBits(PB_DELTA);
			cScanCode = cPB[2];
		}
	}

	//here there is a key press or key release
	if (status.getContext() & PB_DELTA)
	{
		status.clrContextBits(PB_DELTA);
		//clear the calling flag
		//and start the timer with the initial period, i.e. for the 1st 1 sec nothing happens
		status.setTimer(T_KEYBOARD_REPEAT, TYPEMATIC_INITIAL);
		status.setKeyboardIncrement(1);		//inititlise the increment
		//(it can be 1, 10, 100, & 1000 & 10000)
		cKeyboardLoopCounter = 1;
		//number of loops before the KeyboardIncrement is incremented
		status.setContextBits(KEYBOARD_VALID);
		status.setTimer(T_KEYBOARD_TIMEOUT, KEYBOARD_TIMEOUT);
		//refresh timer

		//table defined scanCode to KeyCode translation
		if (bitRead(cScanCode,0)) {
			cKeyboardCode = K_NOUSE;
		} else if (bitRead(cScanCode,1)) {
			cKeyboardCode = K_OK;
		} else if (bitRead(cScanCode,2)) {
			cKeyboardCode = K_UP;
		} else if (bitRead(cScanCode,3)) {
			cKeyboardCode = K_DOWN;
		} else if (bitRead(cScanCode,4)) {
			cKeyboardCode = K_RIGHT;
		} else if (bitRead(cScanCode,5)) {
			cKeyboardCode = K_LEFT;
		} else {
			cKeyboardCode = 0x00;
			status.clrContextBits(KEYBOARD_VALID);
				//not a valid code
		}

	} else {
	//key hold, check for typematic increases
		if (((cKeyboardCode==K_UP) || (cKeyboardCode==K_DOWN)) && (cScanCode != IDLE_SCAN))
		{//only if up or down
			if (status.getTimer(T_KEYBOARD_REPEAT) == 0)
			{// only when time is up
				cKeyboardLoopCounter++;
				if (cKeyboardLoopCounter > TYPEMATIC_STEP)
				{
					cKeyboardLoopCounter = 1;
					status.raiseKeyboardIncrement();
				}
				status.setTimer(T_KEYBOARD_REPEAT, TYPEMATIC);
				status.setContextBits(KEYBOARD_VALID);
			}
		}
	}
	status.setKeyboardCode(cKeyboardCode);
	return cKeyboardCode;
}
Ejemplo n.º 5
0
int main(int argc, char* argv[]){
	/* INITIALIZE */
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	Initialise(); // Stock OGC initialization
//	vmode = VIDEO_GetPreferredMode(NULL);
#ifndef WII
	DVD_Init();
#endif
//	menuInit();
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
//	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
//	_break();
#endif

	// Default Settings
	audioEnabled     = 1; // Audio
	scalePitch       = 1;
#ifdef RELEASE
	showFPSonScreen  = 0; // Show FPS on Screen
#else
	showFPSonScreen  = 1; // Show FPS on Screen
#endif
	printToScreen    = 1; // Show DEBUG text on screen
	printToSD        = 0; // Disable SD logging
	Timers.limitVIs  = 1;
	autoSave         = 1; // Auto Save Game
	dynacore         = 1; // Dynarec
#ifndef HW_RVL
	screenMode		 = 0; // Stretch FB horizontally
#else
	screenMode		 = CONF_GetAspectRatio() == CONF_ASPECT_16_9 ? SCREENMODE_16x9_PILLARBOX : SCREENMODE_4x3;
#endif
	videoMode		 = VIDEOMODE_AUTO;
	trapFilter		 = TRAPFILTER_DISABLE;
	padAutoAssign	 = PADAUTOASSIGN_AUTOMATIC;
	padType[0]		 = PADTYPE_NONE;
	padType[1]		 = PADTYPE_NONE;
	padType[2]		 = PADTYPE_NONE;
	padType[3]		 = PADTYPE_NONE;
	padAssign[0]	 = PADASSIGN_INPUT0;
	padAssign[1]	 = PADASSIGN_INPUT1;
	padAssign[2]	 = PADASSIGN_INPUT2;
	padAssign[3]	 = PADASSIGN_INPUT3;
	pakMode[0]		 = PAKMODE_MEMPAK; // memPak plugged into controller 1
	pakMode[1]		 = PAKMODE_MEMPAK;
	pakMode[2]		 = PAKMODE_MEMPAK;
	pakMode[3]		 = PAKMODE_MEMPAK;
	loadButtonSlot	 = LOADBUTTON_DEFAULT;
#ifdef GLN64_GX
// glN64 specific  settings
 	glN64_useFrameBufferTextures = 0; // Disable FrameBuffer textures
	glN64_use2xSaiTextures = 0;	// Disable 2xSai textures
	renderCpuFramebuffer = 0; // Disable CPU Framebuffer Rendering
#endif //GLN64_GX
	menuActive = 1;

	//config stuff
	fileBrowser_file* configFile_file;
	int (*configFile_init)(fileBrowser_file*) = fileBrowser_libfat_init;
#ifdef HW_RVL
	if(argc > 0 && argv[0][0] == 'u') {  //assume USB
		nativeSaveDevice = NATIVESAVEDEVICE_USB;
		saveStateDevice = SAVESTATEDEVICE_USB;
		configFile_file = &saveDir_libfat_USB;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "usb:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "usb:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "usb:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
#endif
	{ //assume SD
		nativeSaveDevice = NATIVESAVEDEVICE_SD;
		saveStateDevice = SAVESTATEDEVICE_SD;
		configFile_file = &saveDir_libfat_Default;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "sd:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "sd:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "sd:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	// Handle options passed in through arguments
	int i;
	for(i=1; i<argc; ++i){
		handleConfigPair(argv[i]);
	}

	MenuContext *menu = new MenuContext(vmode);

	// Initialize the network if the user has specified something in their SMB settings
	if(strlen(&smbShareName[0]) && strlen(&smbIpAddr[0])) {
		init_network_thread();
	}

	while (menu->isRunning()) {}

	delete menu;

	return 0;
}