diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp index e6d21735..b3d7f94f 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp @@ -455,74 +455,6 @@ unordered_map *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(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) diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 1a3a7bd7..e0291cb4 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -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); - } } } diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 420bba64..78048d48 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -968,11 +968,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring storage = shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); #else - ConsoleSaveFileOriginal* pSave = new ConsoleSaveFileOriginal(L""); - - pSave->ConvertToLocalPlatform(); - storage = std::make_shared(pSave, File(L"."), name, true); - + storage = std::make_shared(new ConsoleSaveFileOriginal(L""), File(L"."), name, true); #endif } diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/Festive.mcs b/Minecraft.Client/Windows64Media/DLC/Festive/Data/Festive.mcs index 5dddea3f..c79ecc68 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Festive/Data/Festive.mcs and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/Festive.mcs differ diff --git a/Minecraft.World/RegionFileCache.cpp b/Minecraft.World/RegionFileCache.cpp index c7931146..cc670f91 100644 --- a/Minecraft.World/RegionFileCache.cpp +++ b/Minecraft.World/RegionFileCache.cpp @@ -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; diff --git a/tools/wiiU2Windows.py b/tools/wiiU2Windows.py index 1534e264..1c996b82 100644 --- a/tools/wiiU2Windows.py +++ b/tools/wiiU2Windows.py @@ -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()) \ No newline at end of file