Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): keep the fork's data on top of every mod

Olcay Seygane037f865b600
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5e37b7c4..6ae15bf1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,8 +22,9 @@ found and fixed — EA's own, not port damage.**
## Mods
-- A mod is a folder now. Start the game with `-mod` and the folder, and the archives in it win over the game's own, as before, and so do the plain files under its `Data` and `Art` folders, which the game used to ignore. A modder can drop in one changed file without packing an archive first.
+- A mod is a folder now. Start the game with `-mod` and the folder, and the archives in it replace Zero Hour's files, as before, and so do the plain files under its `Data` and `Art` folders, which the game used to ignore. A modder can drop in one changed file without packing an archive first.
- Several mods run at once. Give `-mod` once for each, and where two of them change the same file, the one named later wins.
+- Reforged stays on top of every mod. This build's balance, its fixes to EA's data, its AI and its menus load after the mod and win where they touch the same unit, weapon or button, so a mod plays with Reforged's rules. A change that names something the mod renamed or removed is passed over instead of stopping the game, which is how ShockWave starts and plays. A mod's own copy of a file Reforged ships, its skirmish AI scripts or the skirmish setup screen among them, is ignored, and so are any upscaled art archives it carries.
- A `mod.json` in the folder names the mod and its version. The names stand beside the version number in the options menu, in the order the mods were given, and go into every replay you record, so a replay made with mods says which ones, and the replay list marks it as another version when the game is running without them.
- Joining a LAN game that runs different mods used to end in a box about a mismatch and nothing else. It names the host's mods now, or tells you the host plays without any.
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index db5a761e2..a1eb67af9 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -2262,6 +2262,8 @@ endif()
# below, so ctest -j runs them beside each other and beside the rest. Only they are split out: the rest
# stays one process, in one order, so a failure that depends on what ran before still shows.
add_lib_test(test_gameengine gameengine ARGS --exclude=every_start_reaches_its_money_and_has_two_ways_out_)
+# every_shipped_master_is_fork_owned_and_retail_files_are_not walks Code/Data
+target_compile_definitions(test_gameengine PRIVATE ZH_CODE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
foreach(_zh_players 2 4 8)
add_test(NAME test_gameengine_money_sweep_${_zh_players}_players
COMMAND test_gameengine every_start_reaches_its_money_and_has_two_ways_out_${_zh_players}_players)
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h b/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
index f48654f0c..536902fba 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
@@ -140,9 +140,14 @@ public:
/// "<mod dir><filename>" when the last -mod that has this game path has it loose, else empty. When
/// that mod has it in an archive instead, *inModArchive says so. Either copy beats Run's loose files
- /// and every archive that is not a mod's.
+ /// and every archive that is not a mod's - except a fork-owned file the install folder holds loose,
+ /// which no mod replaces.
AsciiString modLooseFile(const AsciiString& filename, Bool *inModArchive = NULL) const;
+ /// TRUE for a game path the fork ships loose (BalanceReforged.ini, Patch.str, SkirmishScripts.scb,
+ /// its .wnd layouts ...); see the definition for how the set is decided.
+ static Bool isForkOwnedPath(const AsciiString& filename);
+
Bool createDirectory(AsciiString directory); ///< create a directory of the given name.
/// language when Data\<language>\Language.ini is loose or in an archive, otherwise the first
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
index b914b636d..5ec448ef3 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
@@ -360,9 +360,10 @@ public:
/**
utility routine that does a sscanf() on the string to get the Science, and throws
- an exception if not of the right form.
+ an exception if not of the right form. Under a multifile load an unknown name
+ returns SCIENCE_INVALID instead, and the caller skips the reference.
*/
- static ScienceType scanScience(const char* token);
+ static ScienceType scanScience(INI* ini, const char* token);
/**
utility routine that does a sscanf() on the string to get the int, and throws
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
index 18976e8e1..de2e8374e 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
@@ -725,7 +725,9 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto
asv->clear();
return;
}
- asv->push_back(INI::scanScience( token ));
+ ScienceType science = INI::scanScience( ini, token );
+ if (science != SCIENCE_INVALID)
+ asv->push_back(science);
}
}
@@ -1404,7 +1406,10 @@ void INI::parseSpecialPowerTemplate( INI* ini, void * /*instance*/, void *store,
throw ERROR_BUG;
}
- *((ScienceType *)store) = INI::scanScience(token);
+ // a skipped reference leaves the field as the loaded data had it
+ ScienceType science = INI::scanScience(ini, token);
+ if (science != SCIENCE_INVALID)
+ *((ScienceType *)store) = science;
}
@@ -1600,8 +1605,14 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
}
//-------------------------------------------------------------------------------------------------
-/*static*/ ScienceType INI::scanScience(const char* token)
+/*static*/ ScienceType INI::scanScience(INI* ini, const char* token)
{
+ // a patch INI loaded over a mod can name a science the mod renamed or removed
+ if (ini->getLoadType() == INI_LOAD_MULTIFILE && !TheScienceStore->isValidScience((ScienceType)NAMEKEY(token)))
+ {
+ DEBUG_LOG(("[LINE: %d in '%s'] science '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), token));
+ return SCIENCE_INVALID;
+ }
return TheScienceStore->friend_lookupScience( token );
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
index f7deab403..1d3e129bb 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
@@ -90,6 +90,16 @@ void INI::parseControlBarSchemeDefinition( INI *ini )
// A multifile load edits the scheme already there; anything else gets a cleared out scheme, a
// previously allocated one included, to overwrite
CBScheme = ini->getLoadType() == INI_LOAD_MULTIFILE ? CBSchemeManager->findControlBarScheme( name ) : NULL;
+ if( CBScheme == NULL && ini->getLoadType() == INI_LOAD_MULTIFILE )
+ {
+ // A mod that renamed or dropped the scheme leaves the edit nothing to apply to, and a new scheme
+ // holding only the edited fields has no ScreenCreationRes. The block goes into a scheme that
+ // is thrown away, so the parse reaches its End.
+ DEBUG_LOG(( "[LINE: %d in '%s'] %s patches a control bar scheme that does not exist; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), name.str() ));
+ ControlBarScheme scratch;
+ ini->initFromINI( &scratch, CBSchemeManager->getFieldParse() );
+ return;
+ }
if( CBScheme == NULL )
CBScheme = CBSchemeManager->newControlBarScheme( name );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
index 9cc11a4f8..927168e12 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
@@ -223,11 +223,19 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const
{
if (info != NULL)
{
- DEBUG_CRASH(("duplicate science %s!\n",c));
- throw INI_INVALID_DATA;
+ // ScienceReforged.ini edits the loaded science in place, and its fields win
+ if (ini->getLoadType() != INI_LOAD_MULTIFILE)
+ {
+ DEBUG_CRASH(("duplicate science %s!\n",c));
+ throw INI_INVALID_DATA;
+ }
+ info->m_rootSciences.clear();
+ }
+ else
+ {
+ info = newInstance(ScienceInfo);
+ TheScienceStore->m_sciences.push_back(info);
}
- info = newInstance(ScienceInfo);
- TheScienceStore->m_sciences.push_back(info);
}
ini->initFromINI(info, myFieldParse);
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
index ea33718de..ecc2101b5 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
@@ -50,8 +50,12 @@
#include "Common/ArchiveFile.h"
#include "Common/ArchiveFileSystem.h"
#include "Common/AsciiString.h"
+#include "Common/GlobalData.h"
+#include "Common/LocalFileSystem.h"
#include "Common/PerfTimer.h"
+#include <vector>
+
#ifdef _INTERNAL
// for occasional debugging...
//#pragma optimize("", off)
@@ -172,35 +176,66 @@ void ArchiveFileSystem::loadIntoDirectoryTree(const ArchiveFile *archiveFile, co
}
}
+/// the fork's upscaled art goes by its file name, ReforgedTextures.big and the like
+static Bool isReforgedArchiveName(const AsciiString &path)
+{
+ const char *slash = strrchr(path.str(), '\\');
+ const char *forward = strrchr(path.str(), '/');
+ const char *name = path.str();
+ if (slash != NULL && slash + 1 > name)
+ name = slash + 1;
+ if (forward != NULL && forward + 1 > name)
+ name = forward + 1;
+ return strncasecmp(name, "Reforged", 8) == 0;
+}
+
void ArchiveFileSystem::loadMods() {
+ if (TheGlobalData->m_mods.empty())
+ return;
+
+ // retail < mods < the fork: the fork's Reforged*.big already in the tree go back on top afterwards
+ std::vector<AsciiString> forkArt;
+ for (ArchiveFileMap::const_iterator it = m_archiveFileMap.begin(); it != m_archiveFileMap.end(); ++it)
+ {
+ if (isReforgedArchiveName(it->first))
+ forkArt.push_back(it->first);
+ }
+
// In command-line order, each with overwrite: a later -mod wins over an earlier one, and all of them
- // over the retail and Reforged archives already in the tree.
+ // over the retail archives. A folder's archives go in the order Win32BIGFileSystem's own pass uses.
for (size_t i = 0; i < TheGlobalData->m_mods.size(); ++i)
{
const AsciiString &mod = TheGlobalData->m_mods[i];
+ FilenameList archives;
if (mod.endsWith("\\") || mod.endsWith("/"))
- {
-#ifdef DEBUG_LOGGING
- Bool ret =
-#endif
- loadBigFilesFromDirectory(mod, "*.big", TRUE);
- DEBUG_ASSERTLOG(ret, ("loadBigFilesFromDirectory(%s) returned FALSE!\n", mod.str()));
- continue;
- }
-
- ArchiveFile *archiveFile = openArchiveFile(mod.str());
-
- if (archiveFile != NULL) {
- DEBUG_LOG(("ArchiveFileSystem::loadMods - loading %s into the directory tree.\n", mod.str()));
- loadIntoDirectoryTree(archiveFile, mod, TRUE);
- m_archiveFileMap[mod] = archiveFile;
- DEBUG_LOG(("ArchiveFileSystem::loadMods - %s inserted into the archive file map.\n", mod.str()));
- }
+ TheLocalFileSystem->getFileListInDirectory(mod, AsciiString(""), AsciiString("*.big"), archives, TRUE);
else
+ archives.insert(mod);
+
+ for (FilenameListIter it = archives.begin(); it != archives.end(); ++it)
{
- DEBUG_LOG(("ArchiveFileSystem::loadMods - could not openArchiveFile(%s)\n", mod.str()));
+ if (isReforgedArchiveName(*it))
+ {
+ DEBUG_LOG(("ArchiveFileSystem::loadMods - %s is ignored, the fork's own Reforged archives win\n", it->str()));
+ continue;
+ }
+ ArchiveFile *archiveFile = openArchiveFile(it->str());
+ if (archiveFile == NULL)
+ {
+ DEBUG_LOG(("ArchiveFileSystem::loadMods - could not openArchiveFile(%s)\n", it->str()));
+ continue;
+ }
+ DEBUG_LOG(("ArchiveFileSystem::loadMods - loading %s into the directory tree.\n", it->str()));
+ loadIntoDirectoryTree(archiveFile, *it, TRUE);
+ m_archiveFileMap[*it] = archiveFile;
}
}
+
+ for (size_t i = 0; i < forkArt.size(); ++i)
+ {
+ DEBUG_LOG(("ArchiveFileSystem::loadMods - %s back over the mods\n", forkArt[i].str()));
+ loadIntoDirectoryTree(m_archiveFileMap[forkArt[i]], forkArt[i], TRUE);
+ }
}
Bool ArchiveFileSystem::doesFileExist(const Char *filename) const
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
index 3b393b2a5..07cff673d 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
@@ -60,6 +60,9 @@
#include "Common/RAMFile.h"
#include "Common/RandomMapGenerator.h"
+#include <set>
+#include <string>
+
DECLARE_PERF_TIMER(FileSystem)
@@ -339,7 +342,9 @@ AsciiString FileSystem::modLooseFile(const AsciiString& filename, Bool *inModArc
// .big beats an earlier mod's loose copy. An archive key is the -mod path itself, or that folder
// followed by the archive's name (loadMods).
const AsciiString archive = TheArchiveFileSystem->getArchiveFilenameForFile(filename);
- for (size_t i = TheGlobalData->m_mods.size(); i-- > 0; )
+ AsciiString loose;
+ Bool archived = FALSE;
+ for (size_t i = TheGlobalData->m_mods.size(); i-- > 0 && loose.isEmpty() && !archived; )
{
const AsciiString &mod = TheGlobalData->m_mods[i];
const Bool isFolder = mod.endsWith("\\") || mod.endsWith("/");
@@ -349,19 +354,64 @@ AsciiString FileSystem::modLooseFile(const AsciiString& filename, Bool *inModArc
path.concat(filename);
if (TheLocalFileSystem->doesFileExist(path.str()))
{
- return path;
+ loose = path;
+ break;
}
}
- if (archive.isNotEmpty() && (isFolder ? archive.startsWithNoCase(mod.str()) : archive.compareNoCase(mod) == 0))
+ archived = archive.isNotEmpty() && (isFolder ? archive.startsWithNoCase(mod.str()) : archive.compareNoCase(mod) == 0);
+ }
+
+ // ...except over a file the fork ships: retail < mods < the fork. That copy is the one the install
+ // folder holds loose, and the plain lookup after this finds it.
+ if ((loose.isNotEmpty() || archived) && isForkOwnedPath(filename) && TheLocalFileSystem->doesFileExist(filename.str()))
+ {
+ static std::set<std::string> reported;
+ if (reported.insert(std::string(filename.str())).second)
{
- if (inModArchive != NULL)
- {
- *inModArchive = TRUE;
- }
- return AsciiString();
+ DEBUG_LOG(("FileSystem - the mod's %s is ignored, the fork's own copy wins (%s)\n",
+ filename.str(), loose.isNotEmpty() ? loose.str() : archive.str()));
}
+ return AsciiString();
+ }
+
+ if (inModArchive != NULL)
+ {
+ *inModArchive = archived;
}
- return AsciiString();
+ return loose;
+}
+
+//============================================================================
+// FileSystem::isForkOwnedPath
+//============================================================================
+Bool FileSystem::isForkOwnedPath(const AsciiString& filename)
+{
+ // What the fork installs loose next to the exe: the launcher's payload, which is the post-build copy
+ // of Code/Data (less Scenarios, Cinema and the shader cache) plus the classic bar textures.
+ // Tests/test_gameengine.cpp walks Code/Data and fails when a master falls outside this. Retail's own
+ // loose files (Data\Scripts\MultiplayerScripts.scb, the movies, the cursors) are not in it, so a mod
+ // still replaces those. The fork's Reforged*.big are kept on top in ArchiveFileSystem::loadMods.
+ AsciiString path = filename;
+ path.toLower();
+ std::string p(path.str());
+ for (size_t i = 0; i < p.size(); ++i)
+ {
+ if (p[i] == '/')
+ p[i] = '\\';
+ }
+ const auto starts = [&p](const char *prefix) { return p.compare(0, strlen(prefix), prefix) == 0; };
+ const auto ends = [&p](const char *suffix) { size_t n = strlen(suffix); return p.size() >= n && p.compare(p.size() - n, n, suffix) == 0; };
+
+ if (starts("data\\ini\\") && p.find('\\', strlen("data\\ini\\")) == std::string::npos && ends("reforged.ini"))
+ return TRUE;
+ if (starts("data\\ini\\mappedimages\\handcreated\\reforged") && ends(".ini"))
+ return TRUE;
+ return p == "data\\patch.str"
+ || p == "data\\scripts\\skirmishscripts.scb"
+ || starts("data\\turkish\\") || starts("data\\german\\")
+ || starts("art\\textures\\reforged") || starts("art\\textures\\classicwidebar")
+ || starts("window\\")
+ || p == "install_final.bmp";
}
//============================================================================
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
index 17f8b40ab..d826238e1 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
@@ -390,6 +390,21 @@ AsciiString TheThingTemplateBeingParsedName;
TheThingTemplateBeingParsedName = name;
#endif
+ /* An ObjectReskin of an object that is not there - FixesReforged.ini's SupW_SDILasers under a mod that
+ has no SDILasers - is skipped the same way as a patch of a missing object below, before a template
+ is made for it, instead of stopping the game at start. */
+ if( reskinFrom.isNotEmpty() )
+ {
+ if( TheThingFactory->findTemplateInternal( reskinFrom, FALSE ) == NULL )
+ {
+ DEBUG_LOG(( "[LINE: %d in '%s'] %s reskins %s, an object that does not exist; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), name.str(), reskinFrom.str() ));
+ ThingTemplate *scratch = newInstance(ThingTemplate);
+ ini->initFromINI( scratch, scratch->getReskinFieldParse() );
+ scratch->deleteInstance();
+ return;
+ }
+ }
+
// find existing item if present
ThingTemplate *thingTemplate = TheThingFactory->findTemplateInternal( name, FALSE );
if( !thingTemplate && ini->getLoadType() == INI_LOAD_MULTIFILE && reskinFrom.isEmpty() )
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
index a877a532a..4d6346268 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
@@ -669,8 +669,12 @@ static void parsePrerequisiteScience( INI* ini, void *instance, void * /*store*/
{
std::vector<ProductionPrerequisite>* v = (std::vector<ProductionPrerequisite>*)instance;
+ ScienceType science = INI::scanScience(ini, ini->getNextToken());
+ if (science == SCIENCE_INVALID)
+ return;
+
ProductionPrerequisite prereq;
- prereq.addSciencePrereq(INI::scanScience(ini->getNextToken()));
+ prereq.addSciencePrereq(science);
v->push_back(prereq);
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
index f9bb20d33..4197b80be 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
@@ -261,6 +261,12 @@ static void AIUpdate_traceMove( const Object *obj, const Coord3D& framePos, Bool
NameKeyType locoKey = NAMEKEY(locoName);
const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(locoKey);
+ if (!lt && ini->getLoadType() == INI_LOAD_MULTIFILE)
+ {
+ // a patch INI loaded over a mod can name a locomotor the mod renamed or removed
+ DEBUG_LOG(("[LINE: %d in '%s'] locomotor '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), locoName));
+ continue;
+ }
if (!lt)
{
DEBUG_CRASH(("Locomotor %s not found!\n",locoName));
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 29eb53c60..1abeb3ba8 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -16,7 +16,9 @@
#include "test_harness.h"
+#include <filesystem>
#include <limits>
+#include <string>
#include "Common/AsciiString.h"
#include "Common/CommandLine.h"
@@ -17132,6 +17134,42 @@ TEST(unsigned_text_parses_as_windows_32_bit_strtoul)
CHECK_EQ(strtoulAsWindows("-"), 0u);
}
+// No -mod replaces what the fork ships. The set is Code/Data as the build copies it into Run, less
+// the three trees that never ship, so a new master that FileSystem::isForkOwnedPath does not cover
+// fails here instead of letting a mod quietly win over it. Retail's own loose files stay the mod's.
+TEST(every_shipped_master_is_fork_owned_and_retail_files_are_not)
+{
+ const std::filesystem::path data = std::filesystem::path(ZH_CODE_DIR) / "Data";
+ Int masters = 0;
+ for (std::filesystem::recursive_directory_iterator it(data), end; it != end; ++it)
+ {
+ if (!it->is_regular_file())
+ continue;
+ std::string relative = std::filesystem::relative(it->path(), data).generic_string();
+ if (relative.rfind("Scenarios/", 0) == 0 || relative.rfind("Cinema/", 0) == 0 || relative == "dx11shaders.shipped")
+ continue;
+ // the post-build copy keeps Data\ in front of these and puts the rest at the top of Run
+ const char *underData[] = { "INI/", "Scripts/", "Turkish/", "German/" };
+ Bool keepsData = relative == "Patch.str";
+ for (const char *prefix : underData)
+ keepsData = keepsData || relative.rfind(prefix, 0) == 0;
+ const std::string runPath = keepsData ? "Data/" + relative : relative;
+ if (!FileSystem::isForkOwnedPath(AsciiString(runPath.c_str())))
+ printf(" not fork-owned: %s\n", runPath.c_str());
+ CHECK(FileSystem::isForkOwnedPath(AsciiString(runPath.c_str())));
+ ++masters;
+ }
+ CHECK(masters > 20);
+
+ CHECK(FileSystem::isForkOwnedPath(AsciiString("Art\\Textures\\ClassicWideBarGLA.tga")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\Scripts\\MultiplayerScripts.scb")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\Scripts\\Scripts.ini")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\INI\\GameData.ini")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\INI\\Object\\AmericaTankReforged.ini")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\English\\Movies\\EA_LOGO.bik")));
+ CHECK(!FileSystem::isForkOwnedPath(AsciiString("Art\\Textures\\AVPaladin.tga")));
+}
+
#include "test_minimap_input.inc"
#include "test_selection_priority.inc"
#include "test_widechar_width.inc"