Skip to content

Commit

Permalink
start ff handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Jan 14, 2025
1 parent d6ed372 commit 08a66bf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/acts/tools/fastfile_handlers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <includes.hpp>
#include "fastfile_handlers.hpp"

namespace fastfile {

void* FFAssetPool::FindAssetHeader(size_t type, uint64_t name) {
if (type >= pool.size()) return nullptr;
auto it{ pool[type].find(name) };
if (it == pool[type].end()) return nullptr;
return it->second;
}

void FFAssetPool::AddAssetHeader(size_t type, uint64_t name, void* header) {
if (type >= pool.size()) {
pool.resize(type + 1);
}
pool[type][name] = header;
}

void FFAssetPool::ClearRef() {
pool.clear();
}

}
14 changes: 14 additions & 0 deletions src/acts/tools/fastfile_handlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

namespace fastfile {

class FFAssetPool {
std::vector<std::unordered_map<uint64_t, void*>> pool{};
public:
FFAssetPool() {};

void* FindAssetHeader(size_t type, uint64_t name);
void AddAssetHeader(size_t type, uint64_t name, void* header);
void ClearRef();
};
}
2 changes: 2 additions & 0 deletions src/acts/tools/ff/ff_t8.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <includes.hpp>
#include <tools/fastfile.hpp>

0 comments on commit 08a66bf

Please sign in to comment.