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) void FastFiles::LoadDLCUIZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync)
{ {
Game::XZoneInfo* data = new Game::XZoneInfo[zoneCount + 2]; std::vector<Game::XZoneInfo> data;
memcpy(data, zoneInfo, sizeof(Game::XZoneInfo) * zoneCount); Utils::Merge(data, zoneInfo, zoneCount);
data[zoneCount].name = "dlc1_ui_mp"; Game::XZoneInfo info = { nullptr, 2, 0 };
data[zoneCount].allocFlags = 2;
data[zoneCount].freeFlags = 0;
zoneCount++;
data[zoneCount].name = "dlc2_ui_mp"; info.name = "dlc1_ui_mp";
data[zoneCount].allocFlags = 2; data.push_back(info);
data[zoneCount].freeFlags = 0;
zoneCount++;
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) const char* FastFiles::GetZoneLocation(const char* file)

View File

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

View File

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

View File

@ -29,6 +29,17 @@ namespace Utils
void Parse(std::string buffer); 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) template <typename T> void Merge(std::vector<T> &target, std::vector<T> &source)
{ {
for (auto &entry : source) for (auto &entry : source)