Replace dawnlibs with dawn.hpp

This commit is contained in:
2024-11-25 17:08:25 -06:00
parent cfa9e0e99a
commit aefbe17786
33 changed files with 86 additions and 59 deletions

View File

@@ -97,16 +97,16 @@ bool_t AssetDataLoader::isOpen() {
}
void AssetDataLoader::open() {
assertNull(this->assetArchiveFile, "AssetDataLoader::open: File is already open");
assertNull(this->assetArchive, "AssetDataLoader::open: Archive is already open");
assertNull(this->assetArchiveEntry, "AssetDataLoader::open: Entry is already open");
assertNull(this->assetArchiveFile, "File is already open");
assertNull(this->assetArchive, "Archive is already open");
assertNull(this->assetArchiveEntry, "Entry is already open");
this->assetArchiveFile = this->openAssetArchiveFile();
assertNotNull(this->assetArchiveFile, "AssetDataLoader::open: Failed to open archive file!");
assertNotNull(this->assetArchiveFile, "Failed to open archive file!");
// Open archive reader
assetArchive = archive_read_new();
assertNotNull(assetArchive, "AssetDataLoader::open: Failed to create archive reader");
assertNotNull(assetArchive, "Failed to create archive reader");
// Set up the reader
archive_read_support_format_tar(assetArchive);
@@ -119,7 +119,7 @@ void AssetDataLoader::open() {
archive_read_set_callback_data(assetArchive, this);
int32_t ret = archive_read_open1(assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to open archive!");
assertTrue(ret == ARCHIVE_OK, "Failed to open archive!");
position = 0;
// Iterate over each file to find the one for this asset loader.
@@ -127,20 +127,20 @@ void AssetDataLoader::open() {
const char_t *headerFile = (char_t*)archive_entry_pathname(assetArchiveEntry);
if(std::string(headerFile) == this->fileName) return;
int32_t ret = archive_read_data_skip(assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to skip data!");
assertTrue(ret == ARCHIVE_OK, "Failed to skip data!");
}
assertUnreachable("AssetDataLoader::open: Failed to find file!");
assertUnreachable("Failed to find file!");
}
int32_t AssetDataLoader::close() {
assertNotNull(this->assetArchiveFile, "AssetDataLoader::close: File is NULL");
assertNotNull(this->assetArchive, "AssetDataLoader::close: Archive is NULL!");
assertNotNull(this->assetArchiveEntry, "AssetDataLoader::close: Entry is NULL!");
assertNotNull(this->assetArchiveFile, "File is NULL");
assertNotNull(this->assetArchive, "Archive is NULL!");
assertNotNull(this->assetArchiveEntry, "Entry is NULL!");
// Close the archive
int32_t ret = archive_read_free(this->assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::close: Failed to close archive!");
assertTrue(ret == ARCHIVE_OK, "Failed to close archive!");
this->assetArchive = nullptr;
this->assetArchiveEntry = nullptr;

View File

@@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
extern "C" {
#include <archive.h>

View File

@@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class AssetLoader {

View File

@@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#include "asset/AssetLoader.hpp"
namespace Dawn {