-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ver 6 scout and overwrite alert.
- Loading branch information
Showing
1 changed file
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,19 @@ int splatsave(int argc, char const* argv[]) { | |
save_write_size = svFactory.getEncodedSaveFileSize(); | ||
} | ||
|
||
std::ifstream fileExistCheck(save_output_path); | ||
if (fileExistCheck.good()) { | ||
std::cout << "Overwrite existing " << save_output_path | ||
<< "? (y or n) "; | ||
std::string userInput; | ||
getline(std::cin, userInput); | ||
char firstLetter = userInput.at(0); | ||
if(firstLetter != 'y' and firstLetter != 'Y') { | ||
std::cout << "Aborted." << std::endl; | ||
return 0; | ||
} | ||
} | ||
|
||
std::ofstream fileos(save_output_path, std::fstream::binary); | ||
if (!fileos) { | ||
std::cout << "Could not open " << save_output_path << std::endl; | ||
|
@@ -46,8 +59,16 @@ int splatsave(int argc, char const* argv[]) { | |
<< "!" << std::endl; | ||
} | ||
} catch (SaveDataFactory::SaveSizeUnknown& e) { | ||
std::cout << "Save size incorrect: 0x" << std::hex << e.m_size | ||
if (e.m_version == 6) { | ||
std::cout << "Save version 6 was never seen before. If your save " | ||
"was previously unmodified, please submit an issue " | ||
"on the project's GitHub page or send me an email at " | ||
"[email protected]! Thank you." | ||
<< std::hex << e.m_size << std::endl; | ||
} else { | ||
std::cout << "Save size incorrect: 0x" << std::hex << e.m_size | ||
<< std::endl; | ||
} | ||
return -4; | ||
} catch (SaveDataFactory::UnsupportedSaveVersion& e) { | ||
std::cout << "Save version unsupported: " << e.m_version << std::endl; | ||
|