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

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

CONFIGFILE config;

int translateButtonsByName(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=translateButtonsByName(config.comboButton);
	resetButton_i=translateButtonsByName(config.resetButton);	
	poweroffButton_i=translateButtonsByName(config.poweroffButton);	
	cpuspeedButton_i=translateButtonsByName(config.cpuspeedButton);
	startStopUsbmassButton_i=translateButtonsByName(config.startStopUsbmassButton);
	startFtpdButton_i=translateButtonsByName(config.startFtpdButton);
	takeScreenshotButton_i=translateButtonsByName(config.takeScreenshotButton);
	captureButton_i=translateButtonsByName(config.captureButton);
	maxBrightnessButton_i=translateButtonsByName(config.maxBrightnessButton);
	usbhostUmdModeButton_i=translateButtonsByName(config.usbhostUmdModeButton);
	showHelpButton_i=translateButtonsByName(config.showHelpButton);
	
	return 1;
}
	