DiscIO: Remove VolumeCreator
This file is pretty small now that it doesn't handle Wii partitions anymore, so let's move its contents to Volume.cpp. This is also more consistent with how blob creation works.
This commit is contained in:
parent
56b218a750
commit
ac5c82b36b
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
#include "UICommon/UICommon.h"
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/NANDContentLoader.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
// Inserts a disc into the emulated disc drive and returns a pointer to it.
|
||||
// The returned pointer must only be used while we are still booting,
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/NANDContentLoader.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
SConfig* SConfig::m_Instance;
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DiscIO/VolumeWiiCrypted.h"
|
||||
|
||||
// The minimum time it takes for the DVD drive to process a command (in
|
||||
|
|
|
@ -13,7 +13,6 @@ set(SRCS
|
|||
NANDImporter.cpp
|
||||
TGCBlob.cpp
|
||||
Volume.cpp
|
||||
VolumeCreator.cpp
|
||||
VolumeDirectory.cpp
|
||||
VolumeGC.cpp
|
||||
VolumeWad.cpp
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
<ClCompile Include="NANDImporter.cpp" />
|
||||
<ClCompile Include="TGCBlob.cpp" />
|
||||
<ClCompile Include="Volume.cpp" />
|
||||
<ClCompile Include="VolumeCreator.cpp" />
|
||||
<ClCompile Include="VolumeDirectory.cpp" />
|
||||
<ClCompile Include="VolumeGC.cpp" />
|
||||
<ClCompile Include="VolumeWad.cpp" />
|
||||
|
@ -70,7 +69,6 @@
|
|||
<ClInclude Include="NANDImporter.h" />
|
||||
<ClInclude Include="TGCBlob.h" />
|
||||
<ClInclude Include="Volume.h" />
|
||||
<ClInclude Include="VolumeCreator.h" />
|
||||
<ClInclude Include="VolumeDirectory.h" />
|
||||
<ClInclude Include="VolumeGC.h" />
|
||||
<ClInclude Include="VolumeWad.h" />
|
||||
|
|
|
@ -54,9 +54,6 @@
|
|||
<ClCompile Include="WbfsBlob.cpp">
|
||||
<Filter>Volume\Blob</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolumeCreator.cpp">
|
||||
<Filter>Volume</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolumeDirectory.cpp">
|
||||
<Filter>Volume</Filter>
|
||||
</ClCompile>
|
||||
|
@ -119,9 +116,6 @@
|
|||
<ClInclude Include="Volume.h">
|
||||
<Filter>Volume</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VolumeCreator.h">
|
||||
<Filter>Volume</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VolumeDirectory.h">
|
||||
<Filter>Volume</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "DiscIO/DiscScrubber.h"
|
||||
#include "DiscIO/Filesystem.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -17,7 +18,12 @@
|
|||
#include "Common/StringUtil.h"
|
||||
#include "Common/Swap.h"
|
||||
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/VolumeDirectory.h"
|
||||
#include "DiscIO/VolumeGC.h"
|
||||
#include "DiscIO/VolumeWad.h"
|
||||
#include "DiscIO/VolumeWiiCrypted.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
@ -76,4 +82,49 @@ std::map<Language, std::string> IVolume::ReadWiiNames(const std::vector<u8>& dat
|
|||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename)
|
||||
{
|
||||
std::unique_ptr<IBlobReader> reader(CreateBlobReader(filename));
|
||||
if (reader == nullptr)
|
||||
return nullptr;
|
||||
CBlobBigEndianReader be_reader(*reader);
|
||||
|
||||
// Check for Wii
|
||||
u32 wii_magic = 0;
|
||||
be_reader.ReadSwapped(0x18, &wii_magic);
|
||||
u32 wii_container_magic = 0;
|
||||
be_reader.ReadSwapped(0x60, &wii_container_magic);
|
||||
if (wii_magic == 0x5D1C9EA3 && wii_container_magic != 0)
|
||||
return std::make_unique<CVolumeGC>(std::move(reader));
|
||||
if (wii_magic == 0x5D1C9EA3 && wii_container_magic == 0)
|
||||
return std::make_unique<CVolumeWiiCrypted>(std::move(reader));
|
||||
|
||||
// Check for WAD
|
||||
// 0x206962 for boot2 wads
|
||||
u32 wad_magic = 0;
|
||||
be_reader.ReadSwapped(0x02, &wad_magic);
|
||||
if (wad_magic == 0x00204973 || wad_magic == 0x00206962)
|
||||
return std::make_unique<CVolumeWAD>(std::move(reader));
|
||||
|
||||
// Check for GC
|
||||
u32 gc_magic = 0;
|
||||
be_reader.ReadSwapped(0x1C, &gc_magic);
|
||||
if (gc_magic == 0xC2339F3D)
|
||||
return std::make_unique<CVolumeGC>(std::move(reader));
|
||||
|
||||
// No known magic words found
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||
const std::string& apploader,
|
||||
const std::string& dol)
|
||||
{
|
||||
if (CVolumeDirectory::IsValidDirectory(directory))
|
||||
return std::make_unique<CVolumeDirectory>(directory, is_wii, apploader, dol);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -112,4 +113,9 @@ protected:
|
|||
static const size_t NAMES_TOTAL_BYTES = NAME_BYTES_LENGTH * NUMBER_OF_LANGUAGES;
|
||||
};
|
||||
|
||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename);
|
||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||
const std::string& apploader = "",
|
||||
const std::string& dol = "");
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
// Copyright 2008 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DiscIO/VolumeDirectory.h"
|
||||
#include "DiscIO/VolumeGC.h"
|
||||
#include "DiscIO/VolumeWad.h"
|
||||
#include "DiscIO/VolumeWiiCrypted.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename)
|
||||
{
|
||||
std::unique_ptr<IBlobReader> reader(CreateBlobReader(filename));
|
||||
if (reader == nullptr)
|
||||
return nullptr;
|
||||
CBlobBigEndianReader be_reader(*reader);
|
||||
|
||||
// Check for Wii
|
||||
u32 wii_magic = 0;
|
||||
be_reader.ReadSwapped(0x18, &wii_magic);
|
||||
u32 wii_container_magic = 0;
|
||||
be_reader.ReadSwapped(0x60, &wii_container_magic);
|
||||
if (wii_magic == 0x5D1C9EA3 && wii_container_magic != 0)
|
||||
return std::make_unique<CVolumeGC>(std::move(reader));
|
||||
if (wii_magic == 0x5D1C9EA3 && wii_container_magic == 0)
|
||||
return std::make_unique<CVolumeWiiCrypted>(std::move(reader));
|
||||
|
||||
// Check for WAD
|
||||
// 0x206962 for boot2 wads
|
||||
u32 wad_magic = 0;
|
||||
be_reader.ReadSwapped(0x02, &wad_magic);
|
||||
if (wad_magic == 0x00204973 || wad_magic == 0x00206962)
|
||||
return std::make_unique<CVolumeWAD>(std::move(reader));
|
||||
|
||||
// Check for GC
|
||||
u32 gc_magic = 0;
|
||||
be_reader.ReadSwapped(0x1C, &gc_magic);
|
||||
if (gc_magic == 0xC2339F3D)
|
||||
return std::make_unique<CVolumeGC>(std::move(reader));
|
||||
|
||||
// No known magic words found
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||
const std::string& apploader,
|
||||
const std::string& dol)
|
||||
{
|
||||
if (CVolumeDirectory::IsValidDirectory(directory))
|
||||
return std::make_unique<CVolumeDirectory>(directory, is_wii, apploader, dol);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright 2008 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume;
|
||||
|
||||
std::unique_ptr<IVolume> CreateVolumeFromFilename(const std::string& filename);
|
||||
std::unique_ptr<IVolume> CreateVolumeFromDirectory(const std::string& directory, bool is_wii,
|
||||
const std::string& apploader = "",
|
||||
const std::string& dol = "");
|
||||
|
||||
} // namespace
|
|
@ -25,7 +25,6 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Filesystem.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/NANDContentLoader.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DolphinQt2/GameList/GameFile.h"
|
||||
#include "DolphinQt2/Resources.h"
|
||||
#include "DolphinQt2/Settings.h"
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
|
||||
#include "DiscIO/NANDContentLoader.h"
|
||||
#include "DiscIO/NANDImporter.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DiscIO/VolumeWad.h"
|
||||
|
||||
#include "DolphinWX/AboutDolphin.h"
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DolphinWX/Frame.h"
|
||||
#include "DolphinWX/GameListCtrl.h"
|
||||
#include "DolphinWX/Globals.h"
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
|
||||
#include "DolphinWX/ISOFile.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Filesystem.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DolphinWX/ISOFile.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/VolumeCreator.h"
|
||||
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
|
||||
#include "DolphinWX/Cheats/GeckoCodeDiag.h"
|
||||
#include "DolphinWX/Config/ConfigMain.h"
|
||||
|
|
Loading…
Reference in New Issue