mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Windows carriage return characters are now filtered out when reading custom collection files and inject files
This commit is contained in:
parent
4cd4a8e6c0
commit
933177dad1
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// CollectionSystemsManager.cpp
|
// CollectionSystemsManager.cpp
|
||||||
//
|
//
|
||||||
// Manages collections of the following two types:
|
// Manages collections of the following two types:
|
||||||
|
@ -160,6 +160,8 @@ void CollectionSystemsManager::saveCustomCollection(SystemData* sys)
|
||||||
configFileIn.open(getCustomCollectionConfigPath(name));
|
configFileIn.open(getCustomCollectionConfigPath(name));
|
||||||
#endif
|
#endif
|
||||||
for (std::string gameEntry; getline(configFileIn, gameEntry);) {
|
for (std::string gameEntry; getline(configFileIn, gameEntry);) {
|
||||||
|
// Remove Windows carriage return characters.
|
||||||
|
gameEntry = Utils::String::replace(gameEntry, "\r", "");
|
||||||
std::string gamePath {Utils::String::replace(gameEntry, "%ROMPATH%", rompath)};
|
std::string gamePath {Utils::String::replace(gameEntry, "%ROMPATH%", rompath)};
|
||||||
gamePath = Utils::String::replace(gamePath, "//", "/");
|
gamePath = Utils::String::replace(gamePath, "//", "/");
|
||||||
// Only add the entry if it doesn't exist, i.e. only add missing files.
|
// Only add the entry if it doesn't exist, i.e. only add missing files.
|
||||||
|
@ -1064,6 +1066,8 @@ void CollectionSystemsManager::reactivateCustomCollectionEntry(FileData* game)
|
||||||
std::ifstream input {path};
|
std::ifstream input {path};
|
||||||
#endif
|
#endif
|
||||||
for (std::string gameKey; getline(input, gameKey);) {
|
for (std::string gameKey; getline(input, gameKey);) {
|
||||||
|
// Remove Windows carriage return characters.
|
||||||
|
gameKey = Utils::String::replace(gameKey, "\r", "");
|
||||||
if (gameKey == gamePath) {
|
if (gameKey == gamePath) {
|
||||||
setEditMode(it->first, false);
|
setEditMode(it->first, false);
|
||||||
toggleGameInCollection(game);
|
toggleGameInCollection(game);
|
||||||
|
@ -1331,7 +1335,8 @@ void CollectionSystemsManager::populateCustomCollection(CollectionSystemData* sy
|
||||||
// it's possible to use either absolute ROM paths in the collection files or using
|
// it's possible to use either absolute ROM paths in the collection files or using
|
||||||
// the path variable. The absolute ROM paths are only used for backward compatibility
|
// the path variable. The absolute ROM paths are only used for backward compatibility
|
||||||
// with old custom collections. All custom collections saved by ES-DE will use the
|
// with old custom collections. All custom collections saved by ES-DE will use the
|
||||||
// %ROMPATH% variable instead.
|
// %ROMPATH% variable instead. Also remove Windows carriage return characters.
|
||||||
|
gameKey = Utils::String::replace(gameKey, "\r", "");
|
||||||
gameKey = Utils::String::replace(gameKey, "%ROMPATH%", rompath);
|
gameKey = Utils::String::replace(gameKey, "%ROMPATH%", rompath);
|
||||||
gameKey = Utils::String::replace(gameKey, "//", "/");
|
gameKey = Utils::String::replace(gameKey, "//", "/");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// CollectionSystemsManager.h
|
// CollectionSystemsManager.h
|
||||||
//
|
//
|
||||||
// Manages collections of the following two types:
|
// Manages collections of the following two types:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// FileData.cpp
|
// FileData.cpp
|
||||||
//
|
//
|
||||||
// Provides game file data structures and functions to access and sort this information.
|
// Provides game file data structures and functions to access and sort this information.
|
||||||
|
@ -1107,6 +1107,8 @@ void FileData::launchGame()
|
||||||
|
|
||||||
injectFileStream.open(romRaw);
|
injectFileStream.open(romRaw);
|
||||||
for (std::string line; getline(injectFileStream, line);) {
|
for (std::string line; getline(injectFileStream, line);) {
|
||||||
|
// Remove Windows carriage return characters.
|
||||||
|
line = Utils::String::replace(line, "\r", "");
|
||||||
appString += line;
|
appString += line;
|
||||||
if (appString.size() > 4096)
|
if (appString.size() > 4096)
|
||||||
break;
|
break;
|
||||||
|
@ -1592,6 +1594,8 @@ void FileData::launchGame()
|
||||||
std::ifstream injectFileStream;
|
std::ifstream injectFileStream;
|
||||||
injectFileStream.open(injectFile);
|
injectFileStream.open(injectFile);
|
||||||
for (std::string line; getline(injectFileStream, line);) {
|
for (std::string line; getline(injectFileStream, line);) {
|
||||||
|
// Remove Windows carriage return characters.
|
||||||
|
line = Utils::String::replace(line, "\r", "");
|
||||||
arguments += line;
|
arguments += line;
|
||||||
if (arguments.size() > 4096)
|
if (arguments.size() > 4096)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// FileData.h
|
// FileData.h
|
||||||
//
|
//
|
||||||
// Provides game file data structures and functions to access and sort this information.
|
// Provides game file data structures and functions to access and sort this information.
|
||||||
|
|
Loading…
Reference in a new issue