2023-08-06 08:48:11 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-07-09 10:54:27 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-09-25 22:03:33 -04:00
|
|
|
#include <QHash>
|
2023-07-09 10:54:27 -04:00
|
|
|
#include <QMap>
|
2023-09-26 20:20:36 -04:00
|
|
|
#include <QMutex>
|
2023-08-06 08:48:11 -04:00
|
|
|
#include <QString>
|
|
|
|
#include <physis.hpp>
|
2023-07-09 10:54:27 -04:00
|
|
|
|
|
|
|
struct GameData;
|
|
|
|
|
|
|
|
class FileCache {
|
|
|
|
public:
|
|
|
|
explicit FileCache(GameData& data);
|
|
|
|
|
2023-09-25 22:03:33 -04:00
|
|
|
bool fileExists(const QLatin1String &path);
|
2023-09-26 00:37:55 -04:00
|
|
|
physis_Buffer &lookupFile(const QLatin1String &path);
|
2023-07-09 10:54:27 -04:00
|
|
|
|
|
|
|
private:
|
2023-09-26 00:37:55 -04:00
|
|
|
QMap<QLatin1String, physis_Buffer> cachedBuffers;
|
2023-09-25 22:03:33 -04:00
|
|
|
QHash<QLatin1String, bool> cachedExist;
|
2023-07-09 10:54:27 -04:00
|
|
|
GameData& data;
|
2023-09-26 20:20:36 -04:00
|
|
|
QMutex bufferMutex, existMutex;
|
2023-07-09 10:54:27 -04:00
|
|
|
};
|