Skip to content

Commit

Permalink
vita3k: cleanup (Vita3K#3357)
Browse files Browse the repository at this point in the history
* module: add missing pragma once

* cmake/vita3k: delete unused files

* vita3k: delete useless semi-colons

* vita3k: cleanup headers

* audio: add missing override to destructors

* vita3k: fix typos

* external: disable unused curl targets
  • Loading branch information
scribam authored Sep 2, 2024
1 parent f01a4e9 commit 612d1f8
Show file tree
Hide file tree
Showing 97 changed files with 134 additions and 274 deletions.
64 changes: 0 additions & 64 deletions cmake/GetStandard.cmake

This file was deleted.

6 changes: 6 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,17 @@ find_package(CURL QUIET)
if(NOT CURL_FOUND)
message("System curl not found, compiling curl from source")
include(FetchContent)
option(BUILD_CURL_EXE "Set to ON to build curl executable." OFF)
option(CURL_DISABLE_INSTALL "Set to ON to disable installation targets" ON)
option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" ON)
option(BUILD_LIBCURL_DOCS "to build libcurl man pages" OFF)
option(BUILD_MISC_DOCS "to build misc man pages (e.g. curl-config and mk-ca-bundle)" OFF)
option(ENABLE_CURL_MANUAL "to build the man page for curl and enable its -M/--manual option" OFF)
if(WIN32)
option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS" ON)
endif()
option(CURL_CA_FALLBACK "Set ON to use built-in CA store of TLS backend. Defaults to OFF" ON)
set(CURL_DISABLE_TESTS ON)
FetchContent_Declare(curl
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG fd567d4f06857f4fc8e2f64ea727b1318f76ad33 # release 8.8.0
Expand Down
4 changes: 2 additions & 2 deletions lang/system/en-gb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,15 @@ Some applications don't use this and get default confirmation button.</enter_but
<medium>Medium</medium>
<maximum>Maximum</maximum>
<detail>Detail</detail>
<select_detail>Select your preferred perfomance overlay detail.</select_detail>
<select_detail>Select your preferred performance overlay detail.</select_detail>
<top_left>Top Left</top_left>
<top_center>Top Center</top_center>
<top_right>Top Right</top_right>
<bottom_left>Bottom Left</bottom_left>
<bottom_center>Bottom Center</bottom_center>
<bottom_right>Bottom Right</bottom_right>
<position>Position</position>
<select_position>Select your preferred perfomance overlay position.</select_position>
<select_position>Select your preferred performance overlay position.</select_position>
<case_insensitive>Check to enable case-insensitive path finding on case sensitive filesystems.
RESETS ON RESTART</case_insensitive>
<case_insensitive_description>Allows emulator to attempt searching for files regardless of case
Expand Down
4 changes: 2 additions & 2 deletions lang/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,15 @@ Some applications don't use this and get default confirmation button.</enter_but
<medium>Medium</medium>
<maximum>Maximum</maximum>
<detail>Detail</detail>
<select_detail>Select your preferred perfomance overlay detail.</select_detail>
<select_detail>Select your preferred performance overlay detail.</select_detail>
<top_left>Top Left</top_left>
<top_center>Top Center</top_center>
<top_right>Top Right</top_right>
<bottom_left>Bottom Left</bottom_left>
<bottom_center>Bottom Center</bottom_center>
<bottom_right>Bottom Right</bottom_right>
<position>Position</position>
<select_position>Select your preferred perfomance overlay position.</select_position>
<select_position>Select your preferred performance overlay position.</select_position>
<case_insensitive>Check to enable case-insensitive path finding on case sensitive filesystems.
RESETS ON RESTART</case_insensitive>
<case_insensitive_description>Allows emulator to attempt searching for files regardless of case
Expand Down
2 changes: 1 addition & 1 deletion vita3k/audio/include/audio/impl/cubeb_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CubebAudioAdapter : public AudioAdapter {

public:
CubebAudioAdapter(AudioState &audio_state);
~CubebAudioAdapter();
~CubebAudioAdapter() override;

bool init() override;
AudioOutPortPtr open_port(int nb_channels, int freq, int nb_sample) override;
Expand Down
2 changes: 1 addition & 1 deletion vita3k/audio/include/audio/impl/sdl_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SDLAudioAdapter : public AudioAdapter {

public:
SDLAudioAdapter(AudioState &audio_state);
~SDLAudioAdapter();
~SDLAudioAdapter() override;

bool init() override;
void switch_state(const bool pause) override;
Expand Down
2 changes: 1 addition & 1 deletion vita3k/audio/src/impl/cubeb_audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ AudioOutPortPtr CubebAudioAdapter::open_port(int nb_channels, int freq, int nb_s
const int nb_buffers = (latency + nb_sample - 1) / nb_sample + 1;
port->audio_buffers.resize(nb_buffers);
for (AudioBuffer &audio_buffer : port->audio_buffers) {
// initialize all of the buffers
// initialize all the buffers
audio_buffer.buffer.resize(port->len_bytes);
audio_buffer.buffer_position = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion vita3k/codec/src/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DecoderState::~DecoderState() {
avcodec_free_context(&context);
}

// Handy to have this in logs, some debuggers dont seem to be able to evaluate there error macros properly.
// Handy to have this in logs, some debuggers don't seem to be able to evaluate there error macros properly.
std::string codec_error_name(int error) {
switch (error) {
case AVERROR(EAGAIN):
Expand Down
2 changes: 1 addition & 1 deletion vita3k/codec/src/pcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ bool PCMDecoderState::send(const uint8_t *data, uint32_t size) {
produced_samples = size / sizeof(std::int16_t) / source_channels;
}

// Try to resample if neccessary
// Try to resample if necessary
SwrContext *swr = (source_channels == 2) ? swr_stereo : swr_mono_to_stereo;

const int dest_count = swr_get_out_samples(swr, produced_samples);
Expand Down
8 changes: 4 additions & 4 deletions vita3k/config/include/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ enum ModulesMode {
MANUAL
};

enum PerfomanceOverleyDetail {
enum PerformanceOverlayDetail {
MINIMUM,
LOW,
MEDIUM,
MAXIMUM,
};

enum PerfomanceOverleyPosition {
enum PerformanceOverlayPosition {
TOP_LEFT,
TOP_CENTER,
TOP_RIGHT,
Expand Down Expand Up @@ -107,8 +107,8 @@ enum ScreenshotFormat {
code(bool, "color-surface-debug", false, color_surface_debug) \
code(bool, "show-touchpad-cursor", true, show_touchpad_cursor) \
code(bool, "performance-overlay", false, performance_overlay) \
code(int, "perfomance-overlay-detail", static_cast<int>(MINIMUM), performance_overlay_detail) \
code(int, "perfomance-overlay-position", static_cast<int>(TOP_LEFT), performance_overlay_position) \
code(int, "performance-overlay-detail", static_cast<int>(MINIMUM), performance_overlay_detail) \
code(int, "performance-overlay-position", static_cast<int>(TOP_LEFT), performance_overlay_position) \
code(int, "screenshot-format", static_cast<int>(JPEG), screenshot_format) \
code(bool, "disable-motion", false, disable_motion) \
code(int, "keyboard-button-select", 229, keyboard_button_select) \
Expand Down
4 changes: 2 additions & 2 deletions vita3k/cpu/include/cpu/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#pragma once

#include <fmt/format.h>
#include <mem/ptr.h> // Address.
#include <mem/util.h> // Address.

#include <array>
#include <cstdint>
Expand All @@ -43,7 +43,7 @@ typedef void *ExclusiveMonitorPtr;
struct CPUProtocolBase {
virtual void call_svc(CPUState &cpu, uint32_t svc, Address pc, ThreadState &thread) = 0;
virtual Address get_watch_memory_addr(Address addr) = 0;
virtual ExclusiveMonitorPtr get_exlusive_monitor() = 0;
virtual ExclusiveMonitorPtr get_exclusive_monitor() = 0;
virtual ~CPUProtocolBase() = default;
};

Expand Down
1 change: 0 additions & 1 deletion vita3k/cpu/include/cpu/impl/dynarmic_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#pragma once

#include <dynarmic/interface/A32/a32.h>
#include <dynarmic/interface/A32/coprocessor.h>
#include <dynarmic/interface/exclusive_monitor.h>

#include <cpu/functions.h>
Expand Down
1 change: 1 addition & 0 deletions vita3k/cpu/include/cpu/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cpu/common.h>
#include <cpu/disasm/state.h>
#include <cpu/functions.h>
#include <mem/block.h>

struct CPUState {
CPUState() = default;
Expand Down
2 changes: 1 addition & 1 deletion vita3k/cpu/src/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CPUStatePtr init_cpu(CPUBackend backend, bool cpu_opt, SceUID thread_id, std::si

switch (backend) {
case CPUBackend::Dynarmic: {
Dynarmic::ExclusiveMonitor *monitor = static_cast<Dynarmic::ExclusiveMonitor *>(protocol->get_exlusive_monitor());
Dynarmic::ExclusiveMonitor *monitor = static_cast<Dynarmic::ExclusiveMonitor *>(protocol->get_exclusive_monitor());
state->cpu = std::make_unique<DynarmicCPU>(state.get(), processor_id, monitor, cpu_opt);
break;
}
Expand Down
1 change: 1 addition & 0 deletions vita3k/cpu/src/dynarmic_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <mem/ptr.h>

#include <dynarmic/frontend/A32/a32_ir_emitter.h>
#include <dynarmic/interface/A32/coprocessor.h>

class ArmDynarmicCP15 : public Dynarmic::A32::Coprocessor {
uint32_t tpidruro;
Expand Down
25 changes: 0 additions & 25 deletions vita3k/cpu/src/read_arg.cpp

This file was deleted.

2 changes: 2 additions & 0 deletions vita3k/cpu/src/unicorn_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#include <cpu/functions.h>
#include <cpu/impl/unicorn_cpu.h>
#include <mem/functions.h>
#include <mem/ptr.h>
#include <mem/util.h>
#include <util/log.h>

#include <cassert>
Expand Down
10 changes: 5 additions & 5 deletions vita3k/gui/src/common_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ static void draw_trophy_setup_dialog(DialogState &common_dialog, float FONT_SCAL
}
}

static std::string get_save_date_time(SceSystemParamDateFormat date_fromat, const SceDateTime &date_time) {
static std::string get_save_date_time(SceSystemParamDateFormat date_format, const SceDateTime &date_time) {
std::string date_str;
switch (date_fromat) {
switch (date_format) {
case SCE_SYSTEM_PARAM_DATE_FORMAT_YYYYMMDD:
date_str = fmt::format("{}/{}/{}", date_time.year, date_time.month, date_time.day);
break;
Expand Down Expand Up @@ -615,12 +615,12 @@ static void draw_savedata_dialog(GuiState &gui, EmuEnvState &emuenv, float FONT_
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 12.f * SCALE.x);
const auto BUTTON_SIZE_HEIGHT = 46.f * SCALE.y;
const ImVec2 buttons_size(320.f * SCALE.x, BUTTON_SIZE_HEIGHT);
const auto boutton_height_pos = WINDOW_SIZE.y - BUTTON_SIZE_HEIGHT - (22 * SCALE.y);
const auto boutton_width_pos = HALF_WINDOW_SIZE.x - (emuenv.common_dialog.savedata.btn_num == 2 ? (buttons_size.x + (20.f * SCALE.x)) : (buttons_size.x / 2.f));
const auto button_height_pos = WINDOW_SIZE.y - BUTTON_SIZE_HEIGHT - (22 * SCALE.y);
const auto button_width_pos = HALF_WINDOW_SIZE.x - (emuenv.common_dialog.savedata.btn_num == 2 ? (buttons_size.x + (20.f * SCALE.x)) : (buttons_size.x / 2.f));
ImGui::BeginGroup();
for (int i = 0; i < emuenv.common_dialog.savedata.btn_num; i++) {
ImGui::PushID(i);
const ImVec2 button_id_pos(boutton_width_pos + (i * (buttons_size.x + (40.f * SCALE.x))), boutton_height_pos);
const ImVec2 button_id_pos(button_width_pos + (i * (buttons_size.x + (40.f * SCALE.x))), button_height_pos);
ImGui::SetCursorPos(button_id_pos);
if (ImGui::Button(emuenv.common_dialog.savedata.btn[i].c_str(), buttons_size)) {
emuenv.common_dialog.savedata.button_id = emuenv.common_dialog.savedata.btn_val[i];
Expand Down
2 changes: 1 addition & 1 deletion vita3k/gui/src/ime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void init_ime_lang(Ime &ime, const SceImeLanguage &lang) {
size_button = 135.f;
size_key = 88.f;
break;
};
}
}

static std::map<int, float> key_row_pos = { { FIRST, 11.f }, { SECOND, 69.f }, { THIRD, 127.f } };
Expand Down
2 changes: 1 addition & 1 deletion vita3k/gui/src/information_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ void draw_information_bar(GuiState &gui, EmuEnvState &emuenv) {
battery_size /= 100.f;
}

// Set battery color depending on battery level: red for levels below or egale 25% and green for levels above this threshold.
// Set battery color depending on battery level: red for levels less than or equal to 25% and green for levels above this threshold.
const ImU32 BATTERY_COLOR = (res >= 0) && (res <= 25) ? IM_COL32(225.f, 50.f, 50.f, 255.f) : IM_COL32(90.f, 200.f, 30.f, 255.f);

// Draw battery level
Expand Down
8 changes: 4 additions & 4 deletions vita3k/gui/src/manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ void draw_manual(GuiState &gui, EmuEnvState &emuenv) {
const std::string slider = fmt::format("{:0>2d}/{:0>2d}", current_page + 1, (int32_t)gui.manuals.size());
if (ImGui::Button(slider.c_str(), BUTTON_SIZE))
ImGui::OpenPopup("Manual Slider");
const auto POPUP_HEIGTH = 64.f * SCALE.y;
ImGui::SetNextWindowPos(ImVec2(0.f, display_size.y - POPUP_HEIGTH), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(display_size.x, POPUP_HEIGTH), ImGuiCond_Always);
const auto POPUP_HEIGHT = 64.f * SCALE.y;
ImGui::SetNextWindowPos(ImVec2(0.f, display_size.y - POPUP_HEIGHT), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(display_size.x, POPUP_HEIGHT), ImGuiCond_Always);
ImGui::SetNextWindowBgAlpha(0.7f);
if (ImGui::BeginPopupModal("Manual Slider", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
const auto SLIDER_WIDTH = 800.f * SCALE.x;
ImGui::PushItemWidth(SLIDER_WIDTH);
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 26.f * SCALE.y);
ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, 50.f * SCALE.y);
ImGui::SetCursorPos(ImVec2((display_size.x / 2) - (SLIDER_WIDTH / 2.f), (POPUP_HEIGTH / 2) - (15.f * SCALE.x)));
ImGui::SetCursorPos(ImVec2((display_size.x / 2) - (SLIDER_WIDTH / 2.f), (POPUP_HEIGHT / 2) - (15.f * SCALE.x)));
ImGui::SliderInt("##slider_current_manual", &current_page, 0, (int32_t)gui.manuals.size() - 1, slider.c_str());
ImGui::PopStyleVar(2);
ImGui::PopItemWidth();
Expand Down
6 changes: 3 additions & 3 deletions vita3k/gui/src/perf_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ void draw_perf_overlay(GuiState &gui, EmuEnvState &emuenv) {
ImGui::BeginChild("#perf_stats", WINDOW_SIZE, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings);
ImGui::PushFont(gui.vita_font);
ImGui::SetWindowFontScale(0.7f * RES_SCALE.x);
if (emuenv.cfg.performance_overlay_detail == PerfomanceOverleyDetail::MINIMUM)
if (emuenv.cfg.performance_overlay_detail == PerformanceOverlayDetail::MINIMUM)
ImGui::Text("FPS: %d", emuenv.fps);
else
ImGui::Text("FPS: %d %s: %d", emuenv.fps, lang["avg"].c_str(), emuenv.avg_fps);
if (emuenv.cfg.performance_overlay_detail >= PerfomanceOverleyDetail::MEDIUM) {
if (emuenv.cfg.performance_overlay_detail >= PerformanceOverlayDetail::MEDIUM) {
ImGui::Separator();
ImGui::Text("%s: %d %s: %d", lang["min"].c_str(), emuenv.min_fps, lang["max"].c_str(), emuenv.max_fps);
}
ImGui::PopFont();
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
if (emuenv.cfg.performance_overlay_detail == PerfomanceOverleyDetail::MAXIMUM) {
if (emuenv.cfg.performance_overlay_detail == PerformanceOverlayDetail::MAXIMUM) {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - (3.f * SCALE.y));
ImGui::PlotLines("##fps_graphic", emuenv.fps_values, IM_ARRAYSIZE(emuenv.fps_values), emuenv.current_fps_offset, nullptr, 0.f, float(emuenv.max_fps), WINDOW_SIZE);
}
Expand Down
4 changes: 2 additions & 2 deletions vita3k/gui/src/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,8 @@ void draw_settings_dialog(GuiState &gui, EmuEnvState &emuenv) {
ImGui::Checkbox(lang.emulator["check_for_updates"].c_str(), &emuenv.cfg.check_for_updates);
SetTooltipEx(lang.emulator["check_for_updates_description"].c_str());
ImGui::Separator();
const auto perfomance_overley_size = ImGui::CalcTextSize(lang.emulator["performance_overlay"].c_str()).x;
ImGui::SetCursorPosX((ImGui::GetWindowWidth() / 2.f) - (perfomance_overley_size / 2.f));
const auto performance_overlay_size = ImGui::CalcTextSize(lang.emulator["performance_overlay"].c_str()).x;
ImGui::SetCursorPosX((ImGui::GetWindowWidth() / 2.f) - (performance_overlay_size / 2.f));
ImGui::TextColored(GUI_COLOR_TEXT_TITLE, "%s", lang.emulator["performance_overlay"].c_str());
ImGui::Spacing();
ImGui::Checkbox(lang.emulator["performance_overlay"].c_str(), &emuenv.cfg.performance_overlay);
Expand Down
Loading

0 comments on commit 612d1f8

Please sign in to comment.