Buildfix, and more renaming while we're at it.

This commit is contained in:
Henrik Rydgård 2021-04-25 22:24:47 +02:00
parent d8583cd0d6
commit a2a0551a83
10 changed files with 24 additions and 24 deletions

View file

@ -119,7 +119,7 @@ static std::vector<int> ParseCPUList(const std::string &filename) {
std::string data;
std::vector<int> results;
if (readFileToString(true, filename.c_str(), data)) {
if (File::ReadFileToString(true, filename.c_str(), data)) {
std::vector<std::string> ranges;
SplitString(data, ',', ranges);
for (auto range : ranges) {

View file

@ -887,7 +887,7 @@ bool IOFile::Resize(uint64_t size)
return m_good;
}
bool readFileToString(bool text_file, const char *filename, std::string & str)
bool ReadFileToString(bool text_file, const char *filename, std::string & str)
{
FILE *f = File::OpenCFile(filename, text_file ? "r" : "rb");
if (!f)
@ -928,7 +928,7 @@ uint8_t *ReadLocalFile(const char *filename, size_t * size) {
return contents;
}
bool writeStringToFile(bool text_file, const std::string &str, const char *filename)
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)
{
FILE *f = File::OpenCFile(filename, text_file ? "w" : "wb");
if (!f)
@ -943,7 +943,7 @@ bool writeStringToFile(bool text_file, const std::string &str, const char *filen
return true;
}
bool writeDataToFile(bool text_file, const void* data, const unsigned int size, const char *filename)
bool WriteDataToFile(bool text_file, const void* data, const unsigned int size, const char *filename)
{
FILE *f = File::OpenCFile(filename, text_file ? "w" : "wb");
if (!f)

View file

@ -179,10 +179,10 @@ private:
// TODO: Refactor, this was moved from the old file_util.cpp.
// Whole-file reading/writing
bool writeStringToFile(bool text_file, const std::string &str, const char *filename);
bool writeDataToFile(bool text_file, const void* data, const unsigned int size, const char *filename);
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename);
bool WriteDataToFile(bool text_file, const void* data, const unsigned int size, const char *filename);
bool readFileToString(bool text_file, const char *filename, std::string &str);
bool ReadFileToString(bool text_file, const char *filename, std::string &str);
// Return value must be delete[]-d.
uint8_t *ReadLocalFile(const char *filename, size_t *size);

View file

@ -450,7 +450,7 @@ namespace Reporting
void AddScreenshotData(MultipartFormDataEncoder &postdata, std::string filename)
{
std::string data;
if (!filename.empty() && File::readFileToString(false, filename.c_str(), data))
if (!filename.empty() && File::ReadFileToString(false, filename.c_str(), data))
postdata.Add("screenshot", data, "screenshot.jpg", "image/jpeg");
const std::string iconFilename = "disc0:/PSP_GAME/ICON0.PNG";

View file

@ -63,7 +63,7 @@ void CwCheatScreen::LoadCheatInfo() {
// We won't parse this, just using it to detect changes to the file.
std::string str;
if (File::readFileToString(true, engine_->CheatFilename().c_str(), str)) {
if (File::ReadFileToString(true, engine_->CheatFilename().c_str(), str)) {
fileCheckHash_ = XXH3_64bits(str.c_str(), str.size());
}
fileCheckCounter_ = 0;
@ -120,7 +120,7 @@ void CwCheatScreen::update() {
if (fileCheckCounter_++ >= FILE_CHECK_FRAME_INTERVAL && engine_) {
// Check if the file has changed. If it has, we'll reload.
std::string str;
if (File::readFileToString(true, engine_->CheatFilename().c_str(), str)) {
if (File::ReadFileToString(true, engine_->CheatFilename().c_str(), str)) {
uint64_t newHash = XXH3_64bits(str.c_str(), str.size());
if (newHash != fileCheckHash_) {
// This will update the hash.

View file

@ -402,9 +402,9 @@ public:
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
// Try using png/jpg screenshots first
if (File::Exists(screenshot_png))
File::readFileToString(false, screenshot_png.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_png.c_str(), info_->icon.data);
else if (File::Exists(screenshot_jpg))
File::readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
else
// Read standard icon
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);
@ -449,9 +449,9 @@ handleELF:
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
// Try using png/jpg screenshots first
if (File::Exists(screenshot_png)) {
File::readFileToString(false, screenshot_png.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_png.c_str(), info_->icon.data);
} else if (File::Exists(screenshot_jpg)) {
File::readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
} else {
// Read standard icon
VERBOSE_LOG(LOADER, "Loading unknown.png because there was an ELF");
@ -492,7 +492,7 @@ handleELF:
// Let's use the screenshot as an icon, too.
std::string screenshotPath = ReplaceAll(gamePath_, ".ppst", ".jpg");
if (File::Exists(screenshotPath)) {
if (File::readFileToString(false, screenshotPath.c_str(), info_->icon.data)) {
if (File::ReadFileToString(false, screenshotPath.c_str(), info_->icon.data)) {
info_->icon.dataLoaded = true;
} else {
ERROR_LOG(G3D, "Error loading screenshot data: '%s'", screenshotPath.c_str());
@ -577,9 +577,9 @@ handleELF:
std::string screenshot_png = GetSysDirectory(DIRECTORY_SCREENSHOT) + info_->id + "_00000.png";
// Try using png/jpg screenshots first
if (File::Exists(screenshot_png))
File::readFileToString(false, screenshot_png.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_png.c_str(), info_->icon.data);
else if (File::Exists(screenshot_jpg))
File::readFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
File::ReadFileToString(false, screenshot_jpg.c_str(), info_->icon.data);
else {
DEBUG_LOG(LOADER, "Loading unknown.png because no icon was found");
ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock);

View file

@ -421,7 +421,7 @@ void SetBackgroundPopupScreen::update() {
if (pic) {
const std::string bgPng = GetSysDirectory(DIRECTORY_SYSTEM) + "background.png";
File::writeStringToFile(false, pic->data, bgPng.c_str());
File::WriteStringToFile(false, pic->data, bgPng.c_str());
}
NativeMessageReceived("bgImage_updated", "");

View file

@ -1304,13 +1304,13 @@ void GameSettingsScreen::CallbackMemstickFolder(bool yes) {
if (!File::Exists(pendingMemstickFolder_)) {
File::CreateFullPath(pendingMemstickFolder_);
}
if (!File::writeDataToFile(true, "1", 1, testWriteFile.c_str())) {
if (!File::WriteDataToFile(true, "1", 1, testWriteFile.c_str())) {
settingInfo_->Show(sy->T("ChangingMemstickPathInvalid", "That path couldn't be used to save Memory Stick files."), nullptr);
return;
}
File::Delete(testWriteFile);
File::writeDataToFile(true, pendingMemstickFolder_.c_str(), pendingMemstickFolder_.size(), memstickDirFile.c_str());
File::WriteDataToFile(true, pendingMemstickFolder_.c_str(), pendingMemstickFolder_.size(), memstickDirFile.c_str());
// Save so the settings, at least, are transferred.
g_Config.memStickDirectory = pendingMemstickFolder_ + "/";
g_Config.Save("MemstickPathChanged");

View file

@ -386,7 +386,7 @@ static void CheckFailedGPUBackends() {
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
std::string data;
if (File::readFileToString(true, cache.c_str(), data))
if (File::ReadFileToString(true, cache.c_str(), data))
g_Config.sFailedGPUBackends = data;
}
@ -414,7 +414,7 @@ static void CheckFailedGPUBackends() {
// Let's try to create, in case it doesn't exist.
if (!File::Exists(GetSysDirectory(DIRECTORY_APP_CACHE)))
File::CreateDir(GetSysDirectory(DIRECTORY_APP_CACHE));
File::writeStringToFile(true, g_Config.sFailedGPUBackends, cache.c_str());
File::WriteStringToFile(true, g_Config.sFailedGPUBackends, cache.c_str());
} else {
// Just save immediately, since we have storage.
g_Config.Save("got storage permission");
@ -502,7 +502,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
std::string memstickDirFile = g_Config.internalDataDirectory + "/memstick_dir.txt";
if (File::Exists(memstickDirFile)) {
std::string memstickDir;
File::readFileToString(true, memstickDirFile.c_str(), memstickDir);
File::ReadFileToString(true, memstickDirFile.c_str(), memstickDir);
if (!memstickDir.empty() && File::Exists(memstickDir)) {
g_Config.memStickDirectory = memstickDir + "/";
}

View file

@ -297,7 +297,7 @@ bool CompareOutput(const std::string &bootFilename, const std::string &output, b
printf("%s", output.c_str());
printf("============== expected output:\n");
std::string fullExpected;
if (File::readFileToString(true, expect_filename.c_str(), fullExpected))
if (File::ReadFileToString(true, expect_filename.c_str(), fullExpected))
printf("%s", fullExpected.c_str());
printf("===============================\n");
}