Skip to content

Instantly share code, notes, and snippets.

View petabyt's full-sized avatar

Daniel C petabyt

View GitHub Profile
@petabyt
petabyt / gist:7e3d03fc27cf0cc0db00841c6227acd8
Created December 28, 2023 20:43
gimp_label_set_attributes
void
gimp_label_set_attributes (GtkLabel *label,
...)
{
PangoAttribute *attr = NULL;
PangoAttrList *attrs;
va_list args;
g_return_if_fail (GTK_IS_LABEL (label));
@petabyt
petabyt / json.c
Last active December 27, 2023 00:34
Tiny JSON Parser in C, no malloc - 200 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define JSON_OBJ '{'
#define JSON_ARR '['
#define JSON_STR 's'
#define JSON_NUM 'n'
#define JSON_END_OBJ '}'
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define JSON_OBJ '{'
#define JSON_ARR '['
#define JSON_STR 's'
#define JSON_NUM 'n'
#define JSON_END_OBJ '}'
QuerySizeOfTransparentMemory
Require data phase == 0x40 bytes
struct {
uint8_t size;
char name[16];
uint32_t res0;
}
// From gphoto ptp.h
#define PTP_OC_FUJI_InitiateMovieCapture 0x9020
#define PTP_OC_FUJI_TerminateMovieCapture 0x9021
#define PTP_OC_FUJI_GetCapturePreview 0x9022
#define PTP_OC_FUJI_StepZoom 0x9023
#define PTP_OC_FUJI_StartZoom 0x9024
#define PTP_OC_FUJI_StopZoom 0x9025
#define PTP_OC_FUJI_LockS1Lock 0x9026
#define PTP_OC_FUJI_UnlockS1Lock 0x9027
#define PTP_OC_FUJI_GetDeviceInfo 0x902B
// Xpro-1
#define FIRM_USB_SCREEN 0x00457d98
#define FIRM_IMG_PROPS 0x00438fbc
#define FIRM_RST_CONFIG1 0x00432574
#define FIRM_RST_CONFIG2 0x0045d250
#define FIRM_RST_WRITE 0x00455aec
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
// #include <camlib.h>
// #include <ptpbackend.h>
// #include <ptp.h>
// #include <operations.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <fujifilm.h>
#include <rst.h>
#include <fujihack.h>
#include <sqlite.h>
#include <screen.h>
@petabyt
petabyt / gist:b9d8aaf476a53a29cddbf0fc43c641c8
Created January 12, 2023 02:17
fujihack flash dump xf1
NSTUB(get_flash_section, 0x005f563c)
// foo
NSTUB(flash_load, 0x0063e03c)
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <fujifilm.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <usb.h>
#include <linux/usbdevice_fs.h>
#include <stdio.h>
int inep;
int outep;
int intep;