Skip to content

Instantly share code, notes, and snippets.

@petabyt
Created January 12, 2023 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petabyt/b9d8aaf476a53a29cddbf0fc43c641c8 to your computer and use it in GitHub Desktop.
Save petabyt/b9d8aaf476a53a29cddbf0fc43c641c8 to your computer and use it in GitHub Desktop.
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 <rst.h>
#include <fujihack.h>
#include <sqlite.h>
#include <screen.h>
#include <hijack.h>
uint32_t get_implementor();
#define DUMP_LOC 0x77fda00
int cnt = 0;
/*
chunks are 0x4000
*/
void callback(int x) {
SCREENDBG("callback: %d 0x%X", cnt, x)
cnt++;
}
void entry() {
((char *)0x0116aafc)[0] = 'Z';
#if 1
fuji_toggle();
void *fp = fuji_fopen(FUJI_FOPEN_HANDLER, "C:\\ROM.BIN", 1);
fuji_toggle();
fuji_zero();
for (int i = 0; i < 0x100; i++) {
int b = flash_load(i * 0x10, 0x10, DUMP_LOC, 0, 1);
SCREENDBG("sector %X", i)
fuji_toggle();
fuji_fwrite(FUJI_FWRITE_HANDLER, fp, 0x40000, (uint8_t *)DUMP_LOC);
fuji_toggle();
fuji_zero();
}
fuji_toggle();
fuji_fclose(FUJI_FCLOSE_HANDLER, fp, 0, (char*)0);
fuji_toggle();
fuji_zero();
#endif
//SCREENDBG("Hello");
//memory_dump("C:\\DUMPZ", 0xfff88000, 4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment