Пример #1
0
std::vector<std::string> ConfigReader::ScanFolder(std::string path){
    std::vector<std::string> config_files;

    struct dirent *dirent = NULL;
	DIR *dirHandle = opendir(path.c_str());
	if (dirHandle == NULL){
        DEBUG_FUNCTION_LINE("Failed to open dir %s\n",path.c_str());
        config_files.push_back("ERROR"); //TODO: Find a proper solution
		return config_files;
	}
	while ((dirent = readdir(dirHandle)) != 0){
		bool isDir = dirent->d_type & DT_DIR;
		const char *filename = dirent->d_name;

		if(strcmp(filename,".") == 0 || strcmp(filename,"..") == 0){ continue; }

        std::string newPath = path + "/" + std::string(filename);

        if(!isDir && StringTools::EndsWith(std::string(filename),".ini")){
            config_files.push_back(newPath);
            if(HID_DEBUG){ DEBUG_FUNCTION_LINE("Found ini: %s \n",newPath.c_str()); }
        }
	}

    return config_files;
}
Пример #2
0
void Init_SD_USB() {
    int32_t res = IOSUHAX_Open(NULL);
    if(res < 0) {
        ExecuteIOSExploitWithDefaultConfig();
    }
    deleteDevTabsNames();
    mount_fake();
    gSDInitDone |= WUPS_SDUSB_MOUNTED_FAKE;

    if(res < 0) {
        DEBUG_FUNCTION_LINE("IOSUHAX_open failed\n");
        if((res = mount_sd_fat("sd")) >= 0) {
            DEBUG_FUNCTION_LINE("mount_sd_fat success\n");
            gSDInitDone |= WUPS_SDUSB_MOUNTED_OS_SD;
        } else {
            DEBUG_FUNCTION_LINE("mount_sd_fat failed %d\n",res);
        }
    } else {
        DEBUG_FUNCTION_LINE("Using IOSUHAX for SD/USB access\n");
        gSDInitDone |= WUPS_SDUSB_LIBIOSU_LOADED;
        int32_t ntfs_mounts = mountAllNTFS();
        if(ntfs_mounts > 0) {
            gSDInitDone |= WUPS_USB_MOUNTED_LIBNTFS;
        }

        if(mount_libfatAll() == 0) {
            gSDInitDone |= WUPS_SD_MOUNTED_LIBFAT;
            gSDInitDone |= WUPS_USB_MOUNTED_LIBFAT;
        }
    }
}
Пример #3
0
 static ConfigValues *getInstance() {
     if(instance == NULL){
         DEBUG_FUNCTION_LINE("We need a new instance!!!\n");
         instance = new ConfigValues();
     }
     return instance;
 }
Пример #4
0
void RestorePatches() {
    for(int32_t plugin_index=gbl_replacement_data.number_used_plugins-1; plugin_index>=0; plugin_index--) {
        DEBUG_FUNCTION_LINE("Restoring function for plugin: %d\n",plugin_index);
        new_RestoreInvidualInstructions(&gbl_replacement_data.plugin_data[plugin_index]);
    }
    RestoreInvidualInstructions(method_hooks_hooks, method_hooks_size_hooks);
}
Пример #5
0
void ConfigReader::processFileList(std::vector<std::string> path){
    for(std::vector<std::string>::iterator it = path.begin(); it != path.end(); ++it) {
        DEBUG_FUNCTION_LINE("Reading %s\n",it->c_str());
        std::string result = loadFileToString(*it);

        ConfigParser parser(result);
        parser.parseIni();
    }
}
Пример #6
0
bool ConfigReader::ReadConfigs(std::string path){
    std::vector<std::string> fileList = ScanFolder(path);
    if(fileList.size() == 1 && fileList[0].compare("ERROR") == 0){
        return false;
    }

    if(fileList.size() > 0){
        if(HID_DEBUG){ DEBUG_FUNCTION_LINE("Found %d config files\n",fileList.size()); }
        processFileList(fileList);
    }
    return true;
}
Пример #7
0
void DeInit_SD_USB() {
    DEBUG_FUNCTION_LINE("Called this function.\n");

    if(gSDInitDone & WUPS_SDUSB_MOUNTED_FAKE) {
        DEBUG_FUNCTION_LINE("Unmounting fake\n");
        unmount_fake();
        gSDInitDone &= ~WUPS_SDUSB_MOUNTED_FAKE;
    }
    if(gSDInitDone & WUPS_SDUSB_MOUNTED_OS_SD) {
        DEBUG_FUNCTION_LINE("Unmounting OS SD\n");
        unmount_sd_fat("sd");
        gSDInitDone &= ~WUPS_SDUSB_MOUNTED_OS_SD;
    }

    if(gSDInitDone & WUPS_SD_MOUNTED_LIBFAT) {
        DEBUG_FUNCTION_LINE("Unmounting LIBFAT SD\n");
        unmount_libfat("sd");
        gSDInitDone &= ~WUPS_SD_MOUNTED_LIBFAT;
    }

    if(gSDInitDone & WUPS_USB_MOUNTED_LIBFAT) {
        DEBUG_FUNCTION_LINE("Unmounting LIBFAT USB\n");
        unmount_libfat("usb");
        gSDInitDone &= ~WUPS_USB_MOUNTED_LIBFAT;
    }

    if(gSDInitDone & WUPS_USB_MOUNTED_LIBNTFS) {
        DEBUG_FUNCTION_LINE("Unmounting LIBNTFS USB\n");
        unmountAllNTFS();
        gSDInitDone &= ~WUPS_USB_MOUNTED_LIBNTFS;
    }

    if(gSDInitDone & WUPS_SDUSB_LIBIOSU_LOADED) {
        DEBUG_FUNCTION_LINE("Calling IOSUHAX_Close\n");
        IOSUHAX_Close();
        gSDInitDone &= ~WUPS_SDUSB_LIBIOSU_LOADED;

    }
    deleteDevTabsNames();
    if(gSDInitDone != WUPS_SDUSB_MOUNTED_NONE) {
        DEBUG_FUNCTION_LINE("WARNING. Some devices are still mounted.\n");
    }
    DEBUG_FUNCTION_LINE("Function end.\n");
}
Пример #8
0
	void InitValues(){
        DEBUG_FUNCTION_LINE("Init values for the configuration\n");
        CONTPRStringToValue["VPAD_BUTTON_A"] =                          CONTRPS_VPAD_BUTTON_A;
        CONTPRStringToValue["VPAD_BUTTON_B"] =                          CONTRPS_VPAD_BUTTON_B;
        CONTPRStringToValue["VPAD_BUTTON_X"] =                          CONTRPS_VPAD_BUTTON_X;
        CONTPRStringToValue["VPAD_BUTTON_Y"] =                          CONTRPS_VPAD_BUTTON_Y;
        /* Normal DPAD */
        CONTPRStringToValue["VPAD_BUTTON_LEFT"] =                       CONTRPS_VPAD_BUTTON_LEFT;
        CONTPRStringToValue["VPAD_BUTTON_RIGHT"] =                      CONTRPS_VPAD_BUTTON_RIGHT;
        CONTPRStringToValue["VPAD_BUTTON_UP"] =                         CONTRPS_VPAD_BUTTON_UP;
        CONTPRStringToValue["VPAD_BUTTON_DOWN"] =                       CONTRPS_VPAD_BUTTON_DOWN;
        /* DPAD hat mode */
        CONTPRStringToValue["VPAD_BUTTON_DPAD_N"] =                     CONTRPS_VPAD_BUTTON_DPAD_N;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_NE"] =                    CONTRPS_VPAD_BUTTON_DPAD_NE;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_E"] =                     CONTRPS_VPAD_BUTTON_DPAD_E;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_SE"] =                    CONTRPS_VPAD_BUTTON_DPAD_SE;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_S"] =                     CONTRPS_VPAD_BUTTON_DPAD_S;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_SW"] =                    CONTRPS_VPAD_BUTTON_DPAD_SW;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_W"] =                     CONTRPS_VPAD_BUTTON_DPAD_W;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_NW"] =                    CONTRPS_VPAD_BUTTON_DPAD_NW;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_NEUTRAL"] =               CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL;
        /* DPAD Absolute mode */
        CONTPRStringToValue["VPAD_BUTTON_DPAD_ABS_UP"] =                CONTRPS_VPAD_BUTTON_DPAD_ABS_UP;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_ABS_DOWN"] =              CONTRPS_VPAD_BUTTON_DPAD_ABS_DOWN;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_ABS_LEFT"] =              CONTRPS_VPAD_BUTTON_DPAD_ABS_LEFT;
        CONTPRStringToValue["VPAD_BUTTON_DPAD_ABS_RIGHT"] =             CONTRPS_VPAD_BUTTON_DPAD_ABS_RIGHT;
        /* */
        CONTPRStringToValue["VPAD_BUTTON_ZL"] =                         CONTRPS_VPAD_BUTTON_ZL;
        CONTPRStringToValue["VPAD_BUTTON_ZR"] =                         CONTRPS_VPAD_BUTTON_ZR;
        CONTPRStringToValue["VPAD_BUTTON_L"] =                          CONTRPS_VPAD_BUTTON_L;
        CONTPRStringToValue["VPAD_BUTTON_R"] =                          CONTRPS_VPAD_BUTTON_R;
        CONTPRStringToValue["VPAD_BUTTON_PLUS"] =                       CONTRPS_VPAD_BUTTON_PLUS;
        CONTPRStringToValue["VPAD_BUTTON_MINUS"] =                      CONTRPS_VPAD_BUTTON_MINUS;
        CONTPRStringToValue["VPAD_BUTTON_HOME"] =                       CONTRPS_VPAD_BUTTON_HOME;
        CONTPRStringToValue["VPAD_BUTTON_SYNC"] =                       CONTRPS_VPAD_BUTTON_SYNC;
        CONTPRStringToValue["VPAD_BUTTON_STICK_R"] =                    CONTRPS_VPAD_BUTTON_STICK_R;
        CONTPRStringToValue["VPAD_BUTTON_STICK_L"] =                    CONTRPS_VPAD_BUTTON_STICK_L;

        CONTPRStringToValue["VPAD_STICK_R_EMULATION_LEFT"] =            CONTRPS_VPAD_STICK_R_EMULATION_LEFT;
        CONTPRStringToValue["VPAD_STICK_R_EMULATION_RIGHT"] =           CONTRPS_VPAD_STICK_R_EMULATION_RIGHT;
        CONTPRStringToValue["VPAD_STICK_R_EMULATION_UP"] =              CONTRPS_VPAD_STICK_R_EMULATION_UP;
        CONTPRStringToValue["VPAD_STICK_R_EMULATION_DOWN"] =            CONTRPS_VPAD_STICK_R_EMULATION_DOWN;
        CONTPRStringToValue["VPAD_STICK_L_EMULATION_LEFT"] =            CONTRPS_VPAD_STICK_L_EMULATION_LEFT;
        CONTPRStringToValue["VPAD_STICK_L_EMULATION_RIGHT"] =           CONTRPS_VPAD_STICK_L_EMULATION_RIGHT;
        CONTPRStringToValue["VPAD_STICK_L_EMULATION_UP"] =              CONTRPS_VPAD_STICK_L_EMULATION_UP;
        CONTPRStringToValue["VPAD_STICK_L_EMULATION_DOWN"] =            CONTRPS_VPAD_STICK_L_EMULATION_DOWN;

        CONTPRStringToValue["VPAD_L_STICK_UP"] =                        CONTRPS_VPAD_BUTTON_L_STICK_UP;
        CONTPRStringToValue["VPAD_L_STICK_DOWN"] =                      CONTRPS_VPAD_BUTTON_L_STICK_DOWN;
        CONTPRStringToValue["VPAD_L_STICK_LEFT"] =                      CONTRPS_VPAD_BUTTON_L_STICK_LEFT;
        CONTPRStringToValue["VPAD_L_STICK_RIGHT"] =                     CONTRPS_VPAD_BUTTON_L_STICK_RIGHT;

        CONTPRStringToValue["VPAD_R_STICK_UP"] =                        CONTRPS_VPAD_BUTTON_R_STICK_UP;
        CONTPRStringToValue["VPAD_R_STICK_DOWN"] =                      CONTRPS_VPAD_BUTTON_R_STICK_DOWN;
        CONTPRStringToValue["VPAD_R_STICK_LEFT"] =                      CONTRPS_VPAD_BUTTON_R_STICK_LEFT;
        CONTPRStringToValue["VPAD_R_STICK_RIGHT"] =                     CONTRPS_VPAD_BUTTON_R_STICK_RIGHT;

        CONTPRStringToValue["VPAD_L_STICK_X"] =                         CONTRPS_VPAD_BUTTON_L_STICK_X;
        CONTPRStringToValue["VPAD_L_STICK_X_MINMAX"] =                  CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX;
        CONTPRStringToValue["VPAD_L_STICK_Y"] =                         CONTRPS_VPAD_BUTTON_L_STICK_Y;
        CONTPRStringToValue["VPAD_L_STICK_Y_MINMAX"] =                  CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX;
        CONTPRStringToValue["VPAD_R_STICK_X"] =                         CONTRPS_VPAD_BUTTON_R_STICK_X;
        CONTPRStringToValue["VPAD_R_STICK_X_MINMAX"] =                  CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX;
        CONTPRStringToValue["VPAD_R_STICK_Y"] =                         CONTRPS_VPAD_BUTTON_R_STICK_Y;
        CONTPRStringToValue["VPAD_R_STICK_Y_MINMAX"] =                  CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX;
        CONTPRStringToValue["VPAD_BUTTON_TV"] =                         CONTRPS_VPAD_BUTTON_TV;

        CONTPRStringToValue["DOUBLE_USE_BUTTON_ACTIVATOR"] =            CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR,
        CONTPRStringToValue["INPUT_FILTER"] =                           CONTRPS_INPUT_FILTER;
        CONTPRStringToValue["PAD1_FILTER"] =                            CONTRPS_PAD1_FILTER;
        CONTPRStringToValue["PAD2_FILTER"] =                            CONTRPS_PAD2_FILTER;
        CONTPRStringToValue["PAD3_FILTER"] =                            CONTRPS_PAD3_FILTER;
        CONTPRStringToValue["PAD4_FILTER"] =                            CONTRPS_PAD4_FILTER;
        CONTPRStringToValue["PAD5_FILTER"] =                            CONTRPS_PAD5_FILTER;

        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_1_PRESSED"] =      CONTRPS_DOUBLE_USE_BUTTON_1_PRESSED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_2_PRESSED"] =      CONTRPS_DOUBLE_USE_BUTTON_2_PRESSED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_3_PRESSED"] =      CONTRPS_DOUBLE_USE_BUTTON_3_PRESSED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_4_PRESSED"] =      CONTRPS_DOUBLE_USE_BUTTON_4_PRESSED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_5_PRESSED"] =      CONTRPS_DOUBLE_USE_BUTTON_5_PRESSED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_1_RELEASED"] =     CONTRPS_DOUBLE_USE_BUTTON_1_RELEASED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_2_RELEASED"] =     CONTRPS_DOUBLE_USE_BUTTON_2_RELEASED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_3_RELEASED"] =     CONTRPS_DOUBLE_USE_BUTTON_3_RELEASED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_4_RELEASED"] =     CONTRPS_DOUBLE_USE_BUTTON_4_RELEASED;
        CONTPRStringToValueSingle["DOUBLE_USE_BUTTON_5_RELEASED"] =     CONTRPS_DOUBLE_USE_BUTTON_5_RELEASED;

        CONTPRStringToValueSingle["BUF_SIZE"] =                         CONTRPS_BUF_SIZE;
        CONTPRStringToValueSingle["DPAD_MODE"] =                        CONTRPS_DPAD_MODE;
        CONTPRStringToValueSingle["DPAD_MASK"] =                        CONTRPS_DPAD_MASK;
        CONTPRStringToValueSingle["VPAD_L_STICK_X_DEADZONE"] =          CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE;
        CONTPRStringToValueSingle["VPAD_L_STICK_Y_DEADZONE"] =          CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE;
        CONTPRStringToValueSingle["VPAD_R_STICK_X_DEADZONE"] =          CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE;
        CONTPRStringToValueSingle["VPAD_R_STICK_Y_DEADZONE"] =          CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE;
        CONTPRStringToValueSingle["VPAD_L_STICK_X_INVERT"] =            CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT;
        CONTPRStringToValueSingle["VPAD_L_STICK_Y_INVERT"] =            CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT;
        CONTPRStringToValueSingle["VPAD_R_STICK_X_INVERT"] =            CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT;
        CONTPRStringToValueSingle["VPAD_R_STICK_Y_INVERT"] =            CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT;

        CONTPRStringToValueSingle["DOUBLE_USE"] =                       CONTRPS_DOUBLE_USE;
        CONTPRStringToValueSingle["PAD_COUNT"] =                        CONTRPS_PAD_COUNT;

        CONTPRStringToValueSingle["VPAD_L_STICK_COPY_DPAD"] =           CONTRPS_VPAD_STICK_L_COPY_DPAD;
        CONTPRStringToValueSingle["VPAD_R_STICK_COPY_DPAD"] =           CONTRPS_VPAD_STICK_R_COPY_DPAD;

        mouseLeftValues["LEFT_CLICK"] =                                 CONTRPS_VPAD_BUTTON_LEFT;
        mouseLeftValues["RIGHT_CLICK"] =                                CONTRPS_VPAD_BUTTON_RIGHT;
        mouseLeftValues["EMULATED_STICK"] =                             CONTRPS_MOUSE_STICK;

        presetGCValues["GC_BUTTON_A"] =                                 HID_GC_BUTTON_A;
        presetGCValues["GC_BUTTON_B"] =                                 HID_GC_BUTTON_B;
        presetGCValues["GC_BUTTON_X"] =                                 HID_GC_BUTTON_X;
        presetGCValues["GC_BUTTON_Y"] =                                 HID_GC_BUTTON_Y;
        presetGCValues["GC_BUTTON_LEFT"] =                              HID_GC_BUTTON_LEFT;
        presetGCValues["GC_BUTTON_RIGHT"] =                             HID_GC_BUTTON_RIGHT;
        presetGCValues["GC_BUTTON_DOWN"] =                              HID_GC_BUTTON_DOWN;
        presetGCValues["GC_BUTTON_UP"] =                                HID_GC_BUTTON_UP;
        presetGCValues["GC_BUTTON_START"] =                             HID_GC_BUTTON_START;
        presetGCValues["GC_BUTTON_Z"] =                                 HID_GC_BUTTON_Z;
        presetGCValues["GC_BUTTON_L"] =                                 HID_GC_BUTTON_L;
        presetGCValues["GC_BUTTON_R"] =                                 HID_GC_BUTTON_R;

        presetDS3Values["DS3_BUTTON_CROSS"] =                           HID_DS3_BUTTON_CROSS;
        presetDS3Values["DS3_BUTTON_CIRCLE"] =                          HID_DS3_BUTTON_CIRCLE;
        presetDS3Values["DS3_BUTTON_SQUARE"] =                          HID_DS3_BUTTON_SQUARE;
        presetDS3Values["DS3_BUTTON_TRIANGLE"] =                        HID_DS3_BUTTON_TRIANGLE;

        presetDS3Values["DS3_BUTTON_L1"] =                              HID_DS3_BUTTON_L1;
        presetDS3Values["DS3_BUTTON_L2"] =                              HID_DS3_BUTTON_L2;
        presetDS3Values["DS3_BUTTON_L3"] =                              HID_DS3_BUTTON_L3;
        presetDS3Values["DS3_BUTTON_R1"] =                              HID_DS3_BUTTON_R1;
        presetDS3Values["DS3_BUTTON_R2"] =                              HID_DS3_BUTTON_R2;
        presetDS3Values["DS3_BUTTON_R3"] =                              HID_DS3_BUTTON_R3;

        presetDS3Values["DS3_BUTTON_SELECT"] =                          HID_DS3_BUTTON_SELECT;
        presetDS3Values["DS3_BUTTON_START"] =                           HID_DS3_BUTTON_START;
        presetDS3Values["DS3_BUTTON_LEFT"] =                            HID_DS3_BUTTON_LEFT;
        presetDS3Values["DS3_BUTTON_RIGHT"] =                           HID_DS3_BUTTON_RIGHT;
        presetDS3Values["DS3_BUTTON_UP"] =                              HID_DS3_BUTTON_UP;
        presetDS3Values["DS3_BUTTON_DOWN"] =                            HID_DS3_BUTTON_DOWN;
        presetDS3Values["DS3_BUTTON_GUIDE"] =                           HID_DS3_BUTTON_GUIDE;

        presetDS4Values["DS4_BUTTON_CROSS"] =                           HID_DS4_BUTTON_CROSS;
        presetDS4Values["DS4_BUTTON_CIRCLE"] =                          HID_DS4_BUTTON_CIRCLE;
        presetDS4Values["DS4_BUTTON_SQUARE"] =                          HID_DS4_BUTTON_SQUARE;
        presetDS4Values["DS4_BUTTON_TRIANGLE"] =                        HID_DS4_BUTTON_TRIANGLE;

        presetDS4Values["DS4_BUTTON_L1"] =                              HID_DS4_BUTTON_L1;
        presetDS4Values["DS4_BUTTON_L2"] =                              HID_DS4_BUTTON_L2;
        presetDS4Values["DS4_BUTTON_L3"] =                              HID_DS4_BUTTON_L3;
        presetDS4Values["DS4_BUTTON_R1"] =                              HID_DS4_BUTTON_R1;
        presetDS4Values["DS4_BUTTON_R2"] =                              HID_DS4_BUTTON_R2;
        presetDS4Values["DS4_BUTTON_R3"] =                              HID_DS4_BUTTON_R3;

        presetDS4Values["DS4_BUTTON_SHARE"] =                           HID_DS4_BUTTON_SHARE;
        presetDS4Values["DS4_BUTTON_OPTIONS"] =                         HID_DS4_BUTTON_OPTIONS;
        presetDS4Values["DS4_BUTTON_DPAD_TYPE"] =                       HID_DS4_BUTTON_DPAD_TYPE;

        presetDS4Values["DS4_BUTTON_DPAD_N"] =                          HID_DS4_BUTTON_DPAD_N;
        presetDS4Values["DS4_BUTTON_DPAD_NE"] =                         HID_DS4_BUTTON_DPAD_NE;
        presetDS4Values["DS4_BUTTON_DPAD_E"] =                          HID_DS4_BUTTON_DPAD_E;
        presetDS4Values["DS4_BUTTON_DPAD_SE"] =                         HID_DS4_BUTTON_DPAD_SE;
        presetDS4Values["DS4_BUTTON_DPAD_S"] =                          HID_DS4_BUTTON_DPAD_S;
        presetDS4Values["DS4_BUTTON_DPAD_SW"] =                         HID_DS4_BUTTON_DPAD_SW;
        presetDS4Values["DS4_BUTTON_DPAD_W"] =                          HID_DS4_BUTTON_DPAD_W;
        presetDS4Values["DS4_BUTTON_DPAD_NW"] =                         HID_DS4_BUTTON_DPAD_NW;
        presetDS4Values["DS4_BUTTON_DPAD_NEUTRAL"] =                    HID_DS4_BUTTON_DPAD_NEUTRAL;

        presetDS4Values["DS4_BUTTON_GUIDE"] =                           HID_DS4_BUTTON_GUIDE;
        presetDS4Values["DS4_BUTTON_T_PAD_CLICK"] =                     HID_DS4_BUTTON_T_PAD_CLICK;

        presetXInputValues["XINPUT_BUTTON_A"] =                         HID_XINPUT_BUTTON_A;
        presetXInputValues["XINPUT_BUTTON_B"] =                         HID_XINPUT_BUTTON_B;
        presetXInputValues["XINPUT_BUTTON_X"] =                         HID_XINPUT_BUTTON_X;
        presetXInputValues["XINPUT_BUTTON_Y"] =                         HID_XINPUT_BUTTON_Y;

        presetXInputValues["XINPUT_BUTTON_LB"] =                        HID_XINPUT_BUTTON_LB;
        presetXInputValues["XINPUT_BUTTON_LT"] =                        HID_XINPUT_BUTTON_LT;
        presetXInputValues["XINPUT_BUTTON_L3"] =                        HID_XINPUT_BUTTON_L3;
        presetXInputValues["XINPUT_BUTTON_RB"] =                        HID_XINPUT_BUTTON_RB;
        presetXInputValues["XINPUT_BUTTON_RT"] =                        HID_XINPUT_BUTTON_RT;
        presetXInputValues["XINPUT_BUTTON_R3"] =                        HID_XINPUT_BUTTON_R3;

        presetXInputValues["XINPUT_BUTTON_START"] =                     HID_XINPUT_BUTTON_START;
        presetXInputValues["XINPUT_BUTTON_BACK"] =                      HID_XINPUT_BUTTON_BACK;
        presetXInputValues["XINPUT_BUTTON_DPAD_TYPE"] =                 HID_XINPUT_BUTTON_DPAD_TYPE;

        presetXInputValues["XINPUT_BUTTON_DPAD_UP"] =                   HID_XINPUT_BUTTON_UP;
        presetXInputValues["XINPUT_BUTTON_DPAD_DOWN"] =                 HID_XINPUT_BUTTON_DOWN;
        presetXInputValues["XINPUT_BUTTON_DPAD_LEFT"] =                 HID_XINPUT_BUTTON_LEFT;
        presetXInputValues["XINPUT_BUTTON_DPAD_RIGHT"] =                HID_XINPUT_BUTTON_RIGHT;

        presetXInputValues["XINPUT_BUTTON_GUIDE"] =                     HID_XINPUT_BUTTON_GUIDE;

        presetSwitchProValues["SWITCH_PRO_BUTTON_A"] =                  HID_SWITCH_PRO_BT_BUTTON_A;
        presetSwitchProValues["SWITCH_PRO_BUTTON_B"] =                  HID_SWITCH_PRO_BT_BUTTON_B;
        presetSwitchProValues["SWITCH_PRO_BUTTON_X"] =                  HID_SWITCH_PRO_BT_BUTTON_X;
        presetSwitchProValues["SWITCH_PRO_BUTTON_Y"] =                  HID_SWITCH_PRO_BT_BUTTON_Y;

        presetSwitchProValues["SWITCH_PRO_BUTTON_PLUS"] =               HID_SWITCH_PRO_BT_BUTTON_PLUS;
        presetSwitchProValues["SWITCH_PRO_BUTTON_MINUS"] =              HID_SWITCH_PRO_BT_BUTTON_MINUS;
        presetSwitchProValues["SWITCH_PRO_BUTTON_HOME"] =               HID_SWITCH_PRO_BT_BUTTON_HOME;

        presetSwitchProValues["SWITCH_PRO_BUTTON_L"] =                  HID_SWITCH_PRO_BT_BUTTON_L;
        presetSwitchProValues["SWITCH_PRO_BUTTON_R"] =                  HID_SWITCH_PRO_BT_BUTTON_R;

        presetSwitchProValues["SWITCH_PRO_BUTTON_ZL"] =                 HID_SWITCH_PRO_BT_BUTTON_ZL;
        presetSwitchProValues["SWITCH_PRO_BUTTON_ZR"] =                 HID_SWITCH_PRO_BT_BUTTON_ZR;

        presetSwitchProValues["SWITCH_PRO_BUTTON_STICK_L"] =            HID_SWITCH_PRO_BT_BUTTON_STICK_L;
        presetSwitchProValues["SWITCH_PRO_BUTTON_STICK_R"] =            HID_SWITCH_PRO_BT_BUTTON_STICK_R;

        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_N"] =             HID_SWITCH_PRO_BT_BUTTON_DPAD_N;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_NE"] =            HID_SWITCH_PRO_BT_BUTTON_DPAD_NE;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_E"] =             HID_SWITCH_PRO_BT_BUTTON_DPAD_E;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_SE"] =            HID_SWITCH_PRO_BT_BUTTON_DPAD_SE;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_S"] =             HID_SWITCH_PRO_BT_BUTTON_DPAD_S;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_SW"] =            HID_SWITCH_PRO_BT_BUTTON_DPAD_SW;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_W"] =             HID_SWITCH_PRO_BT_BUTTON_DPAD_W;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_NW"] =            HID_SWITCH_PRO_BT_BUTTON_DPAD_NW;
        presetSwitchProValues["SWITCH_PRO_BUTTON_DPAD_NEUTRAL"] =       HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL;

        presetKeyboardValues["KEYBOARD_SHIFT"] =                        HID_KEYBOARD_BUTTON_SHIFT;
        presetKeyboardValues["KEYBOARD_A"] =                            HID_KEYBOARD_BUTTON_A;
        presetKeyboardValues["KEYBOARD_B"] =                            HID_KEYBOARD_BUTTON_B;
        presetKeyboardValues["KEYBOARD_C"] =                            HID_KEYBOARD_BUTTON_C;
        presetKeyboardValues["KEYBOARD_D"] =                            HID_KEYBOARD_BUTTON_D;
        presetKeyboardValues["KEYBOARD_E"] =                            HID_KEYBOARD_BUTTON_E;
        presetKeyboardValues["KEYBOARD_F"] =                            HID_KEYBOARD_BUTTON_F;
        presetKeyboardValues["KEYBOARD_G"] =                            HID_KEYBOARD_BUTTON_G;
        presetKeyboardValues["KEYBOARD_H"] =                            HID_KEYBOARD_BUTTON_H;
        presetKeyboardValues["KEYBOARD_I"] =                            HID_KEYBOARD_BUTTON_I;
        presetKeyboardValues["KEYBOARD_J"] =                            HID_KEYBOARD_BUTTON_J;
        presetKeyboardValues["KEYBOARD_K"] =                            HID_KEYBOARD_BUTTON_K;
        presetKeyboardValues["KEYBOARD_L"] =                            HID_KEYBOARD_BUTTON_L;
        presetKeyboardValues["KEYBOARD_M"] =                            HID_KEYBOARD_BUTTON_M;
        presetKeyboardValues["KEYBOARD_N"] =                            HID_KEYBOARD_BUTTON_N;
        presetKeyboardValues["KEYBOARD_O"] =                            HID_KEYBOARD_BUTTON_O;
        presetKeyboardValues["KEYBOARD_P"] =                            HID_KEYBOARD_BUTTON_P;
        presetKeyboardValues["KEYBOARD_Q"] =                            HID_KEYBOARD_BUTTON_Q;
        presetKeyboardValues["KEYBOARD_R"] =                            HID_KEYBOARD_BUTTON_R;
        presetKeyboardValues["KEYBOARD_S"] =                            HID_KEYBOARD_BUTTON_S;
        presetKeyboardValues["KEYBOARD_T"] =                            HID_KEYBOARD_BUTTON_T;
        presetKeyboardValues["KEYBOARD_U"] =                            HID_KEYBOARD_BUTTON_U;
        presetKeyboardValues["KEYBOARD_V"] =                            HID_KEYBOARD_BUTTON_V;
        presetKeyboardValues["KEYBOARD_W"] =                            HID_KEYBOARD_BUTTON_W;
        presetKeyboardValues["KEYBOARD_X"] =                            HID_KEYBOARD_BUTTON_X;
        presetKeyboardValues["KEYBOARD_Y"] =                            HID_KEYBOARD_BUTTON_Y;
        presetKeyboardValues["KEYBOARD_Z"] =                            HID_KEYBOARD_BUTTON_Z;
        presetKeyboardValues["KEYBOARD_F1"] =                           HID_KEYBOARD_BUTTON_F1;
        presetKeyboardValues["KEYBOARD_F2"] =                           HID_KEYBOARD_BUTTON_F2;
        presetKeyboardValues["KEYBOARD_F3"] =                           HID_KEYBOARD_BUTTON_F3;
        presetKeyboardValues["KEYBOARD_F4"] =                           HID_KEYBOARD_BUTTON_F4;
        presetKeyboardValues["KEYBOARD_F5"] =                           HID_KEYBOARD_BUTTON_F5;
        presetKeyboardValues["KEYBOARD_F6"] =                           HID_KEYBOARD_BUTTON_F6;
        presetKeyboardValues["KEYBOARD_F7"] =                           HID_KEYBOARD_BUTTON_F7;
        presetKeyboardValues["KEYBOARD_F8"] =                           HID_KEYBOARD_BUTTON_F8;
        presetKeyboardValues["KEYBOARD_F9"] =                           HID_KEYBOARD_BUTTON_F9;
        presetKeyboardValues["KEYBOARD_F10"] =                          HID_KEYBOARD_BUTTON_F10;
        presetKeyboardValues["KEYBOARD_F11"] =                          HID_KEYBOARD_BUTTON_F11;
        presetKeyboardValues["KEYBOARD_F12"] =                          HID_KEYBOARD_BUTTON_F12;
        presetKeyboardValues["KEYBOARD_1"] =                            HID_KEYBOARD_BUTTON_1;
        presetKeyboardValues["KEYBOARD_2"] =                            HID_KEYBOARD_BUTTON_2;
        presetKeyboardValues["KEYBOARD_3"] =                            HID_KEYBOARD_BUTTON_3;
        presetKeyboardValues["KEYBOARD_4"] =                            HID_KEYBOARD_BUTTON_4;
        presetKeyboardValues["KEYBOARD_5"] =                            HID_KEYBOARD_BUTTON_5;
        presetKeyboardValues["KEYBOARD_6"] =                            HID_KEYBOARD_BUTTON_6;
        presetKeyboardValues["KEYBOARD_7"] =                            HID_KEYBOARD_BUTTON_7;
        presetKeyboardValues["KEYBOARD_8"] =                            HID_KEYBOARD_BUTTON_8;
        presetKeyboardValues["KEYBOARD_9"] =                            HID_KEYBOARD_BUTTON_9;
        presetKeyboardValues["KEYBOARD_0"] =                            HID_KEYBOARD_BUTTON_0;

        presetKeyboardValues["KEYBOARD_RETURN"] =                       HID_KEYBOARD_BUTTON_RETURN;
        presetKeyboardValues["KEYBOARD_ESCAPE"] =                       HID_KEYBOARD_BUTTON_ESCAPE;
        presetKeyboardValues["KEYBOARD_DELETE"] =                       HID_KEYBOARD_BUTTON_DELETE;
        presetKeyboardValues["KEYBOARD_TAB"] =                          HID_KEYBOARD_BUTTON_TAB;
        presetKeyboardValues["KEYBOARD_SPACEBAR"] =                     HID_KEYBOARD_BUTTON_SPACEBAR;
        presetKeyboardValues["KEYBOARD_CAPSLOCK"] =                     HID_KEYBOARD_BUTTON_CAPSLOCK;
        presetKeyboardValues["KEYBOARD_PRINTSCREEN"] =                  HID_KEYBOARD_BUTTON_PRINTSCREEN;
        presetKeyboardValues["KEYBOARD_SCROLLLOCK"] =                   HID_KEYBOARD_BUTTON_SCROLLLOCK;
        presetKeyboardValues["KEYBOARD_PAUSE"] =                        HID_KEYBOARD_BUTTON_PAUSE;
        presetKeyboardValues["KEYBOARD_INSERT"] =                       HID_KEYBOARD_BUTTON_INSERT;
        presetKeyboardValues["KEYBOARD_HOME"] =                         HID_KEYBOARD_BUTTON_HOME;
        presetKeyboardValues["KEYBOARD_PAGEUP"] =                       HID_KEYBOARD_BUTTON_PAGEUP;
        presetKeyboardValues["KEYBOARD_PAGEDOWN"] =                     HID_KEYBOARD_BUTTON_PAGEDOWN;
        presetKeyboardValues["KEYBOARD_DELETEFORWARD"] =                HID_KEYBOARD_BUTTON_DELETEFORWARD;
        presetKeyboardValues["KEYBOARD_LEFT_CONTROL"] =                 HID_KEYBOARD_BUTTON_LEFT_CONTROL;
        presetKeyboardValues["KEYBOARD_LEFT_ALT"] =                     HID_KEYBOARD_BUTTON_LEFT_ALT;
        presetKeyboardValues["KEYBOARD_RIGHT_CONTROL"] =                HID_KEYBOARD_BUTTON_RIGHT_CONTROL;
        presetKeyboardValues["KEYBOARD_RIGHT_SHIFT"] =                  HID_KEYBOARD_BUTTON_RIGHT_SHIFT;
        presetKeyboardValues["KEYBOARD_RIGHT_ALT"] =                    HID_KEYBOARD_BUTTON_RIGHT_ALT;
        presetKeyboardValues["KEYBOARD_END"] =                          HID_KEYBOARD_BUTTON_END;

        presetKeyboardValues["KEYBOARD_LEFT"] =                         HID_KEYBOARD_BUTTON_LEFT;
        presetKeyboardValues["KEYBOARD_RIGHT"] =                        HID_KEYBOARD_BUTTON_RIGHT;
        presetKeyboardValues["KEYBOARD_DOWN"] =                         HID_KEYBOARD_BUTTON_DOWN;
        presetKeyboardValues["KEYBOARD_UP"] =                           HID_KEYBOARD_BUTTON_UP;

        presetKeyboardValues["KEYBOARD_KEYPAD_1"] =                     HID_KEYBOARD_KEYPAD_BUTTON_1;
        presetKeyboardValues["KEYBOARD_KEYPAD_2"] =                     HID_KEYBOARD_KEYPAD_BUTTON_2;
        presetKeyboardValues["KEYBOARD_KEYPAD_3"] =                     HID_KEYBOARD_KEYPAD_BUTTON_3;
        presetKeyboardValues["KEYBOARD_KEYPAD_4"] =                     HID_KEYBOARD_KEYPAD_BUTTON_4;
        presetKeyboardValues["KEYBOARD_KEYPAD_5"] =                     HID_KEYBOARD_KEYPAD_BUTTON_5;
        presetKeyboardValues["KEYBOARD_KEYPAD_6"] =                     HID_KEYBOARD_KEYPAD_BUTTON_6;
        presetKeyboardValues["KEYBOARD_KEYPAD_7"] =                     HID_KEYBOARD_KEYPAD_BUTTON_7;
        presetKeyboardValues["KEYBOARD_KEYPAD_8"] =                     HID_KEYBOARD_KEYPAD_BUTTON_8;
        presetKeyboardValues["KEYBOARD_KEYPAD_9"] =                     HID_KEYBOARD_KEYPAD_BUTTON_9;
        presetKeyboardValues["KEYBOARD_KEYPAD_0"] =                     HID_KEYBOARD_KEYPAD_BUTTON_0;
        presetKeyboardValues["KEYBOARD_KEYPAD_NUMLOCK"] =               HID_KEYBOARD_KEYPAD_BUTTON_NUMLOCK;
        presetKeyboardValues["KEYBOARD_KEYPAD_MINUS"] =                 HID_KEYBOARD_KEYPAD_BUTTON_MINUS;
        presetKeyboardValues["KEYBOARD_KEYPAD_PLUS"] =                  HID_KEYBOARD_KEYPAD_BUTTON_PLUS;

        presetValues["VPAD_L_STICK"] =                                  DEF_L_STICK;
        presetValues["VPAD_R_STICK"] =                                  DEF_R_STICK;

        presetValues["DPAD_NORMAL"] =                                   CONTRPDM_Normal;
        presetValues["DPAD_HAT"] =                                      CONTRPDM_Hat;
        presetValues["DPAD_ABSOLUTE_2VALUES"] =                         CONTRPDM_Absolute_2Values;
        presetValues["TRUE"] =                                          1;
        presetValues["YES"] =                                           1;
        presetValues["ON"] =                                            1;
        presetValues["FALSE"] =                                         0;
        presetValues["NO"] =                                            0;
        presetValues["OFF"] =                                           0;

        presetSticks["GC_STICK_L_X"] =                                  HID_GC_STICK_L_X;
        presetSticks["GC_STICK_L_Y"] =                                  HID_GC_STICK_L_Y;
        presetSticks["GC_STICK_R_X"] =                                  HID_GC_STICK_R_X;
        presetSticks["GC_STICK_R_Y"] =                                  HID_GC_STICK_R_Y;

        presetSticks["DS3_STICK_L_X"] =                                 HID_DS3_STICK_L_X;
        presetSticks["DS3_STICK_L_Y"] =                                 HID_DS3_STICK_L_Y;
        presetSticks["DS3_STICK_R_X"] =                                 HID_DS3_STICK_R_X;
        presetSticks["DS3_STICK_R_Y"] =                                 HID_DS3_STICK_R_Y;

        presetSticks["DS4_STICK_L_X"] =                                 HID_DS4_STICK_L_X;
        presetSticks["DS4_STICK_L_Y"] =                                 HID_DS4_STICK_L_Y;
        presetSticks["DS4_STICK_R_X"] =                                 HID_DS4_STICK_R_X;
        presetSticks["DS4_STICK_R_Y"] =                                 HID_DS4_STICK_R_Y;

        presetSticks["XINPUT_STICK_L_X"] =                              HID_XINPUT_STICK_L_X;
        presetSticks["XINPUT_STICK_L_Y"] =                              HID_XINPUT_STICK_L_Y;
        presetSticks["XINPUT_STICK_R_X"] =                              HID_XINPUT_STICK_R_X;
        presetSticks["XINPUT_STICK_R_Y"] =                              HID_XINPUT_STICK_R_Y;

        presetSticks["SWITCH_PRO_STICK_L_X"] =                          HID_SWITCH_PRO_BT_STICK_L_X;
        presetSticks["SWITCH_PRO_STICK_L_Y"] =                          HID_SWITCH_PRO_BT_STICK_L_Y;
        presetSticks["SWITCH_PRO_STICK_R_X"] =                          HID_SWITCH_PRO_BT_STICK_R_X;
        presetSticks["SWITCH_PRO_STICK_R_Y"] =                          HID_SWITCH_PRO_BT_STICK_R_Y;

        presetSticks["GC_DPAD_MODE"] =                                  HID_GC_BUTTON_DPAD_TYPE;
        presetSticks["DS3_DPAD_MODE"] =                                 HID_DS3_BUTTON_DPAD_TYPE;
        presetSticks["DS4_DPAD_MODE"] =                                 HID_DS4_BUTTON_DPAD_TYPE;
        presetSticks["XINPUT_DPAD_MODE"] =                              HID_XINPUT_BUTTON_DPAD_TYPE;
        presetSticks["SWITCH_PRO_DPAD_MODE"] =                          HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE;

        gGamePadValuesToCONTRPSString["VPAD_BUTTON_A"] =  				CONTRPS_VPAD_BUTTON_A;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_B"] =                CONTRPS_VPAD_BUTTON_B;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_X"] =                CONTRPS_VPAD_BUTTON_X;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_Y"] =                CONTRPS_VPAD_BUTTON_Y;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_LEFT"] =             CONTRPS_VPAD_BUTTON_LEFT;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_RIGHT"] =            CONTRPS_VPAD_BUTTON_RIGHT;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_UP"] =               CONTRPS_VPAD_BUTTON_UP;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_DOWN"] =             CONTRPS_VPAD_BUTTON_DOWN;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_ZL"] =               CONTRPS_VPAD_BUTTON_ZL;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_ZR"] =               CONTRPS_VPAD_BUTTON_ZR;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_L"] =                CONTRPS_VPAD_BUTTON_L;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_R"] =                CONTRPS_VPAD_BUTTON_R;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_PLUS"] =             CONTRPS_VPAD_BUTTON_PLUS;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_MINUS"] =            CONTRPS_VPAD_BUTTON_MINUS;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_HOME"] =             CONTRPS_VPAD_BUTTON_HOME;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_SYNC"] =             CONTRPS_VPAD_BUTTON_SYNC;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_STICK_R"] =          CONTRPS_VPAD_BUTTON_STICK_R;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_STICK_L"] =          CONTRPS_VPAD_BUTTON_STICK_L;
        gGamePadValuesToCONTRPSString["VPAD_BUTTON_TV"] =               CONTRPS_VPAD_BUTTON_TV;

        gGamePadValuesToCONTRPSString["VPAD_STICK_R_EMULATION_LEFT"] =  CONTRPS_VPAD_STICK_R_EMULATION_LEFT;
        gGamePadValuesToCONTRPSString["VPAD_STICK_R_EMULATION_RIGHT"] = CONTRPS_VPAD_STICK_R_EMULATION_RIGHT;
        gGamePadValuesToCONTRPSString["VPAD_STICK_R_EMULATION_UP"] =    CONTRPS_VPAD_STICK_R_EMULATION_UP;
        gGamePadValuesToCONTRPSString["VPAD_STICK_R_EMULATION_DOWN"] =  CONTRPS_VPAD_STICK_R_EMULATION_DOWN;
        gGamePadValuesToCONTRPSString["VPAD_STICK_L_EMULATION_LEFT"] =  CONTRPS_VPAD_STICK_L_EMULATION_LEFT;
        gGamePadValuesToCONTRPSString["VPAD_STICK_L_EMULATION_RIGHT"] = CONTRPS_VPAD_STICK_L_EMULATION_RIGHT;
        gGamePadValuesToCONTRPSString["VPAD_STICK_L_EMULATION_UP"] =    CONTRPS_VPAD_STICK_L_EMULATION_UP;
        gGamePadValuesToCONTRPSString["VPAD_STICK_L_EMULATION_DOWN"] =  CONTRPS_VPAD_STICK_L_EMULATION_DOWN;

        deviceNames[StringTools::strfmt("%04X%04X",HID_GC_VID,        HID_GC_PID).c_str()]                = HID_GC_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_KEYBOARD_VID,  HID_KEYBOARD_PID).c_str()]          = HID_KEYBOARD_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_MOUSE_VID,     HID_MOUSE_PID).c_str()]             = HID_MOUSE_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_DS3_VID,       HID_DS3_PID).c_str()]               = HID_DS3_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_NEW_DS4_VID,   HID_NEW_DS4_PID).c_str()]           = HID_NEW_DS4_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_DS4_VID,       HID_DS4_PID).c_str()]               = HID_DS4_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_XINPUT_VID,    HID_XINPUT_PID).c_str()]            = HID_XINPUT_STRING;
        deviceNames[StringTools::strfmt("%04X%04X",HID_SWITCH_PRO_VID,HID_SWITCH_PRO_PID).c_str()]        = HID_SWITCH_PRO_STRING;
    }
Пример #9
0
ConfigReader::~ConfigReader(){
    if(HID_DEBUG){ DEBUG_FUNCTION_LINE("~ConfigReader\n"); }
}
Пример #10
0
extern "C" int32_t Menu_Main(int32_t argc, char **argv) {
    if(gAppStatus == 2) {
        //"No, we don't want to patch stuff again.");
        return EXIT_RELAUNCH_ON_LOAD;
    }

    InitOSFunctionPointers();
    InitSocketFunctionPointers(); //For logging
    InitSysFunctionPointers();
    InitFSFunctionPointers();
    InitGX2FunctionPointers();
    InitSysFunctionPointers();
    InitVPadFunctionPointers();
    InitPadScoreFunctionPointers();
    InitAXFunctionPointers();
    InitProcUIFunctionPointers();

    log_init();

    DEBUG_FUNCTION_LINE("We have %d kb for plugins.\n",(PLUGIN_LOCATION_END_ADDRESS-getApplicationEndAddr())/1024);
    //setup_os_exceptions();

    DEBUG_FUNCTION_LINE("Wii U Plugin System Loader %s\n",APP_VERSION);
    DEBUG_FUNCTION_LINE("Sizeof dyn_linking_relocation_data_t %d\n",sizeof(dyn_linking_relocation_data_t));
    Init();

    init_kernel_syscalls();
    wups_init_kernel_syscalls();

    gGameTitleID = OSGetTitleID();

    int32_t result = 0;

    //Reset everything when were going back to the Mii Maker
    if(isInMiiMakerHBL()) {
        CallHook(WUPS_LOADER_HOOK_DEINIT_PLUGIN);
        // Restore patches as the patched functions could change.
        RestorePatches();

        DynamicLinkingHelper::getInstance()->clearAll();

        //PluginLoader * pluginLoader  = PluginLoader::getInstance();
        //std::vector<PluginInformation *> pluginList = pluginLoader->getPluginInformation("sd:/wiiu/plugins/");
        //pluginLoader->loadAndLinkPlugins(pluginList);
        //pluginLoader->clearPluginInformation(pluginList);

        //!*******************************************************************
        //!                    Initialize heap memory                        *
        //!*******************************************************************
        DEBUG_FUNCTION_LINE("Initialize memory management\n");
        memoryInitialize();

        DEBUG_FUNCTION_LINE("Start main application\n");
        result = Application::instance()->exec();
        DEBUG_FUNCTION_LINE("Main application stopped result: %d\n",result);

        DEBUG_FUNCTION_LINE("Application::destroyInstance\n");
        Application::destroyInstance();

        DEBUG_FUNCTION_LINE("Release memory\n");
        memoryRelease();
        CSettings::destroyInstance();
        PluginLoader::destroyInstance();
    }

    if(result == APPLICATION_CLOSE_APPLY_MEMORY) {
        if(!MemoryMapping::isMemoryMapped()) {
            MemoryMapping::setupMemoryMapping();
        }
    }

    DEBUG_FUNCTION_LINE("Do relocations\n");

    std::vector<dyn_linking_relocation_entry_t *> relocations = DynamicLinkingHelper::getInstance()->getAllValidDynamicLinkingRelocations();
    DEBUG_FUNCTION_LINE("Found relocation information for %d functions\n",relocations.size());

    if(!DynamicLinkingHelper::getInstance()->fillRelocations(relocations)) {
        OSFatal("fillRelocations failed.");
    }

    if(!isInMiiMakerHBL()) {
        DEBUG_FUNCTION_LINE("Apply patches.\n");
        ApplyPatchesAndCallHookStartingApp();
        ConfigUtils::loadConfigFromSD();

        if(MemoryMapping::isMemoryMapped()) {
            DEBUG_FUNCTION_LINE("Mapping was already done. Running %016llX\n",gGameTitleID);
            readAndPrintSegmentRegister(NULL,NULL);
            MemoryMapping::readTestValuesFromMemory();
        } else {
            DEBUG_FUNCTION_LINE("<-----------------------------------------------------> \n");
            DEBUG_FUNCTION_LINE("<---------------- COPY PASTE ME START-----------------> \n");
            DEBUG_FUNCTION_LINE("<-----------------------------------------------------> \n");
            DEBUG_FUNCTION_LINE("Mapping was't done. Running %016llX\n",gGameTitleID);
            readAndPrintSegmentRegister(NULL,NULL);
            DEBUG_FUNCTION_LINE("<-----------------------------------------------------> \n");
            DEBUG_FUNCTION_LINE("<----------------- COPY PASTE ME END -----------------> \n");
            DEBUG_FUNCTION_LINE("<-----------------------------------------------------> \n");
        }
        return EXIT_RELAUNCH_ON_LOAD;
    }

    if(result == APPLICATION_CLOSE_APPLY || result == APPLICATION_CLOSE_APPLY_MEMORY) {
        CallHook(WUPS_LOADER_HOOK_INIT_KERNEL);
        CallHook(WUPS_LOADER_HOOK_INIT_FS);
        CallHook(WUPS_LOADER_HOOK_INIT_OVERLAY);
        CallHook(WUPS_LOADER_HOOK_INIT_PLUGIN);
        DEBUG_FUNCTION_LINE("Loading the system menu.\n");
        DeInit();
        SYSLaunchMenu();
        return EXIT_RELAUNCH_ON_LOAD;
    }

    DEBUG_FUNCTION_LINE("Let's go to back to the Homebrew Launcher\n");
    DEBUG_FUNCTION_LINE("Restoring the patched functions\n");
    RestorePatches();
    DEBUG_FUNCTION_LINE("Calling the plugin deinit hook\n");
    CallHook(WUPS_LOADER_HOOK_DEINIT_PLUGIN);
    DEBUG_FUNCTION_LINE("Unmounting SD/USB devices\n");
    DeInit();
    DEBUG_FUNCTION_LINE("Bye bye!\n");
    return EXIT_SUCCESS;
}
Пример #11
0
void Init() {
    memset(&tv_store,0,sizeof(tv_store));
    memset(&drc_store,0,sizeof(drc_store));
    DEBUG_FUNCTION_LINE("Mount SD partition\n");
    Init_SD_USB();
}