Skip to content

Commit

Permalink
Merge pull request #50 from Guillem96/develop
Browse files Browse the repository at this point in the history
Ready for 1.0-alpha release
  • Loading branch information
Guillem96 authored Aug 30, 2019
2 parents b223d3b + 30a9dbe commit 1ac1ce8
Show file tree
Hide file tree
Showing 288 changed files with 61,291 additions and 2,414 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
# Build files
build/
output/
logo_bmp.h
logo_bmp.h

# Cli files
venv/
scripts/sd-files/
19 changes: 12 additions & 7 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
- Correctly deallocate argon-nx from memory when launching payloads.
- Improve system stability to enhance user experience.

## v0.4
## v1.0-alpha

- Show battery status. Shows the percentage and a color depending if the switch is charging or not:
- *Light blue*: Fast Charging
- *Light green*: Charging
- *Green*: Battery over 50%
- *Orange*: Battery under 50%
- *Red*: Battery under 20%
- ArgonNX's UI has been rewritten using [LittlevGL]() library. This rewrite has a lot of benefits. Some benefits include:
- Prettier font
- Faster rendering
- Better touch support
- In general terms improves UX
- Now payloads are listed inside tabviews where each tab contains a group of 4 payloads.
- New tab of tools. By now tools only are related to reboot stuff (reboot to rcm, power off, reboot to ofw)
- Background size back to 1280*720. No more weird image flippings.
- ArgonNX Command Line Interface to simplify the process to create logos and backgrounds.
- Now there is no need to declare a `default.bmp` logo inside the `argon/logos` directory.
- Improve system stability to enhance user experience.
80 changes: 41 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,43 @@ endif

include $(DEVKITARM)/base_rules

TARGET := argon-nx
BLVERSION_MAJOR := 0
BLVERSION_MINOR := 3
BUILD := build
OUTPUT := output
SOURCEDIR := src
DATA := data
SOURCES := src \
src/core \
src/ianos \
src/gfx \
src/libs/fatfs src/libs/elfload src/libs/compr \
src/mem \
src/menu/gui \
src/minerva \
src/panic \
src/power \
src/sec \
src/soc \
src/storage \
src/utils

INCLUDES := include
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

OFILES_BIN := $(addsuffix .o,$(BINFILES))
OFILES_SRC := $(SFILES:.s=.o) $(CFILES:.c=.o)
HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

OBJS = $(addprefix $(BUILD)/$(TARGET)/, $(OFILES_BIN) $(OFILES_SRC))


INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
TARGET := argon-nx
BUILD := build
OUTPUT := output
SOURCEDIR := src
DATA := data
SOURCES := src \
src/ianos \
src/libs/fatfs src/libs/elfload src/libs/compr src/libs/lvgl \
src/libs/lvgl/lv_core src/libs/lvgl/lv_draw src/libs/lvgl/lv_font src/libs/lvgl/lv_hal \
src/libs/lvgl/lv_misc src/libs/lvgl/lv_objx src/libs/lvgl/lv_themes \
src/core \
src/gfx \
src/mem \
src/menu/gui \
src/minerva \
src/panic \
src/power \
src/sec \
src/soc \
src/storage \
src/utils

INCLUDES := include
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
VPATH += $(dir $(wildcard ./$(SOURCEDIR)/*/*/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/*/*/))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

OFILES_BIN := $(addsuffix .o,$(BINFILES))
OFILES_SRC := $(SFILES:.s=.o) $(CFILES:.c=.o)
HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

OBJS = $(addprefix $(BUILD)/$(TARGET)/, $(OFILES_BIN) $(OFILES_SRC))


INCLUDE :=$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(BUILD)/$(TARGET)

Expand Down Expand Up @@ -72,7 +73,6 @@ $(MODULEDIRS):

$(TARGET).bin: $(BUILD)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
@printf ICTC$(BLVERSION_MAJOR)$(BLVERSION_MINOR) >> $(OUTPUT)/$@

$(BUILD)/$(TARGET)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
Expand All @@ -83,8 +83,10 @@ $(BUILD)/$(TARGET)/%.o: %.c
$(BUILD)/$(TARGET)/%.o: %.s
$(CC) $(CFLAGS) -c $< -o $@

$(OFILES_SRC) : $(HFILES_BIN)
$(OFILES_SRC): $(HFILES_BIN)

$(BUILD)/$(TARGET)/%.bmp.o %_bmp.h: data/%.bmp
@echo $(notdir $<)
@$(bin2o)
@$(bin2o)

print-% : ; @echo $* = $($*)
97 changes: 79 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,91 @@ If `payload.bin` is not present or VOLUME DOWN button is pressed on payload inje

- **Autolaunch/autochainload** the payload named `payload.bin` inside `argon` directory in your sd card root.
- If `argon/payload.bin` is not found or `VOLUME_DOWN_BUTTON` is held during ArgonNX injection, ArgonNX will list all the payloads located at `argon/payloads`, so you can select one of them to launch it.
- **Customize payloads' logos**. **Logos must be smaller or equal than 200x200**. Example:
- **Customize payloads' logos**. **Logos must be smaller or equal than 280x280** (See About BMP format section). Example:

```
argon
├───logos
│ default.bmp # Default logo (logo for all payloads)
│ fusee-primary.bmp # Logo for fusee-primary.bin payload
│ ReiNX.bmp # Logo for ReiNX.bin payload
└───payloads
fusee-primary.bin
ReiNX.bin # Will be rendered using default logo
ReiNX.bin
hekate.bin # Will be rendered using default logo
```

- **Custom backgrounds** can be added by placing `background.bmp` file inside `argon` directory. **The background must be smaller or equal than 720x1280**.
- **Custom titles** can be added by placing `title.bmp` file inside `argon` directory. **There is not a specific size for title**.
- Take **screenshots** to share your ArgonNX gui.
- FULL touch support. Thanks to @pixel-stuck

- **Custom backgrounds** can be added by placing `background.bmp` file inside `argon` directory. **The background must be smaller or equal than 1280x720**.
- Take **screenshots** to share your ArgonNX gui. To capture ArgonNX screen tap anywhere with two or more fingers.
- Touch support. Thanks to @pixel-stuck
- Simple tools. (Don't expect tools like the onew built in hekate, argon tools are much more lightweighted and simple, such as reboot options)
- Command Line Interface (CLI) to facilitate the procedure to create bmp files for custom logos and backgrounds.

## About BMP format

The only format supported is **BMP 32 bit ARGB color**.
The color used for transparency is **#1D1919**.
ArgonNX recommends using a solid background without alpha channel (alpha channel set to 0xFF). Payloads' logos **support alpha channel**.

### Generate new logos and background

ArgonNX provides a useful Command Line Interface (CLI) to create new logos and backgrounds for your payloads using a *jpg* or *png* images.

#### CLI installation

The Argon CLI is written in Python. To install python follow the instructions listed [here](https://realpython.com/installing-python/). Once you have python3 installed just type the following commands (These will install the requirements for running the CLI):

```bash
$ cd scripts
$ pip install -r requirements.txt
$ sudo apt-get install libmagickwand-dev
```

> If you are using Windows visit [Wand's installation page](http://docs.wand-py.org/en/0.4.1/guide/install.html) and follow the steps to install libmagikcwand on Windows.
#### CLI Usage

To generate a new logo use the following command.

```bash
$ cd scripts
$ python argon.py img-to-logo <path-to-png-jpg-img>
```

To generate a new background use the following command.

```bash
$ cd scripts
$ python argon.py generate-background <path-to-png-jpg-img>
```

The CLI stores the outputs of the commands at the recently created (also by the CLI) `sd-files/argon` directory (This directory simulates an sd-card argon structure).

To learn more about the CLI options type:

```bash
$ python argon.py --help
```

## GUI

This image was captured with the **screenshot** feature.
These images were captured with the **screenshot** feature.

<img src="img/example1.png" alt="example" width="700">

<img src="img/example2.png" alt="example" width="700">

<img src="img/example.png" alt="example" width="700">
<img src="img/example3.png" alt="example" width="700">

Find these logos [here](img/example-logos) and the background and title [here](sd-card-example/).
<img src="img/example4.png" alt="example" width="700">

As you can see in the pictures, payloads are displayed in groups of 4 and each group is displayed in a different *payloads* tab.

You can find the logos used in the pictures inside [this directory](img/example-custom/logos) and backgrounds [here](img/example-custom/backgrounds).

## ArgonNX sd card tree

The layout of files on the sd card for this image:

```
argon
├─── payloads
Expand All @@ -73,23 +126,30 @@ argon
| hekate.bmp
| SXOS.bmp
|
├─── background.bmp
└─── title.bmp
├─── sys
| minerva.bso # IMPORTANT if you want a good UX experience
| resources.argon # IMPORTANT. Binary file containing all render resources except the background and logos
|
└─── background.bmp
```

## Improve performance

ArgonNX can use **minerva dram training** to improve performance.
ArgonNX can use **minerva training cell** to improve performance.
The use of minerva is optional but recommended. To use minerva just place the compiled `minerva.bso` inside `argon/sys`. The directory `argon/sys` with minerva, is included in `sd-files.zip` in the release section.

To learn more about Minerva Training Cell check its [official repo](https://github.com/CTCaer/minerva_tc).

## Compatibility

This payload will launch any CFW or payload.
This payload will chainload any CFW or payload.

Some users reported issuses when chainloading SX OS. <small>But with Atmosphere out there... who wants SXOS?</small> 🙄

## Roadmap

1. Kind of config file
2. Change to prettier font
1. Config file to manage tabs titles and argon sd card directory tree.
2. More tools inside tools tab.

## Credits

Expand All @@ -98,4 +158,5 @@ This payload will launch any CFW or payload.
* __CTCaer__ for the continued [hekate](https://github.com/CTCaer/hekate) and his **minerva** project.
* __xalgovia__ and __Retrogamer 74__ for the splash and logos. Also thanks them to use ArgonNX in RetroReloaded.
* __langerhans__ and __stuck-pixel__ for their implementation of touch support.
* __LittlevGL__ for being such a good embedded graphics library.
* __D3fau4__ for touch support testing.
Binary file added img/background.bmp
Binary file not shown.
Binary file added img/example-custom/backgrounds/default.bmp
Binary file not shown.
Binary file added img/example-custom/backgrounds/stars.bmp
Binary file not shown.
Binary file added img/example-custom/logos/atmosphere.bmp
Binary file not shown.
Binary file added img/example-custom/logos/hekate.bmp
Binary file not shown.
Binary file added img/example-custom/logos/reinx.bmp
Binary file not shown.
Binary file added img/example-custom/logos/sxos.bmp
Binary file not shown.
Binary file removed img/example-logos/Atmosphere.bmp
Binary file not shown.
Binary file removed img/example-logos/Atmosphere_touch.bmp
Binary file not shown.
Binary file removed img/example-logos/Reinx.bmp
Binary file not shown.
Binary file removed img/example-logos/Reinx_touch.bmp
Binary file not shown.
Binary file removed img/example-logos/SXOS.bmp
Binary file not shown.
Binary file removed img/example-logos/default.bmp
Binary file not shown.
Binary file removed img/example-logos/fusee-gelee.bmp
Binary file not shown.
Binary file removed img/example-logos/hekate.bmp
Binary file not shown.
Binary file removed img/example-logos/hekate_touch.bmp
Binary file not shown.
Binary file removed img/example-logos/sxos_touch.bmp
Binary file not shown.
Binary file removed img/example.png
Binary file not shown.
Binary file added img/example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/example3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/example4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/title.png
Binary file not shown.
23 changes: 23 additions & 0 deletions include/core/argon-ctxt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef _ARGON_CTXT_H_
#define _ARGON_CTXT_H_

#include "minerva/minerva.h"
#include "menu/gui/gui_menu_pool.h"

typedef struct
{
/* Screen settings */
u32* vdb;
bool is_display_init;

/* Keep a reference to all menu objects */
gui_menu_pool_t* pool;

/* Minerva configuration */
mtc_config_t* mtc_conf;
} argon_ctxt_t;

void argon_ctxt_init(argon_ctxt_t* argon_ctxt);
void argon_ctxt_destroy(argon_ctxt_t* argon_ctxt);

#endif
39 changes: 39 additions & 0 deletions include/core/argon-resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef _ARGON_RESOURCES_H_
#define _ARGON_RESOURCES_H_

#define ARGON_RES_ADDR 0xEE000000

// Montserrat 12 font
#define MONTSERRAT_12_GLYPH_BMP 0x0
#define MONTSERRAT_12_KERN_PAIR_GLYPH 0x9FE
#define MONTSERRAT_12_KERN_PAIR_VALUE 0xFF6

// Montserrat 40 font
#define MONTSERRAT_40_GLYPH_BMP 0x12F2
#define MONTSERRAT_40_KERN_PAIR_GLYPH 0xE587
#define MONTSERRAT_40_KERN_PAIR_VALUE 0xEB7F

// Montserrat Alternate 80 font
#define MONTSERRAT_ALT_80_GLYPH_BMP 0xEE7B
#define MONTSERRAT_ALT_80_KERN_PAIR_GLYPH 0x42822
#define MONTSERRAT_ALT_80_KERN_PAIR_VALUE 0x429C6

// Montserrat Alternate 20 font
#define MONTSERRAT_ALT_20_GLYPH_BMP 0x42A98
#define MONTSERRAT_ALT_20_KERN_PAIR_GLYPH 0x46213
#define MONTSERRAT_ALT_20_KERN_PAIR_VALUE 0x463B7

// Montserrat Alternate 30 font
#define MONTSERRAT_ALT_30_GLYPH_BMP 0x46489
#define MONTSERRAT_ALT_30_KERN_PAIR_GLYPH 0x4DE14
#define MONTSERRAT_ALT_30_KERN_PAIR_VALUE 0x4DFB8

// Montserrat Alternate 110 font
#define MONTSERRAT_ALT_110_GLYPH_BMP 0x4E08A
#define MONTSERRAT_ALT_110_KERN_LEFT_MAP 0x7B294
#define MONTSERRAT_ALT_110_KERN_RIGHT_MAP 0x7B2F6
#define MONTSERRAT_ALT_110_KERN_CLASS_VALUE 0x7B358

void argon_resources_init();

#endif
13 changes: 4 additions & 9 deletions include/core/custom-gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
#define _CUSTOM_GUI_H_

#include "utils/types.h"
#include "libs/lvgl/lvgl.h"

#define CUSTOM_BG_PATH "argon/background.bmp"
#define CUSTOM_TITLE_PATH "argon/title.bmp"

typedef struct {
u8* custom_bg;
u8* title_bmp;
lv_img_dsc_t* custom_bg;
} custom_gui_t;


Expand All @@ -32,12 +31,8 @@ custom_gui_t* custom_gui_load();
void custom_gui_end(custom_gui_t*);

/* Renders custom background, returns false if background.bmp does not exist */
bool render_custom_background(custom_gui_t*);
bool render_custom_background(custom_gui_t*, lv_obj_t* par);

/* Renders custom title, returns false if title.bmp does not exist */
bool render_custom_title(custom_gui_t*);

/* Tool to take screenshots */
int screenshot(void* params);
void take_screenshot();

#endif
4 changes: 3 additions & 1 deletion include/core/launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef _LAUNCHER_H_
#define _LAUNCHER_H_

int launch_payload(char*);
#include "argon-ctxt.h"

int launch_payload(argon_ctxt_t*, char*);

#endif
Loading

0 comments on commit 1ac1ce8

Please # to comment.