Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
CCIGAMES committed Mar 2, 2024
1 parent 5bc5202 commit ec89653
Show file tree
Hide file tree
Showing 6 changed files with 1,198 additions and 0 deletions.
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);
};
Loading

0 comments on commit ec89653

Please sign in to comment.