fix: python toolset
This commit is contained in:
@@ -455,74 +455,6 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||
|
||||
void LevelGenerationOptions::loadBaseSaveData()
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
|
||||
int gameRulesCount = m_parentDLCPack ? m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) : 0;
|
||||
|
||||
wstring baseSave = getBaseSavePath();
|
||||
wstring packName = baseSave.substr(0, baseSave.find(L'.'));
|
||||
|
||||
for (int i = 0; i < gameRulesCount; ++i)
|
||||
{
|
||||
DLCGameRulesHeader* dlcFile = static_cast<DLCGameRulesHeader*>(m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
|
||||
|
||||
if (!dlcFile->getGrfPath().empty())
|
||||
{
|
||||
File grf(L"Windows64Media\\DLC\\" + packName + L"\\Data\\" + dlcFile->getGrfPath());
|
||||
|
||||
if (grf.exists())
|
||||
{
|
||||
wstring path = grf.getPath();
|
||||
HANDLE fileHandle = CreateFileW(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
|
||||
|
||||
if (fileHandle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD dwFileSize = grf.length();
|
||||
DWORD bytesRead;
|
||||
PBYTE pbData = new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle, pbData, dwFileSize, &bytesRead, nullptr);
|
||||
CloseHandle(fileHandle);
|
||||
|
||||
if (bSuccess)
|
||||
{
|
||||
dlcFile->setGrfData(pbData, dwFileSize, m_stringTable);
|
||||
app.m_gameRules.setLevelGenerationOptions(dlcFile->lgo);
|
||||
}
|
||||
delete[] pbData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requiresBaseSave() && !getBaseSavePath().empty())
|
||||
{
|
||||
File save(L"Windows64Media\\DLC\\" + packName + L"\\Data\\" + baseSave);
|
||||
|
||||
if (save.exists())
|
||||
{
|
||||
wstring path = save.getPath();
|
||||
HANDLE fileHandle = CreateFileW(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
|
||||
|
||||
if (fileHandle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD dwFileSize = GetFileSize(fileHandle, nullptr);
|
||||
DWORD bytesRead;
|
||||
PBYTE pbData = new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle, pbData, dwFileSize, &bytesRead, nullptr);
|
||||
CloseHandle(fileHandle);
|
||||
|
||||
if (bSuccess)
|
||||
setBaseSaveData(pbData, dwFileSize);
|
||||
else
|
||||
delete[] pbData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setLoadedData();
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
|
||||
|
||||
#else
|
||||
int mountIndex = -1;
|
||||
if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||
|
||||
@@ -549,7 +481,6 @@ void LevelGenerationOptions::loadBaseSaveData()
|
||||
setLoadedData();
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask)
|
||||
|
||||
@@ -1002,18 +1002,13 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
app.SetGameHostOption(eGameHostOption_All,param->settings);
|
||||
|
||||
// 4J Stu - If we are loading a DLC save that's separate from the texture pack, load
|
||||
if (param != nullptr && param->levelGen != nullptr && param->levelGen->isFromDLC())
|
||||
if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) )
|
||||
{
|
||||
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
param->levelGen->loadBaseSaveData();
|
||||
|
||||
while (!param->levelGen->hasLoadedData())
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -968,11 +968,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||
|
||||
storage = shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(newFormatSave, File(L"."), name, true));
|
||||
#else
|
||||
ConsoleSaveFileOriginal* pSave = new ConsoleSaveFileOriginal(L"");
|
||||
|
||||
pSave->ConvertToLocalPlatform();
|
||||
storage = std::make_shared<McRegionLevelStorage>(pSave, File(L"."), name, true);
|
||||
|
||||
storage = std::make_shared<McRegionLevelStorage>(new ConsoleSaveFileOriginal(L""), File(L"."), name, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,6 @@ bool RegionFileCache::useSplitSaves(ESavePlatform platform)
|
||||
{
|
||||
case SAVE_FILE_PLATFORM_XBONE:
|
||||
case SAVE_FILE_PLATFORM_PS4:
|
||||
case SAVE_FILE_PLATFORM_WIN64:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
+12
-18
@@ -217,10 +217,6 @@ def build_split_save_entries(parsed, src_payload, src_endian, dst_endian):
|
||||
prefix, region_x, region_z = region_info
|
||||
region_chunks = parse_region_chunks(data, src_endian)
|
||||
for chunk in region_chunks:
|
||||
# fireblade: if youre reading this pls fix non-dlc worlds
|
||||
# like if you dont do the --dlc argument then the center chunk
|
||||
# is always gonna be corrupted for some reason
|
||||
# (i genuinely have no clue towards why this happens)
|
||||
chunk_x = region_x * 32 + chunk["local_x"]
|
||||
chunk_z = region_z * 32 + chunk["local_z"]
|
||||
|
||||
@@ -388,9 +384,9 @@ def convert_region_file(region_data, src_endian, dst_endian):
|
||||
continue
|
||||
|
||||
chunk_offset = sector_start * REGION_SECTOR_BYTES
|
||||
chunk_limit = chunk_offset + (sector_count * REGION_SECTOR_BYTES)
|
||||
if chunk_limit > len(src):
|
||||
continue
|
||||
|
||||
# only skip if 8 byte chunk header is unreadable
|
||||
# sector_aligned chunk limit skips the goofy chunk in the center of the world
|
||||
if chunk_offset + 8 > len(src):
|
||||
continue
|
||||
|
||||
@@ -399,8 +395,6 @@ def convert_region_file(region_data, src_endian, dst_endian):
|
||||
|
||||
rle_flag = stored_length & 0x80000000
|
||||
payload_length = stored_length & 0x7FFFFFFF
|
||||
if chunk_offset + 8 + payload_length > chunk_limit:
|
||||
continue
|
||||
|
||||
write_u32(dst, chunk_offset, rle_flag | payload_length, dst_endian)
|
||||
write_u32(dst, chunk_offset + 4, decomp_length, dst_endian)
|
||||
@@ -575,17 +569,17 @@ def main():
|
||||
return 1
|
||||
|
||||
print("Converted save successfully!")
|
||||
print(f" Mode: {result["mode"]}")
|
||||
print(f" DLC Split Save: {result["split_saves"]}")
|
||||
print(f" Source Endian: {result["source_endian"]}")
|
||||
print(f" Target Endian: {result["target_endian"]}")
|
||||
print(f" Entry Count: {result["entry_count"]}")
|
||||
print(f" Versions: {result["original_version"]} -> {result["current_version"]}")
|
||||
print(f" Decompressed Size: {result["decompressed_size"]}")
|
||||
print(f" Output Size: {result["compressed_size"]}")
|
||||
print(f" Mode: {result['mode']}")
|
||||
print(f" DLC Split Save: {result['split_saves']}")
|
||||
print(f" Source Endian: {result['source_endian']}")
|
||||
print(f" Target Endian: {result['target_endian']}")
|
||||
print(f" Entry Count: {result['entry_count']}")
|
||||
print(f" Versions: {result['original_version']} -> {result['current_version']}")
|
||||
print(f" Decompressed Size: {result['decompressed_size']}")
|
||||
print(f" Output Size: {result['compressed_size']}")
|
||||
print(f" Output Path: {output_path}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user