gta-reversed/gta-reversed-modern

Invalid return value of C_PcSave::DeleteSlot()

Closed this issue · 0 comments

Expected and current behavior

source/game_sa/C_PcSave.cpp:96

bool C_PcSave::DeleteSlot(int32 slot) {
    assert(slot < MAX_SAVEGAME_SLOTS);

    char path[MAX_PATH]{};
    s_PcSaveHelper.error = eErrorCode::NONE;
    GenerateGameFilename(slot, path);
#ifdef DEFAULT_FUNCTIONS
    DeleteFile(path);
    if (auto f = CFileMgr::OpenFile(path, "rb")) {
        CFileMgr::CloseFile(f);
        return true;
    }
    return false;
#else
    return std::filesystem::remove(path);
#endif
}

Original function returns true if file was NOT deleted.
std::filesystem::remove return true if file was deleted

Additional information

No response

Steps to reproduce

Screenshots/Videos

No response