forked from Xeeynamo/sonic-hybrid-rsdk
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,198 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
sonic3air-main/Oxygen/oxygenengine/source/oxygen/file/FilePackage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Part of the Oxygen Engine / Sonic 3 A.I.R. software distribution. | ||
* Copyright (C) 2017-2024 by Eukaryot | ||
* | ||
* Published under the GNU GPLv3 open source software license, see license.txt | ||
* or https://www.gnu.org/licenses/gpl-3.0.en.html | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <rmxmedia.h> | ||
|
||
|
||
class FilePackage | ||
{ | ||
public: | ||
struct PackedFile | ||
{ | ||
std::wstring mPath; | ||
uint32 mPositionInFile = 0; | ||
uint32 mSizeInFile = 0; | ||
bool mLoadedContent = false; | ||
std::vector<uint8> mContent; | ||
}; | ||
|
||
struct PackageHeader | ||
{ | ||
static const constexpr char SIGNATURE[] = "OPCK"; | ||
static const constexpr uint32 CURRENT_FORMAT_VERSION = 3; | ||
static const constexpr size_t HEADER_SIZE = 20; | ||
|
||
uint32 mFormatVersion = CURRENT_FORMAT_VERSION; | ||
uint32 mContentVersion = 0; | ||
uint32 mEntryHeaderSize = 0; // Including the meta data for entries, but excluding their contents | ||
size_t mNumEntries = 0; | ||
}; | ||
|
||
public: | ||
static bool loadPackage(std::wstring_view packageFilename, std::map<std::wstring, PackedFile>& outPackedFiles, InputStream*& inputStream, bool forceLoadAll, bool showErrors = true); | ||
static void createFilePackage(const std::wstring& packageFilename, const std::vector<std::wstring>& includedPaths, const std::vector<std::wstring>& excludedPaths, const std::wstring& comparisonPath, uint32 contentVersion, bool forceReplace = false); | ||
|
||
private: | ||
static bool readPackageHeader(PackageHeader& outHeader, VectorBinarySerializer& serializer); | ||
}; |
Oops, something went wrong.