mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
turn into valid c99
This commit is contained in:
1 parent
a6f8181211
commit
907ac98c9c
6 files changed
+71
-66
No files matched your search
@@ -4,7 +4,7 @@ STRIP = strip
|
|||||||
CC ?= cc
|
CC ?= cc
|
||||||
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
||||||
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
|
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
|
||||||
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99
|
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread
|
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread
|
||||||
ifeq ($(TARGET_OS),)
|
ifeq ($(TARGET_OS),)
|
||||||
|
|||||||
+59
-59
@@ -8,78 +8,78 @@
|
|||||||
#define ANSI_COLOR_CODES_H
|
#define ANSI_COLOR_CODES_H
|
||||||
|
|
||||||
//Regular text
|
//Regular text
|
||||||
#define BLK "\e[0;30m"
|
#define BLK "\033[0;30m"
|
||||||
#define RED "\e[0;31m"
|
#define RED "\033[0;31m"
|
||||||
#define GRN "\e[0;32m"
|
#define GRN "\033[0;32m"
|
||||||
#define YEL "\e[0;33m"
|
#define YEL "\033[0;33m"
|
||||||
#define BLU "\e[0;34m"
|
#define BLU "\033[0;34m"
|
||||||
#define MAG "\e[0;35m"
|
#define MAG "\033[0;35m"
|
||||||
#define CYN "\e[0;36m"
|
#define CYN "\033[0;36m"
|
||||||
#define WHT "\e[0;37m"
|
#define WHT "\033[0;37m"
|
||||||
|
|
||||||
//Regular bold text
|
//Regular bold text
|
||||||
#define BBLK "\e[1;30m"
|
#define BBLK "\033[1;30m"
|
||||||
#define BRED "\e[1;31m"
|
#define BRED "\033[1;31m"
|
||||||
#define BGRN "\e[1;32m"
|
#define BGRN "\033[1;32m"
|
||||||
#define BYEL "\e[1;33m"
|
#define BYEL "\033[1;33m"
|
||||||
#define BBLU "\e[1;34m"
|
#define BBLU "\033[1;34m"
|
||||||
#define BMAG "\e[1;35m"
|
#define BMAG "\033[1;35m"
|
||||||
#define BCYN "\e[1;36m"
|
#define BCYN "\033[1;36m"
|
||||||
#define BWHT "\e[1;37m"
|
#define BWHT "\033[1;37m"
|
||||||
|
|
||||||
//Regular underline text
|
//Regular underline text
|
||||||
#define UBLK "\e[4;30m"
|
#define UBLK "\033[4;30m"
|
||||||
#define URED "\e[4;31m"
|
#define URED "\033[4;31m"
|
||||||
#define UGRN "\e[4;32m"
|
#define UGRN "\033[4;32m"
|
||||||
#define UYEL "\e[4;33m"
|
#define UYEL "\033[4;33m"
|
||||||
#define UBLU "\e[4;34m"
|
#define UBLU "\033[4;34m"
|
||||||
#define UMAG "\e[4;35m"
|
#define UMAG "\033[4;35m"
|
||||||
#define UCYN "\e[4;36m"
|
#define UCYN "\033[4;36m"
|
||||||
#define UWHT "\e[4;37m"
|
#define UWHT "\033[4;37m"
|
||||||
|
|
||||||
//Regular background
|
//Regular background
|
||||||
#define BLKB "\e[40m"
|
#define BLKB "\033[40m"
|
||||||
#define REDB "\e[41m"
|
#define REDB "\033[41m"
|
||||||
#define GRNB "\e[42m"
|
#define GRNB "\033[42m"
|
||||||
#define YELB "\e[43m"
|
#define YELB "\033[43m"
|
||||||
#define BLUB "\e[44m"
|
#define BLUB "\033[44m"
|
||||||
#define MAGB "\e[45m"
|
#define MAGB "\033[45m"
|
||||||
#define CYNB "\e[46m"
|
#define CYNB "\033[46m"
|
||||||
#define WHTB "\e[47m"
|
#define WHTB "\033[47m"
|
||||||
|
|
||||||
//High intensty background
|
//High intensty background
|
||||||
#define BLKHB "\e[0;100m"
|
#define BLKHB "\033[0;100m"
|
||||||
#define REDHB "\e[0;101m"
|
#define REDHB "\033[0;101m"
|
||||||
#define GRNHB "\e[0;102m"
|
#define GRNHB "\033[0;102m"
|
||||||
#define YELHB "\e[0;103m"
|
#define YELHB "\033[0;103m"
|
||||||
#define BLUHB "\e[0;104m"
|
#define BLUHB "\033[0;104m"
|
||||||
#define MAGHB "\e[0;105m"
|
#define MAGHB "\033[0;105m"
|
||||||
#define CYNHB "\e[0;106m"
|
#define CYNHB "\033[0;106m"
|
||||||
#define WHTHB "\e[0;107m"
|
#define WHTHB "\033[0;107m"
|
||||||
|
|
||||||
//High intensty text
|
//High intensty text
|
||||||
#define HBLK "\e[0;90m"
|
#define HBLK "\033[0;90m"
|
||||||
#define HRED "\e[0;91m"
|
#define HRED "\033[0;91m"
|
||||||
#define HGRN "\e[0;92m"
|
#define HGRN "\033[0;92m"
|
||||||
#define HYEL "\e[0;93m"
|
#define HYEL "\033[0;93m"
|
||||||
#define HBLU "\e[0;94m"
|
#define HBLU "\033[0;94m"
|
||||||
#define HMAG "\e[0;95m"
|
#define HMAG "\033[0;95m"
|
||||||
#define HCYN "\e[0;96m"
|
#define HCYN "\033[0;96m"
|
||||||
#define HWHT "\e[0;97m"
|
#define HWHT "\033[0;97m"
|
||||||
|
|
||||||
//Bold high intensity text
|
//Bold high intensity text
|
||||||
#define BHBLK "\e[1;90m"
|
#define BHBLK "\033[1;90m"
|
||||||
#define BHRED "\e[1;91m"
|
#define BHRED "\033[1;91m"
|
||||||
#define BHGRN "\e[1;92m"
|
#define BHGRN "\033[1;92m"
|
||||||
#define BHYEL "\e[1;93m"
|
#define BHYEL "\033[1;93m"
|
||||||
#define BHBLU "\e[1;94m"
|
#define BHBLU "\033[1;94m"
|
||||||
#define BHMAG "\e[1;95m"
|
#define BHMAG "\033[1;95m"
|
||||||
#define BHCYN "\e[1;96m"
|
#define BHCYN "\033[1;96m"
|
||||||
#define BHWHT "\e[1;97m"
|
#define BHWHT "\033[1;97m"
|
||||||
|
|
||||||
//Reset
|
//Reset
|
||||||
#define reset "\e[0m"
|
#define reset "\033[0m"
|
||||||
#define CRESET "\e[0m"
|
#define CRESET "\033[0m"
|
||||||
#define COLOR_RESET "\e[0m"
|
#define COLOR_RESET "\033[0m"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
#ifndef PALERAIN_H
|
#ifndef PALERAIN_H
|
||||||
#define PALERAIN_H
|
#define PALERAIN_H
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "xxd-embedded.h"
|
#include "xxd-embedded.h"
|
||||||
#include "kerninfo.h"
|
#include "kerninfo.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|||||||
+2
-2
@@ -36,7 +36,7 @@ int dfuhelper_thr_running = false;
|
|||||||
|
|
||||||
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
||||||
for (int i = time2; i < time; i++) {
|
for (int i = time2; i < time; i++) {
|
||||||
printf(CYN "\r\e[K%s (%d)" CRESET, text, time - i + time2);
|
printf(CYN "\r\033[K%s (%d)" CRESET, text, time - i + time2);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
||||||
@@ -119,7 +119,7 @@ void* connected_recovery_mode(struct irecv_device_info* info) {
|
|||||||
set_ecid_wait_for_dfu(0);
|
set_ecid_wait_for_dfu(0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
printf("\r\e[K");
|
printf("\r\033[K");
|
||||||
bool nohome = NOHOME;
|
bool nohome = NOHOME;
|
||||||
if (nohome)
|
if (nohome)
|
||||||
step(2, 0, "Hold volume down + side button", NULL, 0);
|
step(2, 0, "Hold volume down + side button", NULL, 0);
|
||||||
|
|||||||
+3
-2
@@ -1,3 +1,5 @@
|
|||||||
|
#include <palerain.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -12,7 +14,6 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <palerain.h>
|
|
||||||
|
|
||||||
int override_file(override_file_t *finfo, niarelap_file_t** orig, unsigned int *orig_len, char *filename) {
|
int override_file(override_file_t *finfo, niarelap_file_t** orig, unsigned int *orig_len, char *filename) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -46,4 +47,4 @@ int override_file(override_file_t *finfo, niarelap_file_t** orig, unsigned int *
|
|||||||
*orig_len = (unsigned int)st.st_size;
|
*orig_len = (unsigned int)st.st_size;
|
||||||
LOG(LOG_VERBOSE5, "override_file() finished!");
|
LOG(LOG_VERBOSE5, "override_file() finished!");
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
+2
-2
@@ -196,7 +196,7 @@ static int LostDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_ev
|
|||||||
|
|
||||||
int wait_for_pongo(void)
|
int wait_for_pongo(void)
|
||||||
{
|
{
|
||||||
stuff_t stuff = {};
|
stuff_t stuff;
|
||||||
libusb_hotplug_callback_handle hp[2];
|
libusb_hotplug_callback_handle hp[2];
|
||||||
|
|
||||||
int r = libusb_init(NULL);
|
int r = libusb_init(NULL);
|
||||||
@@ -240,7 +240,7 @@ int wait_for_pongo(void)
|
|||||||
|
|
||||||
for(ssize_t i = 0; i < sz; ++i)
|
for(ssize_t i = 0; i < sz; ++i)
|
||||||
{
|
{
|
||||||
struct libusb_device_descriptor desc = {};
|
struct libusb_device_descriptor desc;
|
||||||
r = libusb_get_device_descriptor(list[i], &desc);
|
r = libusb_get_device_descriptor(list[i], &desc);
|
||||||
if(r != LIBUSB_SUCCESS)
|
if(r != LIBUSB_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user