jak-project/decompiler/data/StrFileReader.h
water111 50230e05fa
[jak2] Add static textures for the progress menu (#2838)
The progress menu loads its icon textures from a .STR file that we were
previously ignoring.

This change:
- updates the decompiler so it can process a .STR file containing a
texture
- adds a feature to force an entire page to always be loaded in the PC
renderer by putting all textures in the GAME.FR3 file.
- regenerates the texture offset map file for jak 2 with these new
textures

For now, I've just put the icon textures in GAME.FR3. The downside is
that these will always stay on the GPU, using up VRAM even when they
aren't needed. But the entire GAME.FR3 file is under 3 MB so I think
it's ok.


![image](https://github.com/open-goal/jak-project/assets/48171810/39f075b5-7cc5-4168-872a-33026342afab)
2023-07-23 12:35:59 -04:00

55 lines
1.4 KiB
C++

#pragma once
/*!
* @file StrFileReader.h
* Utility class to read a .STR file and extract the full file name.
*/
#include <string>
#include <vector>
#include "common/common_types.h"
#include "common/util/Assert.h"
#include "common/util/FileUtil.h"
#include "common/versions/versions.h"
namespace decompiler {
class StrFileReader {
public:
explicit StrFileReader(const fs::path& file_path, GameVersion version);
int chunk_count() const;
const std::vector<u8>& get_chunk(int idx) const;
std::string get_full_name(const std::string& short_name) const;
std::string get_texture_name() const;
private:
void init_jak1(const fs::path& file_path);
void init_jak2(const fs::path& file_path);
GameVersion m_version;
std::string get_art_group_file_info_string() const {
switch (m_version) {
case GameVersion::Jak1:
return "/src/next/data/art-group6/";
case GameVersion::Jak2:
return "/src/jak2/final/art-group7/";
default:
ASSERT_MSG(false, "NYI get_file_info_string version");
break;
}
}
std::string get_texture_page_file_info_string() const {
switch (m_version) {
case GameVersion::Jak2:
return "/src/jak2/final/texture-page8/";
default:
ASSERT_MSG(false, "NYI get_file_info_string version");
break;
}
}
std::vector<std::vector<u8>> m_chunks;
};
} // namespace decompiler