Start implementing codo maps

This commit is contained in:
momo5502 2016-09-18 18:08:30 +02:00
parent 2ab995a2a5
commit 49beaf5566
6 changed files with 1163 additions and 3 deletions

View File

@ -29,6 +29,10 @@ namespace Components
static void Relocate(void* start, void* to, DWORD size = 4);
static void Relocate(DWORD start, DWORD size, DWORD to) {
Relocate((void*)start, (void*)to, size);
}
static void ZoneSave(Game::XAsset asset, ZoneBuilder::Zone* builder);
static void ZoneMark(Game::XAsset asset, ZoneBuilder::Zone* builder);

View File

@ -154,6 +154,12 @@ namespace Components
}
Zones::InstallPatches(*version);
// TODO: Ugly hotpatch, beautify that!
// if (*version >= 316)
// {
// *version = XFILE_VERSION;
// }
}
FastFiles::FastFiles()

View File

@ -84,6 +84,15 @@ namespace Components
return;
}
if (type == Game::XAssetType::ASSET_TYPE_WEAPON)
{
if (!strstr(name.data(), "_mp") && name != "none" && name != "destructible_car")
{
*restrict = true;
return;
}
}
if (type == Game::XAssetType::ASSET_TYPE_MAP_ENTS)
{
static std::string mapEntities;
@ -106,7 +115,10 @@ namespace Components
if (_strnicmp("mp_", mapname, 3))
{
format = "maps/%s.d3dbsp";
}
if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s)
{
// Adjust pointer to GameMap_Data
Utils::Hook::Set<Game::GameMap_Data**>(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data));
}
@ -218,6 +230,8 @@ namespace Components
//Maps::AddDependency("gulag", "mp_subbase");
//Maps::AddDependency("invasion", "mp_rust");
Maps::AddDependency("co_hunted", "mp_storm");
Maps::AddDependency("mp_nuked", "iw4x_dependencies_mp");
Maps::AddDependency("mp_bloc", "iw4x_dependencies_mp");
Maps::AddDependency("^(?!mp_).*", "iw4x_dependencies_mp"); // All maps not starting with "mp_"
}

View File

@ -79,7 +79,7 @@ namespace Components
Game::CModelSectionHeader* section = &header.sectionHeader[i];
for (int j = section->fixupStart; j < section->fixupStart + section->fixupCount; ++j)
{
unsigned int fixup = fixups[i];
unsigned int fixup = fixups[j];
*reinterpret_cast<DWORD*>(reinterpret_cast<char*>(section->buffer) + (fixup >> 3)) += reinterpret_cast<DWORD>(header.sectionHeader[fixup & 3].buffer);
}
}
@ -103,7 +103,7 @@ namespace Components
memcpy(&tempSurfaces[i], surfaceData + (i * 84), 12);
memcpy(&tempSurfaces[i].indexBuffer, surfaceData + (i * 84) + 16, 20);
memcpy(&tempSurfaces[i].numCT, surfaceData + (i * 84) + 40, 8);
memcpy(&tempSurfaces[i].pad5, surfaceData + (i * 84) + 52, 24);
memcpy(&tempSurfaces[i].something, surfaceData + (i * 84) + 52, 24);
tempSurfaces[i].streamHandle = 0xFF; // Fake handle for buffer interception
}

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
DWORD oldProtect;
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(NULL));
VirtualProtect(module, 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect); // Unprotect the entire process
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect); // Protect the .text segment
Main::EntryPointHook.Initialize(0x6BAC0F, [] ()
{