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

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

CONFIGFILE config;

int gameTranslateButtonsByName(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=gameTranslateButtonsByName(config.comboButton);
	resetButton1_i=gameTranslateButtonsByName(config.resetButton1);
	resetButton2_i=gameTranslateButtonsByName(config.resetButton2);	
	poweroffButton_i=gameTranslateButtonsByName(config.poweroffButton);	
	cpuspeedButton_i=gameTranslateButtonsByName(config.cpuspeedButton);
	startStopUsbmassButton_i=gameTranslateButtonsByName(config.startStopUsbmassButton);
	startFtpdButton_i=gameTranslateButtonsByName(config.startFtpdButton);
	takeScreenshotButton_i=gameTranslateButtonsByName(config.takeScreenshotButton);
	captureButton_i=gameTranslateButtonsByName(config.captureButton);
	maxBrightnessButton_i=gameTranslateButtonsByName(config.maxBrightnessButton);
	showHelpButton_i=gameTranslateButtonsByName(config.showHelpButton);
	musicButton_i=gameTranslateButtonsByName(config.musicButton);
	
	return 1;
}
	
