Jump to content

Context root question


Recommended Posts

Whilst exploring the source, I notice that the engine will LoadDefaultScripts() in simulation2/Simulation2.cpp. After checking a while, it looks like the context root is set to `binaries/data/mods/public/simulation' when loading scripts.

However, when checking the source, the code shows that it loads directly from `simulation/...'


bool CSimulation2::LoadDefaultScripts()
{
return (
m->LoadScripts(L"simulation/components/interfaces/") &&
m->LoadScripts(L"simulation/helpers/") &&
m->LoadScripts(L"simulation/components/")
);
}

Where to specify the path `binaries/data/mods/public/'? Is it a fixed path? Or it may change dynamically (For instance, when loading other type of scripts, path may be changed to e.g. binaries/data/mods/_test.dae)?

Thanks for help.

Edited by chlin
Link to comment
Share on other sites

See VFS. The LoadScripts function takes a VfsPath argument, so "simulation/components/" is a virtual path. ps/GameSetup/GameSetup.cpp's InitVfs mounts physical paths (like ".../binaries/data/mods/public/") onto virtual paths (like ""), so the VFS can translate back to the physical path when the code wants to open a file.

There can be multiple mods loaded at once, so files will be read from a combination of them all. And the VFS can also load .zip files, so the virtual path might correspond to a file inside the zip instead of a single physical file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...