Merge pull request #678 from Lgt2x/third-party-scripts

Osiris: only load first-party scripts
This commit is contained in:
Louis Gombert
2025-03-06 19:42:06 +01:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -670,6 +670,7 @@
#include "BOA.h"
#include "terrain.h"
#include "multi.h"
#include "module.h"
#include "hud.h"
#include "localization.h"
#include "levelgoal.h"
@@ -1780,7 +1781,11 @@ bool mn3_Open(const std::filesystem::path &mn3file) {
if (mn3_handle == 0) {
return false;
} else {
Osiris_ExtractScriptsFromHog(mn3_handle, true);
/* Disabled loading scripts from .mn3 files on purpose:
all 64-bit first-party level scripts have already been loaded from `PRIMARY_HOG`.
Mission files contain only Win32 scripts by default, which cannot not be loaded on 64-bit builds.
Reactivate this when we have a proper sandbox system to safely run third-party scripts contained in user-made levels. */
// Osiris_ExtractScriptsFromHog(mn3_handle, true);
}
// do table file stuff.
std::filesystem::path filename = mn3file.stem();

View File

@@ -921,7 +921,10 @@ int get_full_path_to_module(const std::filesystem::path &module_name, std::files
fullpath = OSIRIS_Extracted_script_dir / OSIRIS_Extracted_scripts[basename].temp_filename;
return 0;
}
Int3(); // this file was supposed to exist
// Script was not found in extracted scripts,
// we are possibly looking for a script in a 3rd-party level, which we do not want to load
return -2;
} break;
default:
fullpath.clear();