////////////////////////////
/* cfe translateButtons.c */
////////////////////////////

#include <pspkernel.h>
#include <pspctrl.h>
#include <string.h>
#include "translateButtons.h"
#include "conf.h"

CONFIGFILE config;

int vshTranslateButtonsByName(char* button) {

	if(strcmp(button, "L")==0) return 0x000100;
	if(strcmp(button, "R")==0) return 0x000200;
	if(strcmp(button, "SQUARE")==0) return 0x008000;
	if(strcmp(button, "CIRCLE")==0) return 0x002000;
	if(strcmp(button, "TRIANGLE")==0) return 0x001000;
	if(strcmp(button, "CROSS")==0) return 0x004000;	
	if(strcmp(button, "UP")==0) return 0x000010;	
	if(strcmp(button, "DOWN")==0) return 0x000040;	
	if(strcmp(button, "RIGHT")==0) return 0x000020;	
	if(strcmp(button, "LEFT")==0) return 0x000080;	
	if(strcmp(button, "HOME")==0) return 0x010000;	
	if(strcmp(button, "NOTE")==0) return 0x800000;	
	if(strcmp(button, "SELECT")==0) return 0x000001;
	if(strcmp(button, "START")==0) return 0x000008;
	if(strcmp(button, "VOL_UP")==0) return 0x100000;
	if(strcmp(button, "VOL_DOWN")==0) return 0x200000;
	if(strcmp(button, "SCREEN")==0) return 0x400000;


}

int translateButtons() {

	comboButton_i=vshTranslateButtonsByName(config.comboButton);
	resetButton1_i=vshTranslateButtonsByName(config.resetButton1);
	resetButton2_i=vshTranslateButtonsByName(config.resetButton2);	
	poweroffButton_i=vshTranslateButtonsByName(config.poweroffButton);	
	cpuspeedButton_i=vshTranslateButtonsByName(config.cpuspeedButton);
	startStopUsbmassButton_i=vshTranslateButtonsByName(config.startStopUsbmassButton);
	startFtpdButton_i=vshTranslateButtonsByName(config.startFtpdButton);
	takeScreenshotButton_i=vshTranslateButtonsByName(config.takeScreenshotButton);
	captureButton_i=vshTranslateButtonsByName(config.captureButton);
	maxBrightnessButton_i=vshTranslateButtonsByName(config.maxBrightnessButton);
	usbhostUmdModeButton_i=vshTranslateButtonsByName(config.usbhostUmdModeButton);
	showHelpButton_i=vshTranslateButtonsByName(config.showHelpButton);
	musicButton_i=vshTranslateButtonsByName(config.musicButton);
	
	return 1;
}
	
