Merge branch 'master' into TemporaryHackishBranch

# Conflicts:
#	Core/Util/AudioFormat.cpp
# bad path was disabled so let's just sync
#	UI/CwCheatScreen.cpp
# just because I keep parse function to use multiply cheat.db files
This commit is contained in:
LunaMoo committed 2017-11-30 23:17:57 +01:00
commit aa7b2430a0
47 files changed
+258 -177

No files matched your search

+14 -12
View File
@@ -65,9 +65,9 @@ void CwCheatScreen::CreateCodeList() {
bEnableCheat.clear();
formattedList_.clear();
for (size_t i = 0; i < cheatList.size(); i++) {
if (cheatList[i].substr(0, 2) == "_C") {
if (cheatList[i][0] == '_' && cheatList[i][1] == 'C') {
formattedList_.push_back(cheatList[i].substr(4));
if (cheatList[i].substr(2, 1) == "0") {
if (cheatList[i][2] == '0') {
bEnableCheat.push_back(false);
} else {
bEnableCheat.push_back(true);
@@ -136,11 +136,11 @@ UI::EventReturn CwCheatScreen::OnEnableAll(UI::EventParams &params) {
enableAll = !enableAll;
File::OpenCPPFile(fs, activeCheatFile, std::ios::out);
for (int j = 0; j < (int)cheatList.size(); j++) {
if (cheatList[j].substr(0, 2) == "_C") {
if (cheatList[j].substr(2, 1) == "0" && enableAll) {
cheatList[j].replace(2, 1, "1");
} else if (cheatList[j].substr(2, 1) != "0" && !enableAll) {
cheatList[j].replace(2, 1, "0");
if (cheatList[j][0] == '_' && cheatList[j][1] == 'C') {
if (cheatList[j][2] == '0' && enableAll) {
cheatList[j][2] = '1';
} else if (cheatList[j][2] != '0' && !enableAll) {
cheatList[j][2] = '0';
}
}
}
@@ -181,6 +181,8 @@ UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams &params) {
void CwCheatScreen::ParseCheatDB(std::string line, std::vector<std::string> title, std::vector<std::string> newList, std::string cheatFile) {
bool finished = false, skip = false;
std::string gameID = StringFromFormat("_S %s-%s", gameTitle.substr(0, 4).c_str(), gameTitle.substr(4).c_str());
std::fstream fs;
File::OpenCPPFile(fs, cheatFile, std::ios::in);
@@ -190,7 +192,7 @@ void CwCheatScreen::ParseCheatDB(std::string line, std::vector<std::string> titl
while (fs.good()) {
getline(fs, line); // get line from file
if (line == "_S " + gameTitle.substr(0, 4) + "-" + gameTitle.substr(4)) {
if (line == gameID) {
title.push_back(line);
getline(fs, line);
title.push_back(line);
@@ -198,7 +200,7 @@ void CwCheatScreen::ParseCheatDB(std::string line, std::vector<std::string> titl
if (finished == false) {
getline(fs, line);
}
if (line.substr(0, 2) == "_C") {
if (line[0] == '_' && line[1] == 'C') {
//Test if cheat already exists in cheatList
for (size_t j = 0; j < formattedList_.size(); j++) {
if (line.substr(4) == formattedList_[j]) {
@@ -212,14 +214,14 @@ void CwCheatScreen::ParseCheatDB(std::string line, std::vector<std::string> titl
do {
newList.push_back(line);
getline(fs, line);
} while (line.substr(0, 2) == "_L");
} while (line[0] == '_' && line[1] == 'L');
finished = true;
}
else {
continue;
}
loop:;
} while (line.substr(0, 2) != "_S");
} while (fs.good() && line[0] != '_' && line[1] != 'S');
finished = true;
}
if (finished == true)
@@ -234,7 +236,7 @@ void CwCheatScreen::ParseCheatDB(std::string line, std::vector<std::string> titl
File::OpenCPPFile(fs, activeCheatFile, std::ios::out | std::ios::app);
auto it = title.begin();
if (title2.substr(0, 2) != "_S" && it != title.end() && (++it) != title.end()) {
if (title2[0] != '_' && title2[1] != 'S' && it != title.end() && (++it) != title.end()) {
fs << title[0] << "\n" << title[1];
}