headers and packaging stuff

This commit is contained in:
staturnz committed 2023-04-07 09:59:14 -05:00
1 parent cee71af2a6
commit e5a618682f
4 files changed
+121

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#ifndef COMMON_H
#define COMMON_H
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
extern "C" {
#include <palerain.h>
#include <gui.h>
}
#define DISCONNECTED 0
#define NORMAL 1
#define RECOVERY 2
#define DFU 3
#define rest(a) std::this_thread::sleep_for(std::chrono::seconds(a))
#define FLOAT_TO_INT(x) ((x)>=0?(int)((x)+0.5):(int)((x)-0.5))
void guifree(void);
void dfuhelper();
void send_alert(const char *title, const char *msg);
extern devinfo_t dev;
extern bool waiting_for_device;
extern bool unsupported_device;
extern bool supported_device;
extern bool recovery_wait;
extern bool jailbreak;
extern bool enter_dfu;
extern bool dfu_helper;
extern int device_status;
#endif
+55
View File
@@ -0,0 +1,55 @@
#ifndef DESIGN_H
#define DESIGN_H
#define set_pos(a,b) ImGui::SetCursorPos(ImVec2(a,b))
#define font(a) ImGui::PushFont(io.Fonts->Fonts[a])
#define btn_text_on colors[ImGuiCol_Text] = ImVec4{.05f, .05f, .05f, 1.0f}
#define btn_text_off colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
#define dfu_text_light colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
#define dfu_text_dark colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 0.3f}
#define size(x,y) ImVec2(x,y)
#define pos(x,y) ImVec2(x,y)
/* Fonts we have loaded into memory */
#define SF_Reg 0
#define SF_Med 2
#define SF_Bold 1
#define SF_Sm_Bold 3
#define Hack 4
#define SF_RoundBold 5
#define SF_RegMed 6
#define SF_BoldLarge 7
#define WHITE ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
void ImageRotated(ImTextureID tex_id, ImVec2 center, ImVec2 size, float angle);
void draw_box(ImVec2 location, ImVec2 size, ImVec4 color, float radius);
void reset_design(void);
void reset_views(void);
bool is_hovered(const char* id, int w, int h);
bool is_pressed(const char* id, int w, int h);
void anim_btn(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to);
void anim_box(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to);
void label(const char *text, ImVec2 location, ImVec4 color, int font);
void rotate_image(const char *image, ImVec2 pos, ImVec2 size, float angle, float speed);
std::string addstr2(const char *str1, const char *str2);
std::string addstr3(const char *str1, const char *str2, const char *str3);
std::string addstr4(const char *str1, const char *str2, const char *str3, const char *str4);
void image_btn_style_alt(void);
void init_style(void);
void init_colors(void);
ImVec4 hex_color(int hex, float alpha);
ImColor hex_imcolor(int hex, float alpha);
void image_btn_style();
extern float btn_w;
extern float btn_h;
extern float btn_x;
extern float btn_y;
extern float box_w;
extern float box_h;
extern float box_x;
extern float box_y;
#endif