Merge pull request #720 from diamante0018/develop

Prevent game's fake rawfiles from being compiled
This commit is contained in:
Maurice Heumann 2022-10-19 08:28:49 +02:00 committed by GitHub
commit 8dba406820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -36,7 +36,7 @@ jobs:
lfs: false
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
uses: microsoft/setup-msbuild@v1.1.3
- name: Generate project files
#run: tools/premake5 vs2022 --ci-build
@ -49,7 +49,7 @@ jobs:
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/iw6x.sln
- name: Upload ${{matrix.configuration}} binaries
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.0
with:
name: ${{matrix.configuration}} binaries
path: |
@ -57,7 +57,7 @@ jobs:
build/bin/x64/${{matrix.configuration}}/iw6x.pdb
- name: Upload ${{matrix.configuration}} data artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.0
with:
name: ${{matrix.configuration}} data artifacts
path: |
@ -79,12 +79,12 @@ jobs:
run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH_DEV }}" >> $GITHUB_ENV
- name: Download Release binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: Release binaries
- name: Download Release data artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: Release data artifacts
path: data

View File

@ -49,6 +49,14 @@ namespace gsc
return true;
}
// This will prevent 'fake' GSC raw files from being compiled.
// They are parsed by the game's own parser later as they are special files.
if (name.starts_with("maps/createfx") || name.starts_with("maps/createart") ||
(name.starts_with("maps/mp") && name.ends_with("_fx.gsc")))
{
return false;
}
const auto* name_str = name.data();
if (game::DB_XAssetExists(game::ASSET_TYPE_RAWFILE, name_str) &&
!game::DB_IsXAssetDefault(game::ASSET_TYPE_RAWFILE, name_str))
@ -70,9 +78,9 @@ namespace gsc
game::ScriptFile* load_custom_script(const char* file_name, const std::string& real_name)
{
if (const auto got = loaded_scripts.find(real_name); got != loaded_scripts.end())
if (const auto itr = loaded_scripts.find(real_name); itr != loaded_scripts.end())
{
return got->second;
return itr->second;
}
std::string source_buffer{};
@ -288,7 +296,7 @@ namespace gsc
}
}
game::ScriptFile* find_script([[maybe_unused]] game::XAssetType type, const char* name, [[maybe_unused]] int allow_create_default)
game::ScriptFile* find_script(game::XAssetType type, const char* name, int allow_create_default)
{
std::string real_name = name;
const auto id = static_cast<std::uint16_t>(std::atoi(name));
@ -303,7 +311,7 @@ namespace gsc
return script;
}
return game::DB_FindXAssetHeader(game::ASSET_TYPE_SCRIPTFILE, name, 1).scriptfile;
return game::DB_FindXAssetHeader(type, name, allow_create_default).scriptfile;
}
class loading final : public component_interface