mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Added end-of-line comments and fixed some crashes happening with the VS debugger
This commit is contained in:
parent
0793e063ae
commit
20a5b9dbc8
@ -245,13 +245,23 @@ void ParseInputConfig(const std::string game_id = "") {
|
|||||||
std::string line = "";
|
std::string line = "";
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
// strip the ; and whitespace
|
// Strip the ; and whitespace
|
||||||
line.erase(std::remove(line.begin(), line.end(), ' '), line.end());
|
line.erase(std::remove(line.begin(), line.end(), ' '), line.end());
|
||||||
if (line[line.length() - 1] == ';') {
|
if (line.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Truncate lines starting at #
|
||||||
|
std::size_t comment_pos = line.find('#');
|
||||||
|
if (comment_pos != std::string::npos) {
|
||||||
|
line = line.substr(0, comment_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove trailing semicolon
|
||||||
|
if (!line.empty() && line[line.length() - 1] == ';') {
|
||||||
line = line.substr(0, line.length() - 1);
|
line = line.substr(0, line.length() - 1);
|
||||||
}
|
}
|
||||||
// Ignore comment lines
|
|
||||||
if (line.empty() || line[0] == '#') {
|
if (line.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Split the line by '='
|
// Split the line by '='
|
||||||
@ -552,6 +562,10 @@ bool UpdatePressedKeys(u32 value, bool is_pressed) {
|
|||||||
// Check if a given binding's all keys are currently active.
|
// Check if a given binding's all keys are currently active.
|
||||||
// For now it also extracts the analog inputs' parameters.
|
// For now it also extracts the analog inputs' parameters.
|
||||||
void IsInputActive(BindingConnection& connection, bool& active, bool& analog) {
|
void IsInputActive(BindingConnection& connection, bool& active, bool& analog) {
|
||||||
|
if (pressed_keys.empty()) {
|
||||||
|
active = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
InputBinding i = connection.binding;
|
InputBinding i = connection.binding;
|
||||||
// Extract keys from InputBinding and ignore unused (0) or toggled keys
|
// Extract keys from InputBinding and ignore unused (0) or toggled keys
|
||||||
std::list<u32> input_keys = {i.key1, i.key2, i.key3};
|
std::list<u32> input_keys = {i.key1, i.key2, i.key3};
|
||||||
|
Loading…
Reference in New Issue
Block a user