Skip to content

Commit

Permalink
Merge branch 'Vita3K:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
backgamon authored May 22, 2024
2 parents f270efa + b8ef1dd commit 4e87eb2
Show file tree
Hide file tree
Showing 26 changed files with 179 additions and 191 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/2-feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Feature Request
description: Template for feature request
title: "[Feature Request]: "
labels: "Feature Request"
labels: "feature request"
body:
- type: markdown
attributes:
value: Tech support does not belong here. You should only file an issue here if you are requesting a feature you believe would make Vit3K better.
value: Tech support does not belong here. You should only file an issue here if you are requesting a feature you believe would make Vita3K better.
- type: checkboxes
attributes:
label: Is there an existing issue for this?
Expand Down
4 changes: 2 additions & 2 deletions vita3k/codec/src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void PlayerState::free_video() {
audio_packets.pop();
}

video_playing = "";
video_playing.clear();
}

void PlayerState::switch_video(const std::string &path) {
Expand Down Expand Up @@ -245,6 +245,6 @@ void PlayerState::queue(const std::string &path) {
PlayerState::~PlayerState() {
free_video();

video_playing = "";
video_playing.clear();
videos_queue = {};
}
43 changes: 22 additions & 21 deletions vita3k/gui/src/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,32 @@
namespace gui {

// Add any new developer/contributor in alphabetic order
static std::vector<const char *> developers_list = {
static constexpr std::array developers_list = {
"1whatleytay", "bookmist", "EXtremeExploit", "frangarcj", "IllusionMan1212",
"KorewaWatchful", "Macdu", "pent0", "petmac", "Rinnegatamante",
"sunho", "VelocityRa", "Zangetsu38"
};

static std::vector<const char *> contributors_list = {
"0nza1101", "0x8080", "AtticFinder65536", "BogdanTheGeek", "bsinky",
"bythos14", "cobalt2727", "CoffeeBrewer64", "Cpasjuste", "CreepNT",
"Croden1999", "d3m3vilurr", "Danik2343", "DerRM", "devnoname120",
"dima-xd", "dracc", "edwinr", "Felipefpl", "FlotterCodername",
"Frain-Breeze", "francois-berder", "FromAlaska", "Ghabry", "hobyst",
"HuanJiCanShang", "ichisadashioko", "illusion0001", "isJuhn",
"jdoe0000000", "jlachniet", "Johnnynator", "johnothwolo", "Kaitul",
"kd-11", "KhoraLee", "lephilousophe", "lybxlpsv", "MaddTheSane",
"Margen67", "merryhime", "mirusu400", "mkersey", "mrcmunir",
"muemart", "NabsiYa", "NeveHanter", "ngeojiajun", "Nicba1010",
"nishinji", "nn9dev", "Princess-of-Sleeping", "qurious-pixel", "Ristellise",
"scribam", "sitiom", "smitdylan2001", "SonicMastr", "Talkashie",
"Tarik366", "tcoyvwac", "thp", "TingPing", "TomasKralCZ",
"totlmstr", "wfscans", "xero-lib", "xerpi", "xyzz",
"yousifd", "Yunotchi"
static constexpr std::array contributors_list = {
"0nza1101", "0x8080", "AtticFinder65536", "Avellea", "blackbird806",
"BogdanTheGeek", "bsinky", "bythos14", "cobalt2727", "CoffeeBrewer64", "Cpasjuste",
"Creeot", "CreepNT", "Croden1999", "d3m3vilurr", "Danik2343", "darkash",
"DerRM", "devnoname120", "dima-xd", "dracc", "edwinr", "FantasyGmm",
"Felipefpl", "FlotterCodername", "Frain-Breeze", "francois-berder", "FromAlaska",
"Ghabry", "hobyst", "HuanJiCanShang", "ichisadashioko", "illusion0001",
"isJuhn", "jdoe0000000", "jlachniet", "Johnnynator", "johnothwolo", "Kaitul",
"KaneDbD", "kd-11", "KhoraLee", "Kitakatarashima", "lephilousophe",
"Lupiax", "lybxlpsv", "MaddTheSane", "Margen67", "mavethee", "merryhime",
"mirusu400", "mkersey", "mrcmunir", "muemart", "NeveHanter", "ngeojiajun",
"Nicba1010", "nishinji", "nn9dev", "Nyabsi", "oltolm", "pedrozzz0",
"Princess-of-Sleeping", "qurious-pixel", "redpolline", "Ristellise",
"saturnsky", "scribam", "sitiom", "slipcounter", "smitdylan2001",
"SonicMastr", "Talkashie", "Tarik366", "tcoyvwac", "thp", "TingPing",
"TomasKralCZ", "totlmstr", "Valeriy-Lednikov", "wfscans", "xero-lib",
"xerpi", "xperia64", "xsamueljr", "xyzz", "yousifd", "Yunotchi"
};

static std::vector<const char *> supporters_list = {
static constexpr std::array supporters_list = {
"j0hnnybrav0", "TacoOblivion", "Undeadbob", "uplush"
};

Expand Down Expand Up @@ -132,9 +133,9 @@ void draw_about_dialog(GuiState &gui, EmuEnvState &emuenv) {
if (ImGui::BeginTable("##vita3k_staff_table", STAFF_COLUMN_COUNT, ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersV | ImGuiTableFlags_NoSavedSettings, STAFF_LIST_SIZE)) {
ImGui::TableSetupScrollFreeze(1, 1);
ImGui::PushStyleColor(ImGuiCol_Text, GUI_COLOR_TEXT_TITLE);
ImGui::TableSetupColumn(lang["developers"].c_str(), ImGuiTableColumnFlags_NoHide, STAFF_COLUMN_SIZE);
ImGui::TableSetupColumn(lang["contributors"].c_str(), ImGuiTableColumnFlags_NoHide, STAFF_COLUMN_SIZE);
ImGui::TableSetupColumn(lang["supporters"].c_str(), ImGuiTableColumnFlags_NoHide, STAFF_COLUMN_SIZE);
ImGui::TableSetupColumn(lang["developers"].c_str(), ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthFixed, STAFF_COLUMN_SIZE);
ImGui::TableSetupColumn(lang["contributors"].c_str(), ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthFixed, STAFF_COLUMN_SIZE);
ImGui::TableSetupColumn(lang["supporters"].c_str(), ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthFixed, STAFF_COLUMN_SIZE);
ImGui::TableHeadersRow();
ImGui::PopStyleColor();
ImGui::TableNextRow();
Expand Down
4 changes: 2 additions & 2 deletions vita3k/gui/src/allocations_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace gui {

static std::array blacklist = {
static constexpr std::array<const char *, 2> blacklist = {
"NULL",
"export_sceGxmDisplayQueueAddEntry"
};
Expand All @@ -37,7 +37,7 @@ void draw_allocations_dialog(GuiState &gui, EmuEnvState &emuenv) {
if (vector_utils::contains(blacklist, generation_name))
continue;

const auto page = emuenv.mem.alloc_table[generation_num];
const auto &page = emuenv.mem.alloc_table[generation_num];
if (ImGui::TreeNode(fmt::format("{}: {}", generation_num, generation_name).c_str())) {
ImGui::Text("Range 0x%08zx - 0x%08zx.", generation_num * KiB(4), (generation_num + page.size) * KiB(4));
ImGui::Text("Size: %i KiB (%i page[s])", page.size * 4, page.size);
Expand Down
31 changes: 14 additions & 17 deletions vita3k/gui/src/app_context_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ static bool get_update_history(GuiState &gui, EmuEnvState &emuenv, const std::st
update_history_infos[info.attribute("app_ver").as_double()] = info.text().as_string();

for (auto &update : update_history_infos) {
const auto startpos = "<";
const auto endpos = ">";

if (update.second.find_first_of('\n') != std::string::npos)
update.second.erase(update.second.begin() + update.second.find_first_of('\n'));

Expand All @@ -71,9 +68,9 @@ static bool get_update_history(GuiState &gui, EmuEnvState &emuenv, const std::st
while (update.second.find("<li>") != std::string::npos)
if (update.second.find("<li>") != std::string::npos)
update.second.replace(update.second.find("<li>"), 4, reinterpret_cast<const char *>(u8"\u30FB")); // 00B7 or 2022 or 30FB or FF65
while (update.second.find(startpos) != std::string::npos)
if (update.second.find(">") + 1 != std::string::npos)
update.second.erase(update.second.find(startpos), update.second.find(endpos) + 1 - update.second.find(startpos));
while (update.second.find('<') != std::string::npos)
if (update.second.find('>') + 1 != std::string::npos)
update.second.erase(update.second.find('<'), update.second.find('>') + 1 - update.second.find('<'));
while (update.second.find("&nbsp;") != std::string::npos)
if (update.second.find("&nbsp;") != std::string::npos)
update.second.replace(update.second.find("&nbsp;"), 6, " ");
Expand Down Expand Up @@ -106,12 +103,12 @@ std::vector<TimeApp>::iterator get_time_app_index(GuiState &gui, EmuEnvState &em
}

static std::string get_time_app_used(GuiState &gui, const int64_t &time_used) {
static const uint32_t one_min = 60;
static const uint32_t one_hour = one_min * 60;
static const uint32_t twenty_four_hours = 24;
static const uint32_t one_day = one_hour * twenty_four_hours;
static const uint32_t seven_days = 7;
static const uint32_t one_week = one_day * seven_days;
constexpr uint32_t one_min = 60;
constexpr uint32_t one_hour = one_min * 60;
constexpr uint32_t twenty_four_hours = 24;
constexpr uint32_t one_day = one_hour * twenty_four_hours;
constexpr uint32_t seven_days = 7;
constexpr uint32_t one_week = one_day * seven_days;

auto &lang = gui.lang.app_context.time_used;

Expand Down Expand Up @@ -218,7 +215,7 @@ void update_last_time_app_used(GuiState &gui, EmuEnvState &emuenv, const std::st

void delete_app(GuiState &gui, EmuEnvState &emuenv, const std::string &app_path) {
const auto APP_INDEX = get_app_index(gui, app_path);
const auto title_id = APP_INDEX->title_id;
const auto &title_id = APP_INDEX->title_id;
try {
fs::remove_all(emuenv.pref_path / "ux0/app" / app_path);

Expand Down Expand Up @@ -296,7 +293,7 @@ static std::string context_dialog;

void draw_app_context_menu(GuiState &gui, EmuEnvState &emuenv, const std::string &app_path) {
const auto APP_INDEX = get_app_index(gui, app_path);
const auto title_id = APP_INDEX->title_id;
const auto &title_id = APP_INDEX->title_id;

const auto APP_PATH{ emuenv.pref_path / "ux0/app" / app_path };
const auto CUSTOM_CONFIG_PATH{ emuenv.config_path / "config" / fmt::format("config_{}.xml", app_path) };
Expand Down Expand Up @@ -326,13 +323,13 @@ void draw_app_context_menu(GuiState &gui, EmuEnvState &emuenv, const std::string
const auto is_system_app = title_id.starts_with("NPXS") && (title_id != "NPXS10007");
const auto has_state_report = gui.compat.compat_db_loaded ? gui.compat.app_compat_db.contains(title_id) : false;
const auto compat_state = has_state_report ? gui.compat.app_compat_db[title_id].state : compat::UNKNOWN;
const auto compat_state_color = gui.compat.compat_color[compat_state];
const auto compat_state_str = has_state_report ? lang_compat.states[compat_state] : lang_compat.states[compat::UNKNOWN];
const auto &compat_state_color = gui.compat.compat_color[compat_state];
const auto &compat_state_str = has_state_report ? lang_compat.states[compat_state] : lang_compat.states[compat::UNKNOWN];

// App Context Menu
if (ImGui::BeginPopupContextItem("##app_context_menu")) {
ImGui::SetWindowFontScale(1.1f);
const auto START_STR = app_path == emuenv.io.app_path ? gui.lang.live_area.main["continue"] : gui.lang.live_area.main["start"];
const auto &START_STR = app_path == emuenv.io.app_path ? gui.lang.live_area.main["continue"] : gui.lang.live_area.main["start"];
if (ImGui::MenuItem(START_STR.c_str()))
pre_run_app(gui, emuenv, app_path);
if (!is_system_app) {
Expand Down
6 changes: 3 additions & 3 deletions vita3k/gui/src/archive_install_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ void draw_archive_install_dialog(GuiState &gui, EmuEnvState &emuenv) {
};
std::lock_guard<std::mutex> lock(install_mutex);

auto lang = gui.lang.install_dialog.archive_install;
auto indicator = gui.lang.indicator;
auto common = emuenv.common_dialog.lang.common;
auto &lang = gui.lang.install_dialog.archive_install;
auto &indicator = gui.lang.indicator;
auto &common = emuenv.common_dialog.lang.common;

const ImVec2 display_size(emuenv.viewport_size.x, emuenv.viewport_size.y);
const auto RES_SCALE = ImVec2(display_size.x / emuenv.res_width_dpi_scale, display_size.y / emuenv.res_height_dpi_scale);
Expand Down
4 changes: 2 additions & 2 deletions vita3k/gui/src/common_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ static ImTextureID check_and_init_icon_texture(GuiState &gui, EmuEnvState &emuen

static void draw_save_info(GuiState &gui, EmuEnvState &emuenv, const ImVec2 WINDOW_SIZE, float FONT_SCALE, ImVec2 SCALE, const ImTextureID icon_texture) {
const ImVec2 THUMBNAIL_SIZE = ImVec2(160.f * SCALE.x, 90.f * SCALE.y);
auto lang = emuenv.common_dialog.lang.save_data.info;
auto &lang = emuenv.common_dialog.lang.save_data.info;

const ImVec2 ICON_POS(100.f * SCALE.x, 16.f * SCALE.y);
if (icon_texture) {
Expand All @@ -356,7 +356,7 @@ static void draw_save_info(GuiState &gui, EmuEnvState &emuenv, const ImVec2 WIND
ImGui::SetCursorPos(ImVec2(ICON_POS.x, ImGui::GetCursorPosY() + (46.f * SCALE.y)));
ImGui::Text("%s", lang["details"].c_str());
ImGui::SameLine(INFO_POS_WIDTH);
const auto DETAILS_STR = !emuenv.common_dialog.savedata.details[emuenv.common_dialog.savedata.selected_save].empty() ? emuenv.common_dialog.savedata.details[emuenv.common_dialog.savedata.selected_save] : emuenv.common_dialog.savedata.subtitle[emuenv.common_dialog.savedata.selected_save];
const auto &DETAILS_STR = !emuenv.common_dialog.savedata.details[emuenv.common_dialog.savedata.selected_save].empty() ? emuenv.common_dialog.savedata.details[emuenv.common_dialog.savedata.selected_save] : emuenv.common_dialog.savedata.subtitle[emuenv.common_dialog.savedata.selected_save];
ImGui::Text("%s", DETAILS_STR.c_str());
const ImVec2 BUTTON_SIZE = ImVec2(64 * SCALE.x, 34 * SCALE.y);
const ImVec2 BUTTON_POS = ImVec2(6.f * SCALE.x, WINDOW_SIZE.y - (BUTTON_SIZE.y + 14 * SCALE.y));
Expand Down
4 changes: 2 additions & 2 deletions vita3k/gui/src/controls_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace gui {

static char const *SDL_key_to_string[]{ "[unset]", "[unknown]", "[unknown]", "[unknown]", "A", "B", "C", "D", "E", "F", "G",
static constexpr std::array<const char *, 256> SDL_key_to_string{ "[unset]", "[unknown]", "[unknown]", "[unknown]", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
"Return/Enter", "Escape", "Backspace", "Tab", "Space", "-", "=", "[", "]", "\\", "NonUS #", ";", "'", "Grave", ",", ".", "/", "CapsLock", "F1",
"F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "PrtScrn", "ScrlLock", "Pause", "Insert", "Home", "PgUp", "Delete",
Expand All @@ -43,7 +43,7 @@ static char const *SDL_key_to_string[]{ "[unset]", "[unknown]", "[unknown]", "[u
"Keypad Mem+", "Keypad Mem-", "Keypad Mem*", "Keypad Mem/", "Keypad +/-", "Keypad Clear", "Keypad ClearEntry", "Keypad Binary", "Keypad Octal",
"Keypad Dec", "Keypad HexaDec", "[unset]", "[unset]", "LCtrl", "LShift", "LAlt", "Win/Cmd", "RCtrl", "RShift", "RAlt", "RWin/Cmd" };

static const short total_key_entries = 28;
static constexpr short total_key_entries = 28;

static void prepare_map_array(EmuEnvState &emuenv, std::array<int, total_key_entries> &map) {
map[0] = emuenv.cfg.keyboard_leftstick_up;
Expand Down
4 changes: 2 additions & 2 deletions vita3k/gui/src/firmware_install_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ void draw_firmware_install_dialog(GuiState &gui, EmuEnvState &emuenv) {
};
std::lock_guard<std::mutex> lock(install_mutex);

auto lang = gui.lang.install_dialog.firmware_install;
auto common = emuenv.common_dialog.lang.common;
auto &lang = gui.lang.install_dialog.firmware_install;
auto &common = emuenv.common_dialog.lang.common;

const ImVec2 display_size(emuenv.viewport_size.x, emuenv.viewport_size.y);
const ImVec2 RES_SCALE(display_size.x / emuenv.res_width_dpi_scale, display_size.y / emuenv.res_height_dpi_scale);
Expand Down
Loading

0 comments on commit 4e87eb2

Please sign in to comment.