| 68 | } |
| 69 | |
| 70 | void ConfigFile::ExtractKeys() |
| 71 | { |
| 72 | std::ifstream file; |
| 73 | file.open(fName.c_str()); |
| 74 | |
| 75 | |
| 76 | if (!file) |
| 77 | { |
| 78 | |
| 79 | printf("%s not found! Building a fresh one... ", fName.c_str()); |
| 80 | |
| 81 | std::ofstream outfile("config.ini"); |
| 82 | |
| 83 | //begin cfg dump |
| 84 | outfile << "# GOPHER DEFAULT CONFIGURATION rev1.0 - Auto generated by Gopher360" << std::endl; |
| 85 | outfile << "# If you want a fresh one, just DELETE THIS and re-run Gopher360" << std::endl; |
| 86 | outfile << "# Set which controller buttons will activate the configuration events." << std::endl; |
| 87 | outfile << "# SET 0 FOR NO FUNCTION" << std::endl; |
| 88 | outfile << "# AVAILABLE VALUES AT> https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinput_gamepad(v=vs.85).aspx" << std::endl; |
| 89 | outfile << "# TIP: Sum the hex value for double button shortcuts eg. 0x0010(START) 0x0020(BACK) so 0x0030(START+BACK) will trigger the event only when both are pressed." << std::endl; |
| 90 | outfile << "\n" << std::endl; |
| 91 | outfile << "CONFIG_MOUSE_LEFT = 0x1000 # Left mouse button" << std::endl; |
| 92 | outfile << "CONFIG_MOUSE_RIGHT = 0x4000 # Right mouse button" << std::endl; |
| 93 | outfile << "CONFIG_MOUSE_MIDDLE = 0x0040 # Middle mouse button" << std::endl; |
| 94 | outfile << "CONFIG_HIDE = 0x8000 # Hides the terminal" << std::endl; |
| 95 | outfile << "CONFIG_DISABLE = 0x0030 # Disables the Gopher" << std::endl; |
| 96 | outfile << "CONFIG_DISABLE_VIBRATION = 0x0011 # Disables Gopher Vibrations" << std::endl; |
| 97 | outfile << "CONFIG_SPEED_CHANGE = 0x0300 # Change speed" << std::endl; |
| 98 | outfile << "\n" << std::endl; |
| 99 | outfile << "# KEYBOARD SHORTCUTS ON CONTROLLER BUTTONS" << std::endl; |
| 100 | outfile << "# SET 0 FOR NO FUNCTION" << std::endl; |
| 101 | outfile << "# AVAILABLE VALUES AT> https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731" << std::endl; |
| 102 | outfile << "\n" << std::endl; |
| 103 | outfile << "GAMEPAD_DPAD_UP = 0x26" << std::endl; |
| 104 | outfile << "GAMEPAD_DPAD_DOWN = 0x28" << std::endl; |
| 105 | outfile << "GAMEPAD_DPAD_LEFT = 0x25" << std::endl; |
| 106 | outfile << "GAMEPAD_DPAD_RIGHT = 0x27" << std::endl; |
| 107 | outfile << "GAMEPAD_START = 0x5B" << std::endl; |
| 108 | outfile << "GAMEPAD_BACK = 0xA8" << std::endl; |
| 109 | outfile << "GAMEPAD_LEFT_THUMB = 0" << std::endl; |
| 110 | outfile << "GAMEPAD_RIGHT_THUMB = 0x71" << std::endl; |
| 111 | outfile << "GAMEPAD_LEFT_SHOULDER = 0xA6" << std::endl; |
| 112 | outfile << "GAMEPAD_RIGHT_SHOULDER = 0xA7" << std::endl; |
| 113 | outfile << "GAMEPAD_A = 0" << std::endl; |
| 114 | outfile << "GAMEPAD_B = 0x0D" << std::endl; |
| 115 | outfile << "GAMEPAD_X = 0" << std::endl; |
| 116 | outfile << "GAMEPAD_Y = 0" << std::endl; |
| 117 | outfile << "GAMEPAD_TRIGGER_LEFT = 0x20" << std::endl; |
| 118 | outfile << "GAMEPAD_TRIGGER_RIGHT = 0x08" << std::endl; |
| 119 | //end cfg dump |
| 120 | |
| 121 | outfile.close(); |
| 122 | |
| 123 | file.open(fName.c_str()); |
| 124 | |
| 125 | if (!file) |
| 126 | { |
| 127 |
nothing calls this directly
no outgoing calls
no test coverage detected