Files
jak-project/game/graphics/opengl_renderer/debug_gui.h
T
Tyler Wilding c87db7e670 i18n: subtitle code cleanup and update new subtitle JSON files to be compatible with Crowdin (#2802)
The main thing that was done here was to slightly modify the new
subtitle-v2 JSON schema to be more similar to the existing one so that
it can properly be used in Crowdin.

Draft while I double-check the diff myself

Along the way the following was also done (among other things):
- got rid of as much duplication as was feasible in the serialization
and editor code
- separated the text serialization code from the subtitle code for
better organization
- simplified "base language" in the editor. The new subtitle format has
built-in support for defining a base language so the editor doesn't have
to be used as a crutch. Also, cutscenes only defined in the base come
first in the list now as that is generally the order you'd work from
(what you havn't done first)
- got rid of the GOAL subtitle format code completely
- switched jak 2 text translations to the JSON format as well
- found a few mistakes in the jak 1 subtitle metadata files
- added a couple minor features to the editor
- consolidate and removed complexity, ie. recently all jak 1 hints were
forced to the `named` type, so I got rid of the two types as there isn't
a need anymore.
- removed subtitle editor groups for jak 1, the only reason they existed
was so when the GOAL file was manually written out they were somewhat
organized, the editor has a decent filter control, there's no need for
them.
- removed the GOAL -> JSON python script helper, it's been a month or so
and no one has come forward with existing translations that they need
help with migrating. If they do need it, the script will be in the git
history.

I did some reasonably through testing in Jak1/Jak 2 and everything
seemed to work. But more testing is always a good idea.

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-07-09 02:53:39 +01:00

92 lines
2.3 KiB
C++

#pragma once
/*!
* @file debug_gui.h
* The debug menu-bar and frame timing window
*/
#include "common/dma/dma.h"
#include "common/util/Timer.h"
#include "common/versions/versions.h"
class FrameTimeRecorder {
public:
static constexpr int SIZE = 60 * 5;
void finish_frame();
void start_frame();
void draw_window(const DmaStats& dma_stats);
bool should_advance_frame() {
if (m_single_frame) {
m_single_frame = false;
return true;
}
return m_play;
}
bool do_gl_finish = false;
private:
float m_frame_times[SIZE] = {0};
float m_last_frame_time = 0;
int m_idx = 0;
Timer m_compute_timer;
Timer m_fps_timer;
bool m_open = true;
bool m_play = true;
bool m_single_frame = false;
};
class OpenGlDebugGui {
public:
OpenGlDebugGui(GameVersion version) : m_version(version) {}
void start_frame();
void finish_frame();
void draw(const DmaStats& dma_stats);
bool should_draw_render_debug() const { return master_enable && m_draw_debug; }
bool should_draw_profiler() const { return master_enable && m_draw_profiler; }
bool should_draw_subtitle_editor() const { return master_enable && m_subtitle_editor; }
bool should_draw_filters_menu() const { return master_enable && m_filters_menu; }
bool should_draw_loader_menu() const { return master_enable && m_draw_loader; }
const char* screenshot_name() const { return m_screenshot_save_name; }
bool should_advance_frame() { return m_frame_timer.should_advance_frame(); }
bool should_gl_finish() const { return m_frame_timer.do_gl_finish; }
bool get_screenshot_flag() {
if (m_want_screenshot) {
m_want_screenshot = false;
return true;
}
return false;
}
bool small_profiler = false;
bool record_events = false;
bool dump_events = false;
bool want_reboot_in_debug = false;
int screenshot_width = 1920;
int screenshot_height = 1080;
int screenshot_samples = 16;
bool screenshot_hotkey_enabled = true;
bool master_enable = false;
private:
FrameTimeRecorder m_frame_timer;
bool m_draw_frame_time = false;
bool m_draw_profiler = false;
bool m_draw_debug = false;
bool m_draw_loader = false;
bool m_subtitle_editor = false;
bool m_filters_menu = false;
bool m_want_screenshot = false;
char m_screenshot_save_name[256] = "screenshot.png";
float target_fps_input = 60.f;
GameVersion m_version;
};