Not sure if you are taking feature requests or additions - in any case.
I was using the nwnx_areas plugin from this repo last night -
It seems that it may not have the same ability as the previous nwnx_area to lazy load resources from the resman resources folder.
The previous one I used by Maxrock had a CExoRes hook - which would check the External Sources directory for the existence of the git file in the are directory within the Resources folder.
Last night when testing - I saw that the areas plugin was refusing to load an area, that I knew existed in my external sources directory (git, gic and are) - It was saying it couldnt find the GIC or GIT file etc.
After I added the hook from the above URL to your nwnx_areas - it then became resman aware.
It looks like below:
Not sure if there is further optimizations you would recommend - I know that the nwnx_memory could prob be utilized here around the string instantiation.
Perhaps using CExoString instead of char[]?
static void __fastcall CExoResMan__ExistsHOOK(CExoResMan *pTHIS, void *pVOID, CResRef const &ResRef, unsigned short Type, unsigned long *a3);
void __fastcall CExoResMan__ExistsHOOK(CExoResMan *pTHIS, void *pVOID, CResRef const &ResRef, unsigned short Type, unsigned long *a3) {
areas.Log("o Requesting resource for area: %s\n",&ResRef);
if (Type != 2023) return CExoResMan__ExistsNEXT(pTHIS, NULL, ResRef, Type, a3);
char ref[17];
memcpy(ref, &ResRef, 16); ref[16] = 0;
std::string resPath = areas.m_sourcePath;
resPath += "are\\";
resPath += ref;
resPath += ".git";
FILE *GIT = fopen(resPath.c_str(), "rb");
if (GIT == NULL) {
//_log(3, "o External area (%s) file not found\n", ref);
areas.Log("o Requesting resource Not Found: %s\n", &ResRef);
return CExoResMan__ExistsNEXT(pTHIS, NULL, ResRef, Type, a3);
}
else {
//_log(2, "o external git found: %s\n", resPath.c_str());
fclose(GIT); // just needed to know it was there
areas.Log("o Requesting resource Found: %s\n", &ResRef);
return CExoResMan__ExistsNEXT(pTHIS, NULL, ResRef, Type, a3);
}
}
Didnt add that hook to nwnx_areas because it already exists in nwnx_dynres since it was necessary to be able to load areas from erf containers such as mod files.
Not sure if you are taking feature requests or additions - in any case.
I was using the nwnx_areas plugin from this repo last night - It seems that it may not have the same ability as the previous nwnx_area to lazy load resources from the resman resources folder.
The previous one I used by Maxrock had a CExoRes hook - which would check the External Sources directory for the existence of the git file in the are directory within the Resources folder.
This hook can be seen here: https://github.com/NWNX/nwnx2-win32/blob/maxrock/nwnx_areas/HookFunc.cpp
Last night when testing - I saw that the areas plugin was refusing to load an area, that I knew existed in my external sources directory (git, gic and are) - It was saying it couldnt find the GIC or GIT file etc.
After I added the hook from the above URL to your nwnx_areas - it then became resman aware. It looks like below: Not sure if there is further optimizations you would recommend - I know that the nwnx_memory could prob be utilized here around the string instantiation. Perhaps using CExoString instead of char[]?