MCPcopy Create free account
hub / github.com/cathery/sys-con / ParseConfigLine

Function ParseConfigLine

source/Sysmodule/source/config_handler.cpp:87–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 }
86
87 int ParseConfigLine(void *dummy, const char *section, const char *name, const char *value)
88 {
89 if (strncmp(name, "KEY_", 4) == 0)
90 {
91 ControllerButton button = StringToKey(name + 4);
92 ControllerButton buttonValue = StringToKey(value);
93 if (button >= 2)
94 {
95 tempConfig.buttons[button - 2] = buttonValue;
96 return 1;
97 }
98 }
99 else if (strcmp(name, "left_stick_deadzone") == 0)
100 {
101 tempConfig.stickDeadzonePercent[0] = atoi(value);
102 return 1;
103 }
104 else if (strcmp(name, "right_stick_deadzone") == 0)
105 {
106 tempConfig.stickDeadzonePercent[1] = atoi(value);
107 return 1;
108 }
109 else if (strcmp(name, "left_stick_rotation") == 0)
110 {
111 tempConfig.stickRotationDegrees[0] = atoi(value);
112 return 1;
113 }
114 else if (strcmp(name, "right_stick_rotation") == 0)
115 {
116 tempConfig.stickRotationDegrees[1] = atoi(value);
117 return 1;
118 }
119 else if (strcmp(name, "left_trigger_deadzone") == 0)
120 {
121 tempConfig.triggerDeadzonePercent[0] = atoi(value);
122 return 1;
123 }
124 else if (strcmp(name, "right_trigger_deadzone") == 0)
125 {
126 tempConfig.triggerDeadzonePercent[1] = atoi(value);
127 return 1;
128 }
129 else if (strcmp(name, "swap_dpad_and_lstick") == 0)
130 {
131 tempConfig.swapDPADandLSTICK = (strcmp(value, "true") ? false : true);
132 return 1;
133 }
134 else if (strcmp(name, "firmware_path") == 0)
135 {
136 strcpy(firmwarePath, value);
137 return 1;
138 }
139 else if (strncmp(name, "color_", 6) == 0)
140 {
141 if (strcmp(name + 6, "body") == 0)
142 {
143 tempConfig.bodyColor = DecodeColorValue(value);
144 return 1;

Callers

nothing calls this directly

Calls 2

StringToKeyFunction · 0.85
DecodeColorValueFunction · 0.85

Tested by

no test coverage detected