Fix fastfile info allocation shit.

This commit is contained in:
momo5502 2016-01-02 04:51:08 +01:00
parent 8fb298ed16
commit 58ce9f0d17
4 changed files with 21 additions and 19 deletions

View File

@ -6,22 +6,18 @@ namespace Components
void FastFiles::LoadDLCUIZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync)
{
Game::XZoneInfo* data = new Game::XZoneInfo[zoneCount + 2];
memcpy(data, zoneInfo, sizeof(Game::XZoneInfo) * zoneCount);
std::vector<Game::XZoneInfo> data;
Utils::Merge(data, zoneInfo, zoneCount);
data[zoneCount].name = "dlc1_ui_mp";
data[zoneCount].allocFlags = 2;
data[zoneCount].freeFlags = 0;
zoneCount++;
Game::XZoneInfo info = { nullptr, 2, 0 };
data[zoneCount].name = "dlc2_ui_mp";
data[zoneCount].allocFlags = 2;
data[zoneCount].freeFlags = 0;
zoneCount++;
info.name = "dlc1_ui_mp";
data.push_back(info);
Game::DB_LoadXAssets(data, zoneCount, sync);
info.name = "dlc2_ui_mp";
data.push_back(info);
delete[] data;
Game::DB_LoadXAssets(data.data(), data.size(), sync);
}
const char* FastFiles::GetZoneLocation(const char* file)

View File

@ -27,11 +27,7 @@ namespace Components
}
std::vector<Game::XZoneInfo> data;
for (unsigned int i = 0; i < zoneCount; i++)
{
data.push_back(zoneInfo[i]);
}
Utils::Merge(data, zoneInfo, zoneCount);
for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); i++)
{

View File

@ -27,7 +27,6 @@ namespace Components
DWORD Playlist::StorePlaylistStub(const char** buffer)
{
Playlist::CurrentPlaylistBuffer = *buffer;
return Utils::Hook::Call<DWORD(const char**)>(0x4C0350)(buffer);
}
@ -84,7 +83,7 @@ namespace Components
Utils::Hook::Set<BYTE>(0x4B1170, 0xC3);
// disable playlist checking
Utils::Hook::Set<BYTE>(0x5B69E9, 0xEB);// too new
Utils::Hook::Set<BYTE>(0x5B69E9, 0xEB); // too new
Utils::Hook::Set<BYTE>(0x5B696E, 0xEB); // too old
//Got playlists is true

View File

@ -29,6 +29,17 @@ namespace Utils
void Parse(std::string buffer);
};
template <typename T> void Merge(std::vector<T> &target, T* source, size_t length)
{
if (source)
{
for (size_t i = 0; i < length; i++)
{
target.push_back(source[i]);
}
}
}
template <typename T> void Merge(std::vector<T> &target, std::vector<T> &source)
{
for (auto &entry : source)