subtitles-editor: Allow removing lines and fix some issues (#2573)

Allows for removing a line in the subtitle editor finally, also fixed
the following:

- The path the editor used didn't include the game name
- Loading the subtitle project is too slow to do on startup now
(4-5seconds in a debug build), do it on demand now
This commit is contained in:
Tyler Wilding
2023-04-29 10:02:18 -05:00
committed by GitHub
parent 0ce5835818
commit 8260920c2d
5 changed files with 49 additions and 32 deletions
@@ -468,7 +468,7 @@ void open_text_project(const std::string& kind,
});
}
GameSubtitleDB load_subtitle_project() {
GameSubtitleDB load_subtitle_project(GameVersion game_version) {
// Load the subtitle files
GameSubtitleDB db;
db.m_subtitle_groups = std::make_unique<GameSubtitleGroups>();
@@ -476,8 +476,9 @@ GameSubtitleDB load_subtitle_project() {
try {
goos::Reader reader;
std::vector<std::string> inputs;
std::string subtitle_project =
(file_util::get_jak_project_dir() / "game" / "assets" / "game_subtitle.gp").string();
std::string subtitle_project = (file_util::get_jak_project_dir() / "game" / "assets" /
version_to_game_name(game_version) / "game_subtitle.gp")
.string();
open_text_project("subtitle", subtitle_project, inputs);
for (auto& filename : inputs) {
auto code = reader.read_from_file({filename});
@@ -11,6 +11,7 @@
#include "common/log/log.h"
#include "common/util/Assert.h"
#include "common/util/FontUtils.h"
#include "common/versions/versions.h"
/*!
* The text bank contains all lines (accessed with an ID) for a language.
@@ -191,4 +192,4 @@ GameTextVersion parse_text_only_version(const goos::Object& data);
void open_text_project(const std::string& kind,
const std::string& filename,
std::vector<std::string>& inputs);
GameSubtitleDB load_subtitle_project();
GameSubtitleDB load_subtitle_project(GameVersion game_version);