public static int code_init()
    {
    	int i;
    
    	/* allocate */
    	code_map = new code_info[(int)__code_max];//(struct code_info*)malloc( __code_max * sizeof(struct code_info) );
    	for(int k=0; k< code_map.length; k++) code_map[k]=new code_info();
        if (code_map==null)
    		return -1;
    
    	code_mac = 0;
    
    	/* insert all known codes */
    	for(i=0;i<__code_max;++i)
    	{
    		code_map[code_mac].memory = 0;
    		code_map[code_mac].oscode = 0; /* not used */
    
    		if (__code_key_first <= i && i <= __code_key_last)
    			code_map[code_mac].type = CODE_TYPE_KEYBOARD_STANDARD;
    		else if (__code_joy_first <= i && i <= __code_joy_last)
    			code_map[code_mac].type = CODE_TYPE_JOYSTICK_STANDARD;
    		else
    			code_map[code_mac].type = CODE_TYPE_NONE; /* never happen */
    		++code_mac;
    	}
        //(shadow) we should intialaze that at startup
        for(i=0; i<__ipt_max; i++)
                ui_map[i]=new ui_info();
            
    	return 0;
    }