General cleanup (#272)

* Cleanup unused struct fields, use uniform include guards
pull/264/head
larskraemer 4 years ago committed by GitHub
parent 8eba5e2ed2
commit a28931ef6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_BLACKLIST_H
#define MANGOHUD_BLACKLIST_H
bool is_blacklisted(bool force_recheck = false);
#endif //MANGOHUD_BLACKLIST_H

@ -1,2 +1,8 @@
#pragma once
#ifndef MANGOHUD_CONFIG_H
#define MANGOHUD_CONFIG_H
#include "overlay_params.h"
void parseConfigFile(overlay_params& p);
#endif //MANGOHUD_CONFIG_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_CPU_H
#define MANGOHUD_CPU_H
#include <vector>
#include <cstdint>
#include <cstdio>
@ -68,3 +72,5 @@ private:
};
extern CPUStats cpuStats;
#endif //MANGOHUD_CPU_H

@ -1,4 +1,7 @@
#pragma once
#ifndef MANGOHUD_DBUS_INFO_H
#define MANGOHUD_DBUS_INFO_H
#include <array>
#include <stdexcept>
#include <thread>
@ -135,3 +138,5 @@ namespace dbusmgr {
}
bool get_media_player_metadata(dbusmgr::dbus_manager& dbus, const std::string& name, metadata& meta);
#endif //MANGOHUD_DBUS_INFO_H

@ -1,4 +1,7 @@
#pragma once
#ifndef MANGOHUD_FILE_UTILS_H
#define MANGOHUD_FILE_UTILS_H
#include <string>
#include <vector>
@ -21,3 +24,5 @@ bool get_wine_exe_name(std::string& name, bool keep_ext = false);
std::string get_home_dir();
std::string get_data_dir();
std::string get_config_dir();
#endif //MANGOHUD_FILE_UTILS_H

@ -1,5 +1,6 @@
#ifndef FONT_DEFAULT_H
#define FONT_DEFAULT_H
#pragma once
#ifndef MANGOHUD_FONT_DEFAULT_H
#define MANGOHUD_FONT_DEFAULT_H
#ifdef __cplusplus
extern "C" {
@ -11,4 +12,4 @@ const char* GetDefaultCompressedFontDataTTFBase85(void);
}
#endif
#endif
#endif // MANGOHUD_FONT_DEFAULT_H

@ -1,8 +1,10 @@
#pragma once
#ifndef MANGOHUD_GL_GL_H
#define MANGOHUD_GL_GL_H
#ifdef __cplusplus
extern "C" {
#endif
#endif //__cplusplus
void * glXCreateContext(void *, void *, void *, int);
void glXDestroyContext(void *, void*);
@ -24,4 +26,6 @@ unsigned int eglSwapBuffers( void*, void* );
#ifdef __cplusplus
}
#endif
#endif //__cplusplus
#endif //MANGOHUD_GL_GL_H

@ -1,4 +1,6 @@
#pragma once
#ifndef MANGOHUD_GL_IMGUI_HUD_H
#define MANGOHUD_GL_IMGUI_HUD_H
#include "overlay.h"
#include "imgui_impl_opengl3.h"
@ -13,3 +15,5 @@ void imgui_set_context(void *ctx);
void imgui_render(unsigned int width, unsigned int height);
}} // namespace
#endif //MANGOHUD_GL_IMGUI_HUD_H

@ -22,6 +22,8 @@
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
#pragma once
#ifndef MANGOHUD_IMGUI_IMPL_OPENGL3_H
#define MANGOHUD_IMGUI_IMPL_OPENGL3_H
namespace MangoHud {
@ -40,3 +42,5 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
//IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
}
#endif //MANGOHUD_IMGUI_IMPL_OPENGL3_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_GPU_H
#define MANGOHUD_GPU_H
#include <thread>
#include <inttypes.h>
#include <stdlib.h>
@ -34,3 +38,5 @@ extern struct gpuInfo gpu_info;
void getNvidiaGpuInfo(void);
void getAmdGpuInfo(void);
#endif //MANGOHUD_GPU_H

@ -1,4 +1,7 @@
#pragma once
#ifndef MANGOHUD_IOSTATS_H
#define MANGOHUD_IOSTATS_H
#include <pthread.h>
#include <inttypes.h>
@ -18,3 +21,5 @@ struct iostats {
};
void getIoStats(void *args);
#endif //MANGOHUD_IOSTATS_H

@ -1,4 +1,7 @@
#pragma once
#ifndef MANGOHUD_KEYBINDS_H
#define MANGOHUD_KEYBINDS_H
#include "shared_x11.h"
#include "loaders/loader_x11.h"
@ -34,4 +37,6 @@ bool keys_are_pressed(const std::vector<KeySym>& keys) {
return false;
}
#endif
#endif //HAVE_X11
#endif //MANGOHUD_KEYBINDS_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_LOGGING_H
#define MANGOHUD_LOGGING_H
#include <iostream>
#include <vector>
#include <fstream>
@ -67,3 +71,5 @@ extern double fps;
extern logData currentLogData;
string exec(string command);
#endif //MANGOHUD_LOGGING_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_MEMORY_H
#define MANGOHUD_MEMORY_H
#include <stdio.h>
#include <thread>
@ -13,3 +17,5 @@ struct memory_information {
void update_meminfo(void);
FILE *open_file(const char *file, int *reported);
#endif //MANGOHUD_MEMORY_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_NOTIFY_H
#define MANGOHUD_NOTIFY_H
#include <thread>
#include <mutex>
#include "overlay_params.h"
@ -13,3 +17,5 @@ struct notify_thread
bool start_notifier(notify_thread& nt);
void stop_notifier(notify_thread& nt);
#endif //MANGOHUD_NOTIFY_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_NVCTRL_H
#define MANGOHUD_NVCTRL_H
struct nvctrlInfo{
int load;
int temp;
@ -12,3 +16,5 @@ extern bool nvctrlSuccess;
bool checkXNVCtrl(void);
void getNvctrlInfo(void);
char *get_attr_target_string(int attr, int target_type, int target_id);
#endif //MANGOHUD_NVCTRL_H

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_NVIDIA_INFO_H
#define MANGOHUD_NVIDIA_INFO_H
#include <nvml.h>
extern nvmlReturn_t result;
@ -9,3 +13,5 @@ extern bool nvmlSuccess;
bool checkNVML(const char* pciBusId);
bool getNVMLInfo(void);
#endif //MANGOHUD_NVIDIA_INFO_H

@ -79,21 +79,8 @@ struct benchmark_stats benchmark;
struct instance_data {
struct vk_instance_dispatch_table vtable;
VkInstance instance;
struct overlay_params params;
uint32_t api_version;
bool first_line_printed;
int control_client;
/* Dumping of frame stats to a file has been enabled. */
bool capture_enabled;
/* Dumping of frame stats to a file has been enabled and started. */
bool capture_started;
string engineName, engineVersion;
notify_thread notifier;
};
@ -192,23 +179,7 @@ struct swapchain_data {
ImGuiContext* imgui_context;
ImVec2 window_size;
/**/
uint64_t last_present_time;
unsigned n_frames_since_update;
uint64_t last_fps_update;
double frametime;
double frametimeDisplay;
const char* cpuString;
const char* gpuString;
struct swapchain_stats sw_stats;
/* Over a single frame */
struct frame_stat frame_stats;
/* Over fps_sampling_period */
struct frame_stat accumulated_stats;
};
// single global lock, for simplicity
@ -358,7 +329,6 @@ static struct instance_data *new_instance_data(VkInstance instance)
{
struct instance_data *data = new instance_data();
data->instance = instance;
data->control_client = -1;
data->params = {};
data->params.control = -1;
map_object(HKEY(data->instance), data);

@ -1,4 +1,6 @@
#pragma once
#ifndef MANGOHUD_OVERLAY_H
#define MANGOHUD_OVERLAY_H
#include <string>
#include <stdint.h>
@ -81,3 +83,5 @@ void imgui_custom_style(struct overlay_params& params);
void get_device_name(int32_t vendorID, int32_t deviceID, struct swapchain_stats& sw_stats);
void calculate_benchmark_data(void);
void create_fonts(const overlay_params& params, ImFont*& small_font, ImFont*& text_font);
#endif //MANGOHUD_OVERLAY_H

@ -1,5 +1,6 @@
#ifndef OVERLAY_PARAMS_H
#define OVERLAY_PARAMS_H
#pragma once
#ifndef MANGOHUD_OVERLAY_PARAMS_H
#define MANGOHUD_OVERLAY_PARAMS_H
#include <string>
#include <vector>
@ -189,4 +190,4 @@ void parse_overlay_config(struct overlay_params *params,
}
#endif
#endif /* OVERLAY_PARAMS_H */
#endif /* MANGOHUD_OVERLAY_PARAMS_H */

@ -1,3 +1,7 @@
#pragma once
#ifndef MANGOHUD_PCI_IDS_H
#define MANGOHUD_PCI_IDS_H
#include <map>
#include <vector>
@ -17,3 +21,5 @@ struct device
extern std::map<uint32_t /*vendor id*/, std::pair<std::string /*vendor desc*/, std::map<uint32_t /*device id*/, device>>> pci_ids;
void parse_pciids(void);
#endif //MANGOHUD_PCI_IDS_H

@ -1,7 +1,11 @@
#pragma once
#ifndef MANGOHUD_REAL_DLSYM_H
#define MANGOHUD_REAL_DLSYM_H
#define EXPORT_C_(type) extern "C" __attribute__((__visibility__("default"))) type
void *real_dlopen(const char *filename, int flag);
void* real_dlsym( void*, const char* );
void* get_proc_address(const char* name);
#endif //MANGOHUD_REAL_DLSYM_H

@ -1,5 +1,10 @@
#pragma once
#ifndef MANGOHUD_SHARED_X11_H
#define MANGOHUD_SHARED_X11_H
#include <X11/Xlib.h>
Display* get_xdisplay();
bool init_x11();
#endif //MANGOHUD_SHARED_X11_H

@ -1,4 +1,7 @@
#pragma once
#ifndef MANGOHUD_STRING_UTILS_H
#define MANGOHUD_STRING_UTILS_H
#include <string>
#include <iomanip>
#include <iostream>
@ -107,3 +110,5 @@ static float parse_float(const std::string& s, std::size_t* float_len = nullptr)
}
#pragma GCC diagnostic pop
#endif //MANGOHUD_STRING_UTILS_H

@ -1,5 +1,7 @@
#pragma once
#ifndef MANGOHUD_TIMING_HPP
#define MANGOHUD_TIMING_HPP
#include <chrono>
#include "mesa/util/os_time.h"
@ -17,4 +19,5 @@ public:
};
using Clock = MesaClock;
#endif //MANGOHUD_TIMING_HPP
#endif //MANGOHUD_TIMING_HPP

Loading…
Cancel
Save