Explorar o código

Merge remote-tracking branch 'origin/master'

stan hai 5 días
pai
achega
dc1e527e40
Modificáronse 3 ficheiros con 12 adicións e 11 borrados
  1. 1 0
      .gitignore
  2. 4 4
      README.md
  3. 7 7
      Sunrise/src/state/build_data/cache/read/cache_file_reader.cpp

+ 1 - 0
.gitignore

@@ -14,3 +14,4 @@
 
 # CMake build files
 /build/
+/out/

+ 4 - 4
README.md

@@ -19,7 +19,7 @@ Destiny 2 Offline Exploration Mod
 
 ## WIP
 
-This mod is work in progress. Things might break or work in unexpected ways. There is also currently
+This mod is a work in progress. Things might break or work in unexpected ways. There is also currently
 a lack of documentation. This will improve over the coming weeks.
 
 ## Support Me
@@ -89,14 +89,14 @@ Pull Requests are welcome. Please follow these rules:
 
 - **No Copyrighted Data** - All game data should be extracted at runtime.
 - **Code Formatting** - Stick to the provided clang-format and clang-tidy configs.
-- **Clean Code** - Try to post readable high quality code, follow the projects existing style of
+- **Clean Code** - Try to post readable high-quality code, follow the project's existing style of
   comment and add docs.
 - **Provide Documentation** - Please explain what you changed, why you changed it and the effects it
   has in detail, it saves me a lot of work.
 - **Follow Up** - If something with the PR is not right, I will reply and ask you to fix it.
 - **One Feature** - Do not put multiple features into one PR.
-- **Complete Implementations** - Do not PR features that are not completed and/or have non functional parts.
-- **Server Focus** - For features that are intended to be part of the server, don't abuse client patches. Sometimes its needed but mostly everything should go through the right requests and pushes.
+- **Complete Implementations** - Do not PR features that are not completed and/or have non-functional parts.
+- **Server Focus** - For features that are intended to be part of the server, don't abuse client patches. Sometimes it's needed but mostly everything should go through the right requests and pushes.
 
 ## Credits
 

+ 7 - 7
Sunrise/src/state/build_data/cache/read/cache_file_reader.cpp

@@ -75,13 +75,16 @@ namespace {
 }
 
 /**
- * Every format below the current one is out of date, so a version bump needs no edit here.
- * Listing them one by one left a bumped version unknown, and a valid old cache read as corrupt.
+ * A cache written by any other format is out of date, so a version bump needs no edit here.
+ * Listing them one by one left a bumped version unknown, and a valid cache read as corrupt.
+ * A newer file is another build's cache rather than a damaged one, so it rebuilds the same way.
+ * Reading it as corrupt instead failed the whole boot until the file was deleted by hand, which
+ * is what downgrading the module did.
  * @param version Cache prefix version.
- * @return True when the cache is older than the current format.
+ * @return True when the cache was not written by the current format.
  */
 [[nodiscard]] bool stale_format(std::uint32_t version) noexcept {
-    return version < records::kCacheFormatVersion;
+    return version != records::kCacheFormatVersion;
 }
 
 /** @return The pending status, or invalid when the file fails to close. */
@@ -150,9 +153,6 @@ LoadStatus load(const wchar_t* path,
     if (stale_format(prefix.version)) {
         return close_with(file, LoadStatus::stale);
     }
-    if (prefix.version != records::kCacheFormatVersion) {
-        return close_with(file, LoadStatus::invalid);
-    }
 
     LARGE_INTEGER beginning{};
     records::Header header{};