Example #1
0
int main(int argc, char *argv[]) {
    srand(time(0));

    if(!sysInit()) return 1;
    if(!sysLoadFiles()) return 1;

    gameModeInit();
    menuInit();
    gameTitle();

    while(!quit) {
        startTimer = SDL_GetTicks();

        sysInput();
        gameLogic();
        drawEverything();

        // Update the screen
        SDL_RenderPresent(renderer);
        
        // Limit the frame rate
        endTimer = SDL_GetTicks();
        deltaTimer = endTimer - startTimer;
        if(deltaTimer < (1000/FPS))
            SDL_Delay((1000/FPS)-deltaTimer);
    }
    blockCleanup();
    sysCleanup();
}
Example #2
0
int main (int argc, char ** argv)
{ 
    nvInit();
    menuInit();

    NavEvent nav;

    while (1)
    {
        nav = navWaitForEvent();
        switch (nav)
        {
            case NAV_LEFT: menuLeft(); break;
            case NAV_RIGHT: menuRight(); break;
            case NAV_UP: menuUp(); break;
            case NAV_DOWN: menuDown(); break;
            //case NAV_TAP: menuSelect(); break;
            case NAV_ACCESS_1:
            case NAV_ACCESS_2:
            case NAV_HOTKEY_1:
            case NAV_HOTKEY_2:
            case NAV_HOTKEY_3:
            case NAV_HOTKEY_4:
            case NAV_HOTKEY_5:
            case NAV_HOTKEY_6:
            case NAV_HOTKEY_7:
            case NAV_HOTKEY_8:
            case NAV_HOTKEY_9:
            default:
                printf("Unknown NAV option\n");
                return 1;
                break;
        }
    }
}
Example #3
0
void setup() {
    configPins();
    initDisplay();
    detectInputMode();
    menuInit();
    i2cInit();
}
Example #4
0
int main(void){
	lcd_init(LCD_DISP_ON);
	menuInit();

    while(1){
        menuPollButtons();
    }
}
Example #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->dockWidget->setWidget(ui->treeWidget);
    project = childitemCreate(0);
    project->setText(0, QString("HMI"));
    image = childitemCreate(project);
    image->setText(0, "0");
    image->setText(1, "文件名");

    menuInit();
}
Example #6
0
static void init()
{
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));

    menuInit();
    readTexture(textureLocation);
    createProgram("convolution.vert", "convolution.frag");

    glEnable(GL_TEXTURE_2D);
    glClearColor(1.0, 1.0, 1.0, 1.0);
    /*glShadeModel(GL_SMOOTH);*/
    glShadeModel(GL_FLAT);
}
Example #7
0
void setup_menu (void) {                                                        // function for setup menu
  char cmd;                                                                     // variable used as buffer for debug USART and debug menu service 
  menuInit();
  printf("\n\rPress CTRL+C if you want to exit menu and continue running program\n\r");
  cmdlinePrintPrompt();
  while (1) {
    cmd=TM_USART_Getc(MENU_USART);
    if(cmd==0x03) {                                                             // check for CTRL+C keypress send from terminal emulator
      printf("\n\rCTRL+C was detected, leaving menu\n\r");
      break;
     }
    cmdlineInputFunc(cmd);
    Delay(100);
    cmdlineMainLoop();
  }   
}
Example #8
0
void sdlmenuInit(sdlMenu * pSdlMenu)
{
	Menu * pMenu;
    SDL_Color couleurBlanc = {255, 255, 255};
    SDL_Color couleurJaune = {255, 255, 0};

	pSdlMenu -> police = NULL;
    pSdlMenu -> couleur = couleurBlanc;
    pSdlMenu -> couleur2 = couleurJaune;
    TTF_Init();

    pSdlMenu -> police = TTF_OpenFont("data/erasmd.ttf", 90);
    pSdlMenu -> police2 = TTF_OpenFont("data/erasmd.ttf", 50);

	pMenu = &(pSdlMenu -> menu);
	menuInit(pMenu);

	assert(SDL_Init(SDL_INIT_EVERYTHING) != -1);

	/* Chargement de l'icône AVANT SDL_SetVideoMode */
    SDL_WM_SetIcon(SDL_LoadBMP("data/caisse.bmp"), NULL);

	pSdlMenu -> surface_ecran = SDL_SetVideoMode(ECRAN_X, ECRAN_Y, 32, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE); /* video avec double buffer */
	assert(pSdlMenu -> surface_ecran != NULL);

	SDL_WM_SetCaption("Case challenge", NULL); /* nom de la fenetre */

    /* ----------- Declaration des differentes surfaces ----- */

    pSdlMenu -> surface_text_jouer = TTF_RenderText_Blended(pSdlMenu -> police2, "Jouer", pSdlMenu -> couleur);
    pSdlMenu -> surface_text_editeur = TTF_RenderText_Blended(pSdlMenu -> police2, "Editeur", pSdlMenu -> couleur);
    pSdlMenu -> surface_text_options = TTF_RenderText_Blended(pSdlMenu -> police2, "Options", pSdlMenu -> couleur);
    pSdlMenu -> surface_text_quitter = TTF_RenderText_Blended(pSdlMenu -> police2, "Quitter", pSdlMenu -> couleur);

	pSdlMenu -> surface_fond = SDL_load_image("data/menu_bck.bmp");
	if(pSdlMenu -> surface_fond == NULL){
        pSdlMenu -> surface_fond = SDL_load_image("../data/menu_bck.bmp");
	}

    pSdlMenu -> surface_image1 = NULL;
    pSdlMenu -> surface_image2 = NULL;
    pSdlMenu -> surface_image3 = NULL;
    pSdlMenu -> surface_image4 = NULL;

}
Example #9
0
int main (void) {            
 
//-------------------------------------------------------------------------------------	
	//Variablen

	//PWM-Wert für Heizungsservos
	//MIN = 31 (1ms)
	//MAX = 63 (2ms)
	//uint16_t pwmWert=32;
	uint16_t pwmWert=62;	

	//System Modes
	enum ControllerStates
	{ 
		heatControlManualMode,
		heatControlAutoMode, 
		voltageControlMode, 
		tempInfoMode, 
		versionInfoMode
	} currentMode;
	
	//flag um zu speichern ob heat- manual oder auto mode zuletzt aktiv war
	//=1 -> Manual Mode
	//=2 -> Auto Mode
	uint8_t heatControlFlag=0;
	
	//Flags für Buttons(Menü-Button)
	//gedrückt       -> =0
	//lange gedrückt -> =2
	//ungedrückt     -> =1
	uint8_t buttonLinks=1;
	uint8_t buttonMitte=1;
	uint8_t buttonRechts=1;

	//Temperatur Variable für den Heat Control Auto Mode
	//Wert in °C
	//Uint16_t wegen Umwandlung in string mit utoa funktion
	uint16_t tempSollwert=20;

	//Variablen für die beiden Batterie-Spannungen
	uint16_t batt1Volt=0;
	uint16_t batt2Volt=0;

	//Variablen für die beiden Temperatur-Sensor Spannungen
	//Umrechnung in Temperatur erfolgt in Display Routine.
	uint16_t temp1Volt=0;
	uint16_t temp2Volt=0;

	//Variable die im Manual Heizungs Mode die Anzahl der auf dem Display dargestellten
	//"Heiz-Punkte" einstellt.
	uint8_t heizLevel=0;


//-------------------------------------------------------------------------------------	
	

	for(;;);
		
	//Initialisierungen
	sleep_disable();
		
	myInit();
	adcInit();
	pwmInit(pwmWert);
	pwmUpdate(pwmWert);
	lcd_init();
	menuInit();
	
	//set system led
	PORTD |= (1<<BIT7);

	//Start system in heat control auto mode
	//display regarding screen -> gleichbleibend heizen
	currentMode = heatControlManualMode;
	//screenHeatingManual(2, &heizLevel);
	//_delay_ms(3000);

	//enable interrupts for wakeup sleepmode
	sei();

	
//-------------------------------------------------------------------------------------
	

	while(1)  
	{   
		_delay_ms(100);


		//button links lesen
 	 	//nutzt das Debounce-Makro (debounce.h)
		if ((debounce(PIND,PD0))) 
		{
			buttonLinks=0;
		}
		else
		{
			buttonLinks=1;
		}

		//button mitte lesen
		if ((debounce(PIND,PD3)))
		{
			buttonMitte=0;
		}
		else
		{
			buttonMitte=1;
		}

		//button rechts lesen
		if ((debounce(PIND,PD2)))
		{
			buttonRechts=0;
		}
		else
		{
			buttonRechts=1;
		}
		

		//wenn buttonLinks einmal gedrückt wurde -> nächster Mode
		//heatControlFlag abfragen um zu wissen welcher heatControlMode
		//zuletzt aktiv war.
		if (buttonLinks==0)
		{	
			if (currentMode==versionInfoMode)
				if (heatControlFlag==2)
					currentMode=heatControlAutoMode;
				else 
					currentMode=heatControlManualMode;
			else
			{	
				currentMode +=1;
			}
		}


		//Mode selector
		switch (currentMode)
		{
			//---------------------------------------------------------------------------------------------
			case heatControlManualMode:
				//button links auf langen Tastendruck prüfen
				//prüfen -> kurz warten -> wenn immer noch gedrückt -> = lange gedrückt
				if ((debounce(PIND,PD0)))
				{
					_delay_ms(200);
					if ((debounce(PIND,PD0))) 
					{
						buttonLinks=2;
					}
				}
				//wenn button links lange gedrückt wurde -> wechsle in den anderen heating-mode	
				if (buttonLinks==2)
				{
					currentMode=heatControlAutoMode;
					screenHeatingAuto(tempSollwert);
				}
				//button mitte -> heizungs-level verringern (auf display und servo)
				else if (buttonMitte==0)
				{
					screenHeatingManual(0, &heizLevel);
					if (pwmWert>64)
					{
						pwmWert -= 2;
					}
					else
					{
						pwmWert=62;
					}
					pwmUpdate(pwmWert);
				}
				//button rechts -> heizungs-level erhöhen(auf display und servo)
				else if (buttonRechts==0)
				{
					screenHeatingManual(1, &heizLevel);
					if (pwmWert<118)
					{
						pwmWert += 2;
					}
					else
					{
						pwmWert=120;
					}
					pwmUpdate(pwmWert);
				}
				//wenn nichts gedrückt wurde aktuellen heizlevel auf display anzeigen
				else
				{
					screenHeatingManual(2, &heizLevel);
				}
				break;
			//---------------------------------------------------------------------------------------------
			case heatControlAutoMode:
				//button links auf langen Tastendruck prüfen
				//prüfen -> kurz warten -> wenn immer noch gedrückt -> = lange gedrückt
				if ((debounce(PIND,PD0)))
				{
					_delay_ms(100);
					if ((debounce(PIND,PD0))) 
					{
						buttonLinks=2;
					}
				}
				//wenn button links lange gedrückt wurde -> wechsle in den anderen heating-mode	
				if (buttonLinks==2)
				{
					currentMode=heatControlManualMode;
					screenHeatingManual(2, &heizLevel);
				}
				//button Mitte -> temperatur Sollwert für Regler verringern
				else if (buttonMitte==0)
				{
					if (tempSollwert>17)
					{
						tempSollwert -= 1;
					}
					else
					{
						tempSollwert=16;
					}
					screenHeatingAuto(tempSollwert);
				}
				//button rechts -> temperatur sollwert für regler erhöhen
				else if (buttonRechts==0)
				{
					if (tempSollwert<25)
					{
						tempSollwert += 1;
					}
					else
					{
						tempSollwert=26;
					}
					screenHeatingAuto(tempSollwert);
				}
				break;
			//---------------------------------------------------------------------------------------------
			case voltageControlMode:
				//start adc single conversion for both batteries
				//both values are voltage*100
				batt1Volt = adcRead15(4);
				batt2Volt = adcRead15(5);
				screenVoltageControl(batt1Volt, batt2Volt);
				break;
			//---------------------------------------------------------------------------------------------
			case tempInfoMode:
				//start adc single conversion for both temperature sensors voltages
				//both values are voltage*100
				temp1Volt = adcRead5(6);
				temp2Volt = adcRead5(7);
				screenTempInfo(temp1Volt,temp2Volt);
				break;
			//---------------------------------------------------------------------------------------------
			case versionInfoMode:
				screenInfo();
				break;
			//---------------------------------------------------------------------------------------------
			default:
				break;		
		}
		

		//Folgende routinen versetzen den controller in den sleep-mode wenn die zündungsspannung aus ist.
		// Zündung=ON  -> Transistor schaltet 0V -> PIND.6 = 0
		// Zündung=OFF -> Transistor sperrt      -> PIND.6 = 1 (interner Pull-Up)
		// ->Sleep ON
		/*
		if (PIND & (1<<BIT6))	
		{						
			screenGotoSleepmode();
			_delay_ms(2000);
			lcd_clear();
			PORTC &= ~(1<<BIT0);//Display -> Spannungslos (Display-Masse wird abgeschaltet)
			PORTC |= (1<<BIT1); //DisplayBeleuchtung -> spannungslos (über Darlington 0V an TransistorBasis)
			sleep_enable();	   
			sleep_cpu();
		}			
		
		//Wenn uC gerade aufgewacht ist, dann willkommens und battVolt Screens darstellen.
		if (wakeUp==1)
		{
			menuInit();
			wakeUp=0;
		}
		*/

	}
}
Example #10
0
File: menu.c Project: stewdk/pwct
void menuUpdate(int16_t speed, int16_t dir)
{
	uint8_t up = lcdUpFallingEdge();
	uint8_t down = lcdDownFallingEdge();
	uint8_t right = lcdRightFallingEdge();
	uint8_t left = lcdLeftFallingEdge();
	uint8_t leftLongPress = lcdLeftLongPress();
	static uint8_t cursorPosition = 0;

	char lcdLine1[LCD_NUM_CHARACTERS+1];
	char lcdLine2[LCD_NUM_CHARACTERS+1];
	lcdLine1[LCD_NUM_CHARACTERS] = '\0';
	lcdLine2[LCD_NUM_CHARACTERS] = '\0';

	if (eepromShadowIsPlatformDown) {
		sprintf(lcdLine1, "Platform down");
		lcdLine2[0] = '\0';
		lcdText(lcdLine1, lcdLine2, 0);
		gMotorsDisabled = 1;
		return;
	}

	if (eepromShadowMenuState == MENU_OPTION_PROFILE && leftLongPress) {
		gNameEditMode = !gNameEditMode;

		if (gNameEditMode) {
			sprintf(lcdLine1, "Edit name");
			sprintf(lcdLine2, "%s", currentProfileName);
			lcdText(lcdLine1, lcdLine2, 1);

			// Display on, LCD cursor on, blink off
			lcdCommandBlocking(LCD_CMD_DISPLAY_ON_OFF | LCD_CMD_DISPLAY_ON_OFF_D_bm | LCD_CMD_DISPLAY_ON_OFF_C_bm);
			lcdCommandBlocking(LCD_CMD_SET_DDRAM_ADDR | (LCD_DDRAM_ADDR_bm & LCD_LINE_2_START_ADDR));
			cursorPosition = 0;
		} else {
			// Display on, LCD cursor off, blink off
			lcdCommandBlocking(LCD_CMD_DISPLAY_ON_OFF | LCD_CMD_DISPLAY_ON_OFF_D_bm);

			// Write to eeprom
			eepromUpdateStringSafe(currentProfileName, eepromProfileName[eepromShadowCurrentProfile]);
		}
	}

	if (gNameEditMode) {
		gMotorsDisabled = 1;
		if (!isValidChar(currentProfileName[cursorPosition])) {
			currentProfileName[cursorPosition] = ' ';
			currentProfileName[cursorPosition+1] = '\0';
		}
		if (left || right) {
			if (left && cursorPosition > 0) {
				cursorPosition--;
			}
			if (right && cursorPosition < LCD_NUM_CHARACTERS - 1) {
				cursorPosition++;
				if (!isValidChar(currentProfileName[cursorPosition])) {
					currentProfileName[cursorPosition] = ' ';
					currentProfileName[cursorPosition+1] = '\0';
				}
			}
			// Change cursor position
			lcdCommandBlocking((LCD_CMD_SET_DDRAM_ADDR | (LCD_DDRAM_ADDR_bm & LCD_LINE_2_START_ADDR)) + cursorPosition);
		}
		if (up || down) {
			// Change letter
			if (up) {
				if (currentProfileName[cursorPosition] == ' ') {
					currentProfileName[cursorPosition] = 'A';
				} else if (currentProfileName[cursorPosition] == 'Z') {
					currentProfileName[cursorPosition] = 'a';
				} else if (currentProfileName[cursorPosition] == 'z') {
					currentProfileName[cursorPosition] = '0';
				} else if (currentProfileName[cursorPosition] == '9') {
					currentProfileName[cursorPosition] = ' ';
				} else {
					currentProfileName[cursorPosition]++;
				}
			}
			if (down) {
				if (currentProfileName[cursorPosition] == ' ') {
					currentProfileName[cursorPosition] = '9';
				} else if (currentProfileName[cursorPosition] == '0') {
					currentProfileName[cursorPosition] = 'z';
				} else if (currentProfileName[cursorPosition] == 'a') {
					currentProfileName[cursorPosition] = 'Z';
				} else if (currentProfileName[cursorPosition] == 'A') {
					currentProfileName[cursorPosition] = ' ';
				} else {
					currentProfileName[cursorPosition]--;
				}
			}
			sprintf(lcdLine1, "Edit name");
			sprintf(lcdLine2, "%s", currentProfileName);
			lcdText(lcdLine1, lcdLine2, 1);
			lcdCommandBlocking((LCD_CMD_SET_DDRAM_ADDR | (LCD_DDRAM_ADDR_bm & LCD_LINE_2_START_ADDR)) + cursorPosition);
		}
		return;
	}

	gMotorsDisabled = 0;

	if (right)
	{
		if (eepromShadowMenuState < LAST_MENU_OPTION) {
			eepromUpdateByteSafe(&eepromMenuState, &eepromShadowMenuState, eepromShadowMenuState + 1);
		}
	}
	if (left)
	{
		if (eepromShadowMenuState > 0) {
			eepromUpdateByteSafe(&eepromMenuState, &eepromShadowMenuState, eepromShadowMenuState - 1);
		}
	}

	switch (eepromShadowMenuState)
	{
	case MENU_OPTION_PROFILE:
		if (up && eepromShadowCurrentProfile < PROFILE_COUNT - 1) {
			eepromUpdateByteSafe(&eepromCurrentProfile, &eepromShadowCurrentProfile, eepromShadowCurrentProfile + 1);
			menuInit();
		}
		if (down && eepromShadowCurrentProfile > 0) {
			eepromUpdateByteSafe(&eepromCurrentProfile, &eepromShadowCurrentProfile, eepromShadowCurrentProfile - 1);
			menuInit();
		}
		sprintf(lcdLine1, "Choose Profile");
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_FWD_THROW:
		if (up && eepromShadowFwdThrow < 2.45) {
			eepromUpdateFloatSafe(&eepromFwdThrow[eepromShadowCurrentProfile], &eepromShadowFwdThrow, eepromShadowFwdThrow + 0.05);
		}
		if (down && eepromShadowFwdThrow > 0.05) {
			eepromUpdateFloatSafe(&eepromFwdThrow[eepromShadowCurrentProfile], &eepromShadowFwdThrow, eepromShadowFwdThrow - 0.05);
		}
		sprintf(lcdLine1, "Fwd Throw: %.2f", (double)eepromShadowFwdThrow);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_REV_THROW:
		if (up && eepromShadowRevThrow < 2.45) {
			eepromUpdateFloatSafe(&eepromRevThrow[eepromShadowCurrentProfile], &eepromShadowRevThrow, eepromShadowRevThrow + 0.05);
		}
		if (down && eepromShadowRevThrow > 0.05) {
			eepromUpdateFloatSafe(&eepromRevThrow[eepromShadowCurrentProfile], &eepromShadowRevThrow, eepromShadowRevThrow - 0.05);
		}
		sprintf(lcdLine1, "Rev Throw: %.2f", (double)eepromShadowRevThrow);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_TURN_THROW:
		if (up && eepromShadowTurnThrow < 2.45) {
			eepromUpdateFloatSafe(&eepromTurnThrow[eepromShadowCurrentProfile], &eepromShadowTurnThrow, eepromShadowTurnThrow + 0.05);
		}
		if (down && eepromShadowTurnThrow > 0.05) {
			eepromUpdateFloatSafe(&eepromTurnThrow[eepromShadowCurrentProfile], &eepromShadowTurnThrow, eepromShadowTurnThrow - 0.05);
		}
		sprintf(lcdLine1, "Turn Throw: %.2f", (double)eepromShadowTurnThrow);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_TOP_FWD_SPEED:
		if (up && eepromShadowTopFwdSpeed < 125) {
			eepromUpdateByteSafe(&eepromTopFwdSpeed[eepromShadowCurrentProfile], &eepromShadowTopFwdSpeed, eepromShadowTopFwdSpeed + 5);
		}
		if (down && eepromShadowTopFwdSpeed > 5) {
			eepromUpdateByteSafe(&eepromTopFwdSpeed[eepromShadowCurrentProfile], &eepromShadowTopFwdSpeed, eepromShadowTopFwdSpeed - 5);
		}
		sprintf(lcdLine1, "Fwd Speed: %d", eepromShadowTopFwdSpeed);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_TOP_REV_SPEED:
		if (up && eepromShadowTopRevSpeed < 125) {
			eepromUpdateByteSafe(&eepromTopRevSpeed[eepromShadowCurrentProfile], &eepromShadowTopRevSpeed, eepromShadowTopRevSpeed + 5);
		}
		if (down && eepromShadowTopRevSpeed > 5) {
			eepromUpdateByteSafe(&eepromTopRevSpeed[eepromShadowCurrentProfile], &eepromShadowTopRevSpeed, eepromShadowTopRevSpeed - 5);
		}
		sprintf(lcdLine1, "Rev Speed: %d", eepromShadowTopRevSpeed);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_TOP_TURN_SPEED:
		if (up && eepromShadowTopTurnSpeed < 125) {
			eepromUpdateByteSafe(&eepromTopTurnSpeed[eepromShadowCurrentProfile], &eepromShadowTopTurnSpeed, eepromShadowTopTurnSpeed + 5);
		}
		if (down && eepromShadowTopTurnSpeed > 5) {
			eepromUpdateByteSafe(&eepromTopTurnSpeed[eepromShadowCurrentProfile], &eepromShadowTopTurnSpeed, eepromShadowTopTurnSpeed - 5);
		}
		sprintf(lcdLine1, "Turn Speed: %d", eepromShadowTopTurnSpeed);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_SENSITIVITY:
		if (up && eepromShadowSensitivity < 9) {
			eepromUpdateByteSafe(&eepromSensitivity[eepromShadowCurrentProfile], &eepromShadowSensitivity, eepromShadowSensitivity + 1);
		}
		if (down && eepromShadowSensitivity > 0) {
			eepromUpdateByteSafe(&eepromSensitivity[eepromShadowCurrentProfile], &eepromShadowSensitivity, eepromShadowSensitivity - 1);
		}
		sprintf(lcdLine1, "Sensitivity: %d", eepromShadowSensitivity + 1);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_ACCELERATION:
		if (up && eepromShadowAcceleration > 4) {
			eepromUpdateByteSafe(&eepromAcceleration[eepromShadowCurrentProfile], &eepromShadowAcceleration, eepromShadowAcceleration - 4);
		}
		if (down && eepromShadowAcceleration < 100) {
			eepromUpdateByteSafe(&eepromAcceleration[eepromShadowCurrentProfile], &eepromShadowAcceleration, eepromShadowAcceleration + 4);
		}
		sprintf(lcdLine1, "Acceleration: %d", (104 - eepromShadowAcceleration) / 4);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_DECELERATION:
		if (up && eepromShadowDeceleration > 4) {
			eepromUpdateByteSafe(&eepromDeceleration[eepromShadowCurrentProfile], &eepromShadowDeceleration, eepromShadowDeceleration - 4);
		}
		if (down && eepromShadowDeceleration < 100) {
			eepromUpdateByteSafe(&eepromDeceleration[eepromShadowCurrentProfile], &eepromShadowDeceleration, eepromShadowDeceleration + 4);
		}
		sprintf(lcdLine1, "Deceleration: %d", (104 - eepromShadowDeceleration) / 4);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_OUTER_DEAD_BAND:
		if (up && eepromShadowOuterDeadBand < 20) {
			eepromUpdateByteSafe(&eepromOuterDeadBand[eepromShadowCurrentProfile], &eepromShadowOuterDeadBand, eepromShadowOuterDeadBand + 1);
		}
		if (down && eepromShadowOuterDeadBand > 0) {
			eepromUpdateByteSafe(&eepromOuterDeadBand[eepromShadowCurrentProfile], &eepromShadowOuterDeadBand, eepromShadowOuterDeadBand - 1);
		}
		if (eepromShadowOuterDeadBand == 0) {
			// 0: off
			sprintf(lcdLine1, "Outer DB: Off");
		} else if (eepromShadowOuterDeadBand == 1) {
			// 1: immediate
			sprintf(lcdLine1, "Outer DB: Immed.");
		} else {
			// 2: 0.5s, 3: 1.0s, 4: 1.5s, etc
			// Conversion: y=(x-1)/2
			sprintf(lcdLine1, "Outer DB: %d.%ds", (eepromShadowOuterDeadBand-1)/2, (eepromShadowOuterDeadBand-1) % 2 ? 5 : 0);
		}
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_CTR_DEAD_BAND:
		if (up && eepromShadowCenterDeadBand < 56) {
			eepromUpdateByteSafe(&eepromCenterDeadBand[eepromShadowCurrentProfile], &eepromShadowCenterDeadBand, eepromShadowCenterDeadBand + 6);
		}
		if (down && eepromShadowCenterDeadBand > 2) {
			eepromUpdateByteSafe(&eepromCenterDeadBand[eepromShadowCurrentProfile], &eepromShadowCenterDeadBand, eepromShadowCenterDeadBand - 6);
		}
		sprintf(lcdLine1, "Center DB: %d", (eepromShadowCenterDeadBand - 2) / 6 + 1);
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_PROP_AS_SWITCH:
		if (up || down) {
			if (eepromShadowPropAsSwitch) {
				eepromUpdateByteSafe(&eepromPropAsSwitch[eepromShadowCurrentProfile], &eepromShadowPropAsSwitch, 0);
			} else {
				eepromUpdateByteSafe(&eepromPropAsSwitch[eepromShadowCurrentProfile], &eepromShadowPropAsSwitch, 1);
			}
		}
		sprintf(lcdLine1, "PropAsSwitch:%s", eepromShadowPropAsSwitch ? " On" : "Off");
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	case MENU_OPTION_INVERT:
		if (up || down) {
			if (eepromShadowInvert) {
				eepromUpdateByteSafe(&eepromInvert[eepromShadowCurrentProfile], &eepromShadowInvert, 0);
			} else {
				eepromUpdateByteSafe(&eepromInvert[eepromShadowCurrentProfile], &eepromShadowInvert, 1);
			}
		}
		sprintf(lcdLine1, "Invert: %s", eepromShadowInvert ? "On" : "Off");
		sprintf(lcdLine2, "%s", currentProfileName);
		break;
	default:
		lcdLine1[0] = '\0';
		lcdLine2[0] = '\0';
		break;
	}

	if ((up || down) && eepromShadowCurrentProfile == PROFILE_COUNT - 1) {
		menuInit();
	}

	//if (eepromShadowMenuState != MENU_OPTION_PROFILE) {
		//sprintf(lcdLine2, "S=%4d T=%4d%3d", speed, dir, gWirelessTimeoutCount);
	//}

	lcdText(lcdLine1, lcdLine2, 0);
}
Example #11
0
KfindTop::KfindTop(const char *searchPath) : KTopLevelWidget()
  {
//     setCaption(QString("KFind ")+KFIND_VERSION);

    _toolBar = new KToolBar( this, "_toolBar" );
    _toolBar->setBarPos( KToolBar::Top );      
    _toolBar->show();
    enableToolBar( KToolBar::Show, addToolBar( _toolBar ) );

    _kfind = new Kfind(this,"dialog",searchPath);   
    setView( _kfind, FALSE );
    _kfind->show();

    menuInit();
    toolBarInit();

    setMenu(_mainMenu);
    _mainMenu->show();

    //_mainMenu->enableMoving(false);

    _statusBar = new KStatusBar( this, "_statusBar");
    _statusBar->insertItem("0 file(s) found", 0);
    _statusBar->enable(KStatusBar::Hide);
    setStatusBar( _statusBar );

    connect(_kfind,SIGNAL(haveResults(bool)),
            this,SLOT(enableSaveResults(bool)));
    connect(_kfind,SIGNAL(resultSelected(bool)),
	    this,SLOT(enableMenuItems(bool)));
    connect(this,SIGNAL(deleteFile()),
 	    _kfind,SIGNAL(deleteFile()));
    connect(this,SIGNAL(properties()),
 	    _kfind,SIGNAL(properties()));
    connect(this,SIGNAL(openFolder()),
 	    _kfind,SIGNAL(openFolder()));
    connect(this,SIGNAL(saveResults()),
 	    _kfind,SIGNAL(saveResults()));
    connect(this,SIGNAL(addToArchive()),
 	    _kfind,SIGNAL(addToArchive()));
    connect(this,SIGNAL(open()),
 	    _kfind,SIGNAL(open()));
    connect(_kfind ,SIGNAL(statusChanged(const char *)),
	    this,SLOT(statusChanged(const char *)));
    connect(_kfind ,SIGNAL(enableSearchButton(bool)),
	    this,SLOT(enableSearchButton(bool)));
    connect(_kfind ,SIGNAL(enableStatusBar(bool)),
            this,SLOT(enableStatusBar(bool)));

// No, No, No!!! This is pointless!   (sven)
//    connect(_mainMenu ,SIGNAL(moved(menuPosition)),
//    	    this,SLOT(resizeOnFloating()));
//    connect(_toolBar ,SIGNAL(moved(BarPosition)),
//    	    this,SLOT(resizeOnFloating()));

    //_width=(440>_toolBar->width())?440:_toolBar->width();
    _width=520;
    //_height=(_kfind->sizeHint()).height(); // Unused as far as I can tell

// Fixed and Y-fixed guys:  Please, please, please stop setting fixed size
// on KTW! Fix it on your main view!
//                                     sven

    this->enableStatusBar(false); // _kfile emited before connected (sven)

   }; // and what's this semi-colon for? Grrrr!!!! (sven, too)
void CLANEntity_IsClanMember::Main()
{
	if(life ==0) return;

	switch(C_menuN)
	{
	case CLAN_isClanWon:

		switch(C_menuN2) {
		case 0:
			ANSdata.ret_val= -1;			

			WebDB.Resume() ;		//웹db를 재개한다.
			WebDB.isClanMember(cldata.szID,cldata.gserver,cldata.ChaName);		//이 id가 클랜원인지를 파악한다.						
			C_menuN2=1;
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 WebDB.isClanMember(아이디 : %s,게임서버 : %s,캐릭터이름 : %s)",cldata.szID,cldata.gserver,cldata.ChaName);
#endif
			break;
		case 1:

			if(ANSdata.ret_val != -1) 
				ANSdata.ret_val= ANSdata.ret_val;			

			switch(ANSdata.ret_val) 
			{
			case 0://무등록   				
				WebDB.Suspend(); 
				if(bGetChaClan) ++nStatusCount;
				
				bIsLoading = FALSE;
				C_menuN2=0;
				C_menuN=CLAN_AllEnd;
				cldata.myPosition = CLANNO_REGESTER;
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 무등록");
#endif     
#ifdef VOICE_CHAT
			   if(bCheckClan)
			   {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   NULL,0, cldata.myPosition);
				   //bCheckClan = FALSE;

			   }
#endif

				
				break;


			case 1://클랜원등록
				WebDB.Suspend(); //웹db 중지
				bIsLoading = FALSE;
				//ygy : 꼭 살릴것
				cldata.myPosition = CLANUSER;			//클랜원 포지션 코드는 100번임
				ParsingIsClanMember(ANSdata.ret_Buf);
				if(bGetChaClan)
				{
					if(CheckMark(bGetChaClan) ==1)
					{
						C_menuN2=0;
						C_menuN=CLAN_AllEnd;
						break;
					}
					else
					{
						WriteMyClanInfo();
					
						
					
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
					
					}
				}
				else
				{
						WriteMyClanInfo();				
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
				}
#ifdef VOICE_CHAT
				if(bCheckClan)
			    {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   cldata.name,(DWORD)atoi(cldata.ClanMark), cldata.myPosition);
				   //bCheckClan = FALSE;

			    }
#endif
				
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 클랜원등록");
#endif				
				//C_menuN=CLAN_AllEnd;
				break;

			case 2://클랜장등록
				WebDB.Suspend(); //웹db 중지
				bIsLoading = FALSE;
				//ygy : 꼭 살릴것
				cldata.myPosition = CLANCHIP;				//클랜장 포지션 코드는 101번임
				ParsingIsClanMember(ANSdata.ret_Buf);
				cldata.isSubChip[0] = '0';
				if(bGetChaClan)
				{
					if(CheckMark(bGetChaClan) ==1)
					{
						C_menuN2=0;
						C_menuN=CLAN_AllEnd;
						break;
					}
					else
					{
						WriteMyClanInfo();
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
						//C_menuN=CLAN_AllEnd;
						
					}				
				}
				else
				{
						WriteMyClanInfo();
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
						//C_menuN=CLAN_AllEnd;
						
				}
				
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 클랜장");
#endif				
#ifdef VOICE_CHAT
			if(bCheckClan)
			 {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   cldata.name,(DWORD)atoi(cldata.ClanMark), cldata.myPosition);
				   //bCheckClan = FALSE;

			 }
#endif
				
				
				break;
			case 4: //해체된 클랜원
				WebDB.Suspend(); 
				bIsLoading = FALSE;
				C_menuN2=0;
				C_menuN=CLAN_AllEnd;
				cldata.myPosition = CLANNO_REGESTER;
				if(bGetChaClan) 
				{
					++nStatusCount;
					bGetChaClan = FALSE;
				}
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 클랜이해체된 클랜원");
#endif
#ifdef VOICE_CHAT
			if(bCheckClan)
			 {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   NULL,0, cldata.myPosition);
				   //bCheckClan = FALSE;

			 }
#endif
				break;
			
			case 3: //클랜이 해체됨  클랜 장
				WebDB.Suspend(); 
				ParsingIsClanMember2(ANSdata.ret_Buf);
				bIsLoading = FALSE;
				C_menuN2=0;
				C_menuN=CLAN_AllEnd;
				cldata.myPosition = CLANNO_REGESTER;
				if(bGetChaClan) 
				{
					++nStatusCount;
					bGetChaClan = FALSE;
				}
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 클랜이 해체됨  클랜 장");
#endif
#ifdef VOICE_CHAT
			if(bCheckClan)
			 {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   NULL,0, cldata.myPosition);
				   //bCheckClan = FALSE;

			 }
#endif
				break;
			case 5: //부클랜칩일경우
				WebDB.Suspend(); //웹db 중지
				bIsLoading = FALSE;
				//ygy : 꼭 살릴것
				cldata.myPosition = CLAN_SUBCHIP;			//클랜원 포지션 코드는 100번임
				ParsingIsClanMember(ANSdata.ret_Buf);
				cldata.isSubChip[0] = '1';
				if(bGetChaClan)
				{
					if(CheckMark(bGetChaClan) ==1)
					{
						C_menuN2=0;
						C_menuN=CLAN_AllEnd;
						break;
					}
					else
					{
						WriteMyClanInfo();
					
						
					
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
					
					}
				}
				else
				{
						WriteMyClanInfo();				
						C_menuN2=0;
						C_menuN=MYCLAN_UPDATE;
				}
				
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 클랜원등록");
#endif				
				
#ifdef VOICE_CHAT
			if(bCheckClan)
			 {
				   g_CtrlProcess.SetSelectCha(cldata.szID,cldata.ChaName,
					   cldata.name,(DWORD)atoi(cldata.ClanMark), cldata.myPosition);
				   //bCheckClan = FALSE;

			 }
#endif
				break;
			case 100:
				WebDB.Suspend();
				bIsLoading = FALSE;				
				cldata.myPosition = CLAN_NOCONNECT;
				C_menuN=CLAN_AllEnd;
				if(bGetChaClan) 
				{
					++nStatusCount;
					bGetChaClan = FALSE;
				}
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 리턴코드 100");
#endif
				break;
			case ISAO_ERR_TCP_CONNECT:
				WebDB.Suspend();
				bIsLoading = FALSE;
				//ygy : 꼭 살릴것
				//wsprintf(szErrorMsg, szServerConnectErrorMsg);
				cldata.myPosition = CLAN_NOCONNECT;
				C_menuN=CLAN_AllEnd;
				menuInit(C_menuN);
				if(bGetChaClan) 
				{
					++nStatusCount;
					bGetChaClan = FALSE;
				}
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 서버에 접속할수 없음");
#endif
				
				break;
			default:
				if(ANSdata.ret_val != -1) {		//전혀엉뚱한 답이 와서 에러가 났다.
					WebDB.Suspend();
					bIsLoading = FALSE;
					C_menuN2=0;
					C_menuN=CLAN_AllEnd;
					cldata.myPosition = CLAN_NOCONNECT;
					if(bGetChaClan) 
					{
						++nStatusCount;
						bGetChaClan = FALSE;
					}
#ifdef CLAN_DEBUG
			DebugMessage("CLAN_isClanWon에서 디폴트에러");
#endif
					}
				break;
				}
			break;
			}
		break;
		}
	
}
void CHelp::Main()
{
	int i;
    
	//if(life ==0) return;
	if(haGuidHelpLevel_1Flag){
		if(haGuidHelpLevel_1Flag==1)  //무기 
			GetHelpContent("Level_1_W","Key29","Guide25");
		else                          //방어구
			GetHelpContent("Level_1_D","Key30","Guide26");
		menuInit(1);
		m_HelpN = 1;
		haGuidHelpLevel_1Flag = 0;
	}
	switch(m_HelpN)
	{	
	
	case LEVELUP_HELP:
		if(!m_bOnce)
		{
			m_dwTime = dwPlayTime;
			m_bOnce = !m_bOnce;
		}
		if((dwPlayTime - m_dwTime) >= 700)
		{
			m_dwTime = dwPlayTime;
			m_bTime = !m_bTime;
		}
		
		i = chkeckMenuN();
		switch(i) {
		case 0:	
		case 1:
			isDrawClanMenu = 1;
			break;
		default:
			memset(menuMouseOver,-1,sizeof(int)*30);
			isDrawClanMenu = 0;
			break;
		}
		//if(MOUSE0())			
		if(LevelpUpButton[0])
		{	
			//MOUSE0()=0;
			LevelpUpButton[0] = 0;
			
			switch(i) 
			{
			case 1:
			case 0:
				isDrawClanMenu = 1;
				m_HelpN = LEVELUP_HELP_CONTENT;
				menuInit(m_HelpN);	
				break;
			default:
				isDrawClanMenu = 0;
				break;

			}
		}
		break;

	case LEVELUP_HELP_CONTENT:
		i = chkeckMenuN();
		switch(i) {		
		case 0:
			menuMouseOver[0] = 1;  //닫기
			break;
		case 5:
			isDrawClanMenu = 1;
			break;
		case 1:
			menuMouseOver[1] = 1;
			break;
		default:
			isDrawClanMenu = 0;
			memset(menuMouseOver,-1,sizeof(int)*30);			

			break;
		}
		if(LevelpUpButton[0])
		{	
			//MOUSE0()=0;
			LevelpUpButton[0] = 0;
			
			switch(i) 
			{
			case 1:				 //닫기
				m_HelpN = -1;	
				isDrawClanMenu = 0;
				break;
			case 5: //전체사이즈
				isDrawClanMenu = 1;
				break;
			case 0:
				m_HelpN = -1;	
				isDrawClanMenu = 0;
				void InitGuideContentHelp();
				InitGuideContentHelp();
				break;
			default:
				isDrawClanMenu = 0;
				break;

			}
		}
		break;
		
	
	}
}
Example #14
0
/*---------------------------------------------------------------------------*
 * M A I N 
 *---------------------------------------------------------------------------*/
void	Main(void *arg)
{
  u8	draw_frame = 0;
  u32	objRM;
  Gfx	*gp, *gtop;
  OSTime rspstart;
  u32	 rsptime, rdptime;
  
  bg16seg = (u32)_codeSegmentEnd 
          + (u32)_staticSegmentEnd - (u32)_staticSegmentStart;
  bg8seg  = bg16seg + 
          + (u32)_bg_rgbaSegmentRomEnd - (u32)_bg_rgbaSegmentRomStart;
  
  loadSegment(bg16seg, bg8seg);
  menuInit();
  actionInit();
  rsptime = rdptime = 0;
  
  while(1){

    /*------ Start to read the controller. ------*/
    osContStartReadData(&siMessageQ);
    
    /*------ Wait for the retrace. ------*/
    osRecvMesg(&retraceMessageQ, NULL, OS_MESG_BLOCK);

    /*------ Setting the Bg structure. ------*/
    setBg();
    
    /*------ Setting the Object structure. ------*/
    setObject();
    
    /*------ Create the Gfx list. ------*/
    gtop = gp = glist[draw_frame];

    /*------ RSP initialization setting. ------*/
    gSPSegment(gp ++, 0, 0x0);
    gSPSegment(gp ++, STATIC_SEGMENT, _codeSegmentEnd);
    if (aMenu[MENU_BG_TX_FORMAT]){
      gSPSegment(gp ++, BG_SEGMENT, bg8seg);
    }
    gDPSetColorImage(gp ++, G_IM_FMT_RGBA,
		     G_IM_SIZ_16b, SCREEN_WD, system_cfb[draw_frame]);
    gSPDisplayList(gp ++, rdpInit_dl);
    gSPDisplayList(gp ++, clearCfb_dl);
    gSPDisplayList(gp ++, spriteInit_dl);

    /*------ Bg output. ------*/
    if (aMenu[MENU_BG_TX_FORMAT]){
      gDPSetTextureLUT(gp ++, G_TT_RGBA16);
      gSPObjLoadTxtr(gp ++, &objBgTLUT);
    }
    if (aMenu[MENU_BG_SCALABLE] == 0){

      /* Unscalable BG plane */
      gDPSetRenderMode(gp ++, G_RM_NOOP, G_RM_NOOP2);
      gDPSetCycleType(gp ++, G_CYC_COPY);
      gSPBgRectCopy(gp ++, &objBg);

    } else {
      /* Scalable BG plane */
      gDPSetRenderMode(gp ++, G_RM_SPRITE, G_RM_SPRITE2);
      gDPSetCycleType(gp ++, G_CYC_1CYCLE);
      gDPSetTextureFilter(gp ++,
			  RMmodeTable[aMenu[MENU_RENDERMODE]].txtrFilter);
      if (aMenu[MENU_BG_SCALABLE] == 1){
	/* Emulated by CPU */
	guS2DEmuSetScissor(0, 0, SCREEN_WD, SCREEN_HT, 
			   (RMmodeTable[aMenu[MENU_RENDERMODE]].txtrFilter
			    == G_TF_BILERP));
	guS2DEmuBgRect1Cyc(&gp, &objBg);
      } else {
	/* GBI command */
	gSPObjRenderMode(gp ++, RMmodeTable[aMenu[MENU_RENDERMODE]].objRMode);
	gSPBgRect1Cyc(gp ++, &objBg);
      }
    }
    gDPPipeSync(gp ++);

    /*------ Setting the Render Mode. ------*/
    objRM = RMmodeTable[aMenu[MENU_RENDERMODE]].objRMode;
    if (RMmodeTable[aMenu[MENU_RENDERMODE]].cycleType != G_CYC_COPY){
      if (!aMenu[MENU_RENDERMODE_2]){
	/* Opaque */
	if (RMmodeTable[aMenu[MENU_RENDERMODE]].antiAlias){
	  gDPSetRenderMode(gp ++, G_RM_AA_SPRITE, G_RM_AA_SPRITE2);
	} else {
	  gDPSetRenderMode(gp ++, G_RM_SPRITE, G_RM_SPRITE2);
	}
      } else {
	/* Translucent */
	if (RMmodeTable[aMenu[MENU_RENDERMODE]].antiAlias){
	  gDPSetRenderMode(gp ++, G_RM_AA_XLU_SPRITE, G_RM_AA_XLU_SPRITE2);
	} else {
	  gDPSetRenderMode(gp ++, G_RM_XLU_SPRITE, G_RM_XLU_SPRITE2);
	}
	gDPSetCombineMode(gp ++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
	gDPSetPrimColor(gp ++, 0, 0, 255, 255, 255, 128);
      }
    }
    
    /*------ Setting the Texture Filter and CycleType. ------*/
    gDPSetTextureFilter(gp ++, RMmodeTable[aMenu[MENU_RENDERMODE]].txtrFilter);
    gDPSetCycleType    (gp ++, RMmodeTable[aMenu[MENU_RENDERMODE]].cycleType );
    
    /*------ Setting the Texture Window. ------*/
    if (aMenu[MENU_OBJ_TX_WINDOW]) objRM |= G_OBJRM_NOTXCLAMP;

    /*------ Setting the Shrink. ------*/
    objRM |= ShrinkTable[aMenu[MENU_OBJ_SHRINK]];
    
    /*------ Setting the Object Render Mode. ------*/    
    gSPObjRenderMode(gp ++, objRM);
    
    /*------ Load setting of the Texture. -----*/
    if (!aMenu[MENU_OBJ_TX_TYPE]){
      gDPSetTextureLUT(gp ++, G_TT_NONE);
      gSPObjLoadTxtr(gp ++, (aMenu[MENU_OBJ_TX_LOAD_BY]
			     ? &objTxtrTile_RGBA16 : &objTxtrBlock_RGBA16));
    } else {
      gDPSetTextureLUT(gp ++, G_TT_RGBA16);
      gSPObjLoadTxtr(gp ++, (aMenu[MENU_OBJ_TX_LOAD_BY]
			     ? &objTxtrTile_CI4 : &objTxtrBlock_CI4));
      gSPObjLoadTxtr(gp ++, &objTLUT_CI4);
    }
    
    /*------ Output of Object:Rectangle1. ------*/
    gSPObjRectangle(gp ++, &(objRect[0]));

    if (RMmodeTable[aMenu[MENU_RENDERMODE]].cycleType != G_CYC_COPY){

      /*------ Output of Object:Rectangle2. ------*/
      gSPObjMatrix(gp ++, &(objMtx[0]));
      gSPObjSprite(gp ++, &(objRect[1]));

      /*------ Output of Object:Ball. ------*/      
      /* 
	 Ball is displayed by combining two sprite pieces.  Because of this, you need to change
	 the processing method by setting the Texture Filter.  

	 If the Texture Filter is PointSample, you don't have to specify SHRINKSIZE; but, If it
	 is Bilerp, it must be SHRINKSIZE_1.  When you specify SHRINKSIZE_1, the circumference
	 of Sprite for 0.5 texel is clamped.  The area excepted by this clamp becomes a part
	 that the Bilerp process gives no effect.     

	 Because you need to load the part of adjoining of Sprite twice in Bilerp, Ball draws
	 only for 64x63 texels.  It is important to understand the differences between
	 objBall[1] and objBall[2] well. 
      */
      if (!aMenu[MENU_RENDERMODE_2]){
	/* Draw one size larger to hide the joining part.  (Only opaque.)
	   It became unnecessary after S2DEX 1.05.   */
	/* objRM |= G_OBJRM_WIDEN; */
      }
      gDPPipeSync(gp ++);
      gDPSetTextureLUT(gp ++, G_TT_RGBA16);
      gSPObjLoadTxtr(gp ++, &objBallTLUT);
      if (RMmodeTable[aMenu[MENU_RENDERMODE]].txtrFilter == G_TF_POINT){
	gSPObjRenderMode(gp ++, objRM);
	gSPObjMatrix(gp ++, &(objMtx[2]));
	gSPObjLoadTxRectR(gp ++, &(objBall[0]));
	gSPObjLoadTxRectR(gp ++, &(objBall[1]));
	gSPObjMatrix(gp ++, &(objMtx[1]));
	gSPObjLoadTxSprite(gp ++, &(objBall[0]));
	gSPObjLoadTxSprite(gp ++, &(objBall[1]));
      } else {
	gSPObjRenderMode(gp ++, objRM|G_OBJRM_SHRINKSIZE_1);
	gSPObjMatrix(gp ++, &(objMtx[2]));
	gSPObjLoadTxRectR(gp ++, &(objBall[0]));
	gSPObjLoadTxRectR(gp ++, &(objBall[2]));
	gSPObjMatrix(gp ++, &(objMtx[1]));
	gSPObjLoadTxSprite(gp ++, &(objBall[0]));
	gSPObjLoadTxSprite(gp ++, &(objBall[2]));
      }
    }
    
    /*------ Output the processing meter. ------*/
    if (rsptime){
      gDPPipeSync(gp ++);
      gDPSetCycleType(gp ++, G_CYC_FILL);
      gDPSetRenderMode(gp ++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
      gDPSetFillColor(gp ++, (GPACK_RGBA5551(128,128,255,1) << 16 | 
			      GPACK_RGBA5551(128,128,255,1)));
      gDPFillRectangle(gp ++, 30, 201, 30+rsptime/100, 202);
      gDPFillRectangle(gp ++, 30, 205, 30+rdptime/100, 206);
      gDPSetFillColor(gp ++, (GPACK_RGBA5551(255,255,255,1) << 16 | 
			      GPACK_RGBA5551(255,255,255,1)));
      gDPFillRectangle(gp ++, 30,     200, 30,     207);
      gDPFillRectangle(gp ++, 30+166, 200, 30+166, 207);
    }
    gDPFullSync(gp ++);
    gSPEndDisplayList(gp ++);
    
    /*------ Execute the Gfx task. ------*/
    tlist.t.data_ptr = (u64 *)gtop;
    osWritebackDCache(gtop, ((u32)gp)-((u32)gtop));
    rspstart = osGetTime();
    osSpTaskStart(&tlist);
    
    /*------ Wait for the end. ------*/
    osRecvMesg(&rspMessageQ, NULL, OS_MESG_BLOCK);
    rsptime = OS_CYCLES_TO_NSEC(osGetTime() - rspstart) / 1000;

#ifdef	RSP_DEBUG
    /*------ The ASSERT process of the micro-code. ------*/
    if (ucCheckAssert()){
      ucDebugGfxLogPrint(&tlist);  	/* Output the process log of RSP, Gfx and DL. */
//	ucDebugRdpFifoPrint(&tlist); 	/* Output the RDP and fifo buffers.           */
//	ucDebugIMEMPrint(); 		/* Output IMEM.                     	      */
//      ucDebugDMEMPrint(); 		/* Output DMEM.                     	      */
      ucDebugAssertPrint();		/* Output Assert stop location, etc.          */
      ucDebugInfoPrint();		/* Output the work area for Debugging.        */
      while(1);
    }
#endif

#if 0
    /*------ Output the DEBUG information. ------*/
    if (Ac.pad[0].push & Z_TRIG){
      ucDebugRdpFifoPrint(&tlist); 	/* Output the RDP and fifo buffers.    */
      ucDebugInfoPrint();		/* Output the work area for Debugging. */
    }
#endif
    osRecvMesg(&rdpMessageQ, NULL, OS_MESG_BLOCK);
    rdptime = OS_CYCLES_TO_NSEC(osGetTime() - rspstart) / 1000;
    
    /* Switching the Frame. */
    osViSwapBuffer(system_cfb[draw_frame]);
    draw_frame ^= 1;

    /* Accept the controller data. */
    osRecvMesg(&siMessageQ, NULL, OS_MESG_BLOCK);
    osContGetReadData(contPad);
    
    /* The input process. */
    actionUpdate();
  }
}