Skip to content

Commit

Permalink
add flow chart, other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
petabyt committed Sep 9, 2023
1 parent ce2fbe2 commit 5331a1c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
Binary file added docs/img/flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

This wiki documents the internals of Fujifilm cameras (both hardware and software) that enables Fujihack to achieve its goals.

The wiki is made with MKDocs, and you can make edits through Github: https://github.com/fujihack/fujihack.github.io
It also has some info about Fujihack development:

Fujihack is a reverse engineering research project that aims to improve the functionality of Fujifilm digital cameras.
See the [website](https://fujihack.org/) for more information.
- [Project structure](http://127.0.0.1:8000/structure/)
- [Camera hacking vocab](http://127.0.0.1:8000/words/)

---
The wiki is made with MKDocs, and you can make edits through Github: https://github.com/fujihack/fujihack.github.io
[Public Fujihack Google spreadsheet](https://docs.google.com/spreadsheets/d/1HnRGIC9CDXgBGscjW5mOb_aKOIqzI9wp8RbXZ-fu78k/edit#gid=0).

FujiHack is licensed under the GNU General Public License v3.0. This project is not affiliated with or endorsed by Fujifilm or any other group.
The source code is open source and hosted on [Github](https://github.com/fujihack/fujihack).
10 changes: 6 additions & 4 deletions docs/rtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ to ThreadX over the years. Each function in Fuji's compatibility layer calls a s
makes reverse engineering or using the underlying RTOS very difficult. Instead, this project aims to reverse engineer only
Fujifilm's compatibility layer instead.

## Fujifilm's compatibility layer
## Fujifilm's I/O API
- See [ff_io.h](https://github.com/fujihack/fujihack/blob/master/src/ff_io.h)

## Memory management
Unlike most firmware, Fujifilm doesn't have a `malloc()` function. Each task works with fixed empty arrays. This means the developers
Unlike most firmware, Fujifilm doesn't have a `malloc()` function. Each task works with fixed empty arrays. The developers
created *huge* global variables. This means a lot of RAM is wasted, and it makes it harder to load Fujihack. There are some allocation functions,
such as the ones from SQLite or the WiFi code, but these only offer a megabyte or two and don't take advantage of all the RAM the camera has (1GB).

Expand All @@ -22,11 +22,13 @@ This unusual memory management has both pros and cons for the Fujihack project.
Overall, it's not a deal breaker. Fujifilm managed to make it work over the years, and Fujihack can find ways around it.

## Performance
Fujifilm cameras are really slow. The CPU is underclocked to preserve battery life, which makes the camera sluggish sometimes. This doesn't
take a toll on things JPEG encoding and decoding, because it's done with hardware acceleration.
Fujifilm cameras up to 2016 are really slow. The CPU is underclocked to preserve battery life, which makes the camera sluggish sometimes. This doesn't
take a toll on things like JPEG encoding and decoding, because it's done through hardware.

The CPU performance of the X-A2 is similar to an i386 desktop computer of the mid 90s.

After 2016, Fujifilm did *something* that improved performance. Or, at least the menu performance.

## Graphics
- Vector graphics processing is handled on vglib task
- Most cameras use OpenVG with the `VG_KHR_EGL_image` plugin. Implemented into Fuji cameras by [NEC Systems Technology Ltd](https://www.nec.com/) in the 2000s.
Expand Down
27 changes: 17 additions & 10 deletions docs/structure.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# FujiHack Repository Structure and Coding Rules
- Immitate the the style of the code you see in the project already.
# Fujihack project structure

Quick overview of Fujihack's code structure:

![flowchart](img/flow.png)

## src/
This is the main program that is sent over via USB into the camera.
- POSIX/Frontier compliant compatibility layer over Fujifilm's proprietary OS
- Header files defining Fujifilm's proprietary OS API (`ff_`)

## frontier/
Submodule to Frontier. You can learn more about the project [here](https://github.com/petabyt/frontier).

## patch/
ARM32 assembly patches inserted directly into firmware. The patcher pulls files from this directory.
- ARM32 assembly patches inserted directly into firmware. The patcher pulls files from this directory.

## ptp/
PTP/USB utility for running code with the code execution patch. Can also quickly load the fujihack binary.
- PTP/USB utility for running code with the code execution patch. Can also quickly load the fujihack binary.

## model/
Each camera model that is reverse engineered has it's own C header file, or information file.
It holds information on the camera, including important addreses in memory, functions, and other
details.
- Each camera model that has been reverse-engineered has its own C header file.
It holds information on the camera, including important addreses (stubs) in memory, firmware, and other
important model-specific information.

Each file is named with the model code "xf1", "xt4", etc. Then an underscore, and the version code of the
- Each file is named with the model code "xf1", "xt4", etc. Then an underscore, and the version code of the
firmware that was analyzed. For example, if the version is "1.01", then the version code would be "101".

See `template.h` for a basic example. Memory addresses start with `MEM_`, firmware addresses start with `FIRM_`,
- See `template.h` for a basic example. Memory addresses start with `MEM_`, firmware addresses start with `FIRM_`,
and functions are defined with the `NSTUB` macro.
11 changes: 4 additions & 7 deletions docs/todo.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
## Low Hanging Fruit
Things you can do to help out:
Things needed as of September 2023

- Improve [patcher](https://github.com/fujihack/patcher) HTML/CSS
- Make patcher use JS Classes instead of JSON Objects
- Research about internals (don't use pirated/leaked content)
- Make a new logo/icon for project
- Test a custom firmware
- Write an emulator for Fuji emulator - everything is there in the firmware file - just need to map out the I/O
- Motherboard screenshots
- Improve the "emulator"
- Physical ROM dump
- Add information to the [public Google spreadsheet](https://docs.google.com/spreadsheets/d/1HnRGIC9CDXgBGscjW5mOb_aKOIqzI9wp8RbXZ-fu78k/edit#gid=0)
- Test a custom firmware
- Index and data-hoard all Fujifilm firmware files
3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ extra_css:
- a.css

nav:
- Online Firmware Patcher: https://fujihack.github.io/patcher/
- Internals:
- Fujifilm Internals:
- History overview: history.md
- Firmware overview: rtos.md
- AUTO ACT script: autoactscr.md
Expand Down

0 comments on commit 5331a1c

Please sign in to comment.