Move drawing, input and utils code into separate library
This commit is contained in:
218
Android.mk
218
Android.mk
@@ -7,34 +7,19 @@ multirom_local_path := $(LOCAL_PATH)
|
||||
LOCAL_C_INCLUDES += $(multirom_local_path) \
|
||||
external/libpng \
|
||||
external/zlib \
|
||||
external/freetype/include
|
||||
external/freetype/include \
|
||||
$(multirom_local_path)/lib
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
animation.c \
|
||||
button.c \
|
||||
containers.c \
|
||||
framebuffer.c \
|
||||
framebuffer_generic.c \
|
||||
framebuffer_png.c \
|
||||
framebuffer_truetype.c \
|
||||
fstab.c \
|
||||
input.c \
|
||||
kexec.c \
|
||||
listview.c \
|
||||
main.c \
|
||||
multirom.c \
|
||||
multirom_ui.c \
|
||||
multirom_ui_landscape.c \
|
||||
multirom_ui_portrait.c \
|
||||
multirom_ui_themes.c \
|
||||
themes/multirom_ui_landscape.c \
|
||||
themes/multirom_ui_portrait.c \
|
||||
notification_card.c \
|
||||
pong.c \
|
||||
progressdots.c \
|
||||
rom_quirks.c \
|
||||
tabview.c \
|
||||
touch_tracker.c \
|
||||
util.c \
|
||||
workers.c
|
||||
|
||||
# With these, GCC optimizes aggressively enough so full-screen alpha blending
|
||||
# is quick enough to be done in an animation
|
||||
@@ -49,122 +34,15 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc libm libpng libz libft2_mrom_static
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc libmultirom_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := libm libcutils libpng libz libft2_mrom_static
|
||||
|
||||
# clone libbootimg to /system/extras/ from
|
||||
# https://github.com/Tasssadar/libbootimg.git
|
||||
LOCAL_STATIC_LIBRARIES += libbootimg
|
||||
LOCAL_C_INCLUDES += system/extras/libbootimg/include
|
||||
|
||||
# Defines from device files
|
||||
# Init default define values
|
||||
MULTIROM_DEFAULT_ROTATION := 0
|
||||
|
||||
LOCAL_CFLAGS += -DMR_LOG_TAG=\"multirom\"
|
||||
|
||||
# This value is used to have different folders on USB drives
|
||||
# for different devices. Grouper didn't have that, hence the hack
|
||||
LOCAL_CFLAGS += -DTARGET_DEVICE="\"$(TARGET_DEVICE)\""
|
||||
ifeq ($(TARGET_DEVICE),grouper)
|
||||
LOCAL_CFLAGS += -DMR_MOVE_USB_DIR
|
||||
endif
|
||||
|
||||
# Flo's bootloader removes first 26 characters from boot.img's cmdline
|
||||
# because of reasons. On unmodified boot.img, those 26 characters are
|
||||
# "console=ttyHSL0,115200,n8 "
|
||||
ifeq ($(TARGET_DEVICE),flo)
|
||||
LOCAL_CFLAGS += -DFLO_CMDLINE_HACK
|
||||
endif
|
||||
|
||||
ifeq ($(MR_INPUT_TYPE),)
|
||||
MR_INPUT_TYPE := type_b
|
||||
endif
|
||||
LOCAL_SRC_FILES += input_$(MR_INPUT_TYPE).c
|
||||
|
||||
ifeq ($(DEVICE_RESOLUTION),)
|
||||
$(info DEVICE_RESOLUTION was not specified)
|
||||
else ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(DEVICE_RESOLUTION).c),)
|
||||
LOCAL_SRC_FILES += themes/multirom_ui_$(DEVICE_RESOLUTION).c
|
||||
LOCAL_CFLAGS += -DMULTIROM_THEME_$(DEVICE_RESOLUTION)
|
||||
endif
|
||||
|
||||
ifneq ($(LANDSCAPE_RESOLUTION),)
|
||||
ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c),)
|
||||
LOCAL_SRC_FILES += themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c
|
||||
LOCAL_CFLAGS += -DMULTIROM_THEME_$(LANDSCAPE_RESOLUTION)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(TW_DEFAULT_ROTATION),)
|
||||
MULTIROM_DEFAULT_ROTATION := $(TW_DEFAULT_ROTATION)
|
||||
endif
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_ROTATION=$(MULTIROM_DEFAULT_ROTATION)
|
||||
|
||||
# TWRP framebuffer flags
|
||||
ifeq ($(RECOVERY_GRAPHICS_USE_LINELENGTH), true)
|
||||
LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_USE_LINELENGTH
|
||||
endif
|
||||
|
||||
ifeq ($(MR_PIXEL_FORMAT),)
|
||||
MR_PIXEL_FORMAT := $(TARGET_RECOVERY_PIXEL_FORMAT)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_PIXEL_FORMAT),"RGBX_8888")
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGBX
|
||||
else ifeq ($(MR_PIXEL_FORMAT),"BGRA_8888")
|
||||
LOCAL_CFLAGS += -DRECOVERY_BGRA
|
||||
else ifeq ($(MR_PIXEL_FORMAT),"RGB_565")
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGB_565
|
||||
else
|
||||
$(info TARGET_RECOVERY_PIXEL_FORMAT or MR_PIXEL_FORMAT not set or have invalid value)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DPI),)
|
||||
$(info MR_DPI not defined in device files)
|
||||
else ifeq ($(MR_DPI),hdpi)
|
||||
ifeq ($(MR_DPI_MUL),)
|
||||
MR_DPI_MUL := 1
|
||||
endif
|
||||
else ifeq ($(MR_DPI),xhdpi)
|
||||
ifeq ($(MR_DPI_MUL),)
|
||||
MR_DPI_MUL := 1.5
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DPI_FONT),)
|
||||
MR_DPI_FONT := 96
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -DMR_DPI_FONT=$(MR_DPI_FONT)
|
||||
|
||||
ifneq ($(MR_DPI_MUL),)
|
||||
LOCAL_CFLAGS += -DDPI_MUL=$(MR_DPI_MUL)
|
||||
else
|
||||
$(info MR_DPI_MUL not defined!)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DISABLE_ALPHA),true)
|
||||
LOCAL_CFLAGS += -DMR_DISABLE_ALPHA
|
||||
endif
|
||||
|
||||
ifneq ($(TW_BRIGHTNESS_PATH),)
|
||||
LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=\"$(TW_BRIGHTNESS_PATH)\"
|
||||
endif
|
||||
|
||||
ifneq ($(MR_DEFAULT_BRIGHTNESS),)
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_BRIGHTNESS=\"$(MR_DEFAULT_BRIGHTNESS)\"
|
||||
else
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_BRIGHTNESS=40
|
||||
endif
|
||||
|
||||
ifneq ($(MR_KEXEC_MEM_MIN),)
|
||||
LOCAL_CFLAGS += -DMR_KEXEC_MEM_MIN=\"$(MR_KEXEC_MEM_MIN)\"
|
||||
else
|
||||
$(info MR_KEXEC_MEM_MIN was not defined in device files!)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_KEXEC_DTB),true)
|
||||
LOCAL_CFLAGS += -DMR_KEXEC_DTB
|
||||
endif
|
||||
include $(multirom_local_path)/device_defines.mk
|
||||
|
||||
ifneq ($(MR_DEVICE_HOOKS),)
|
||||
ifeq ($(MR_DEVICE_HOOKS_VER),)
|
||||
@@ -175,30 +53,10 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MR_USE_QCOM_OVERLAY),true)
|
||||
LOCAL_CFLAGS += -DMR_USE_QCOM_OVERLAY
|
||||
LOCAL_SRC_FILES += framebuffer_qcom_overlay.c
|
||||
ifneq ($(MR_QCOM_OVERLAY_HEADER),)
|
||||
LOCAL_CFLAGS += -DMR_QCOM_OVERLAY_HEADER=\"../../../$(MR_QCOM_OVERLAY_HEADER)\"
|
||||
else
|
||||
$(error MR_USE_QCOM_OVERLAY is true but MR_QCOM_OVERLAY_HEADER was not specified!)
|
||||
endif
|
||||
ifneq ($(MR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT),)
|
||||
LOCAL_CFLAGS += -DMR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT=$(MR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT)
|
||||
endif
|
||||
ifeq ($(MR_QCOM_OVERLAY_USE_VSYNC),true)
|
||||
LOCAL_CFLAGS += -DMR_QCOM_OVERLAY_USE_VSYNC
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MR_CONTINUOUS_FB_UPDATE),true)
|
||||
LOCAL_CFLAGS += -DMR_CONTINUOUS_FB_UPDATE
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
|
||||
|
||||
# Trampoline
|
||||
include $(multirom_local_path)/trampoline/Android.mk
|
||||
|
||||
@@ -219,59 +77,5 @@ ifeq ($(MR_ENCRYPTION),true)
|
||||
include $(multirom_local_path)/trampoline_encmnt/Android.mk
|
||||
endif
|
||||
|
||||
# We need static libtruetype but it isn't in standard android makefile :(
|
||||
LOCAL_PATH := external/freetype/
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# compile in ARM mode, since the glyph loader/renderer is a hotspot
|
||||
# when loading complex pages in the browser
|
||||
#
|
||||
LOCAL_ARM_MODE := arm
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
src/base/ftbbox.c \
|
||||
src/base/ftbitmap.c \
|
||||
src/base/ftfstype.c \
|
||||
src/base/ftglyph.c \
|
||||
src/base/ftlcdfil.c \
|
||||
src/base/ftstroke.c \
|
||||
src/base/fttype1.c \
|
||||
src/base/ftxf86.c \
|
||||
src/base/ftbase.c \
|
||||
src/base/ftsystem.c \
|
||||
src/base/ftinit.c \
|
||||
src/base/ftgasp.c \
|
||||
src/raster/raster.c \
|
||||
src/sfnt/sfnt.c \
|
||||
src/smooth/smooth.c \
|
||||
src/autofit/autofit.c \
|
||||
src/truetype/truetype.c \
|
||||
src/cff/cff.c \
|
||||
src/psnames/psnames.c \
|
||||
src/pshinter/pshinter.c
|
||||
|
||||
ifeq ($(shell if [ -e "$(ANDROID_BUILD_TOP)/external/freetype/src/gzip/ftgzip.c" ]; then echo "hasgzip"; fi),hasgzip)
|
||||
LOCAL_SRC_FILES += src/gzip/ftgzip.c
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/builds \
|
||||
$(LOCAL_PATH)/include \
|
||||
external/libpng \
|
||||
external/zlib
|
||||
|
||||
LOCAL_CFLAGS += -W -Wall
|
||||
LOCAL_CFLAGS += -fPIC -DPIC
|
||||
LOCAL_CFLAGS += "-DDARWIN_NO_CARBON"
|
||||
LOCAL_CFLAGS += "-DFT2_BUILD_LIBRARY"
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libpng libz
|
||||
|
||||
# the following is for testing only, and should not be used in final builds
|
||||
# of the product
|
||||
#LOCAL_CFLAGS += "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER"
|
||||
|
||||
LOCAL_CFLAGS += -O2
|
||||
|
||||
LOCAL_MODULE:= libft2_mrom_static
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
# libmultirom
|
||||
include $(multirom_local_path)/lib/Android.mk
|
||||
|
||||
111
device_defines.mk
Normal file
111
device_defines.mk
Normal file
@@ -0,0 +1,111 @@
|
||||
# Defines from device files
|
||||
# Init default define values
|
||||
MULTIROM_DEFAULT_ROTATION := 0
|
||||
|
||||
# This value is used to have different folders on USB drives
|
||||
# for different devices. Grouper didn't have that, hence the hack
|
||||
LOCAL_CFLAGS += -DTARGET_DEVICE="\"$(TARGET_DEVICE)\""
|
||||
ifeq ($(TARGET_DEVICE),grouper)
|
||||
LOCAL_CFLAGS += -DMR_MOVE_USB_DIR
|
||||
endif
|
||||
|
||||
# Flo's bootloader removes first 26 characters from boot.img's cmdline
|
||||
# because of reasons. On unmodified boot.img, those 26 characters are
|
||||
# "console=ttyHSL0,115200,n8 "
|
||||
ifeq ($(TARGET_DEVICE),flo)
|
||||
LOCAL_CFLAGS += -DFLO_CMDLINE_HACK
|
||||
endif
|
||||
|
||||
ifeq ($(DEVICE_RESOLUTION),)
|
||||
$(info DEVICE_RESOLUTION was not specified)
|
||||
# FIXME
|
||||
#else ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(DEVICE_RESOLUTION).c),)
|
||||
# LOCAL_SRC_FILES += themes/multirom_ui_$(DEVICE_RESOLUTION).c
|
||||
# LOCAL_CFLAGS += -DMULTIROM_THEME_$(DEVICE_RESOLUTION)
|
||||
endif
|
||||
|
||||
ifneq ($(LANDSCAPE_RESOLUTION),)
|
||||
# FIXME
|
||||
#ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c),)
|
||||
# LOCAL_SRC_FILES += themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c
|
||||
# LOCAL_CFLAGS += -DMULTIROM_THEME_$(LANDSCAPE_RESOLUTION)
|
||||
#endif
|
||||
endif
|
||||
|
||||
ifneq ($(TW_DEFAULT_ROTATION),)
|
||||
MULTIROM_DEFAULT_ROTATION := $(TW_DEFAULT_ROTATION)
|
||||
endif
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_ROTATION=$(MULTIROM_DEFAULT_ROTATION)
|
||||
|
||||
# TWRP framebuffer flags
|
||||
ifeq ($(RECOVERY_GRAPHICS_USE_LINELENGTH), true)
|
||||
LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_USE_LINELENGTH
|
||||
endif
|
||||
|
||||
ifeq ($(MR_PIXEL_FORMAT),)
|
||||
MR_PIXEL_FORMAT := $(TARGET_RECOVERY_PIXEL_FORMAT)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_PIXEL_FORMAT),"RGBX_8888")
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGBX
|
||||
else ifeq ($(MR_PIXEL_FORMAT),"BGRA_8888")
|
||||
LOCAL_CFLAGS += -DRECOVERY_BGRA
|
||||
else ifeq ($(MR_PIXEL_FORMAT),"RGB_565")
|
||||
LOCAL_CFLAGS += -DRECOVERY_RGB_565
|
||||
else
|
||||
$(info TARGET_RECOVERY_PIXEL_FORMAT or MR_PIXEL_FORMAT not set or have invalid value)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DPI),)
|
||||
$(info MR_DPI not defined in device files)
|
||||
else ifeq ($(MR_DPI),hdpi)
|
||||
ifeq ($(MR_DPI_MUL),)
|
||||
MR_DPI_MUL := 1
|
||||
endif
|
||||
else ifeq ($(MR_DPI),xhdpi)
|
||||
ifeq ($(MR_DPI_MUL),)
|
||||
MR_DPI_MUL := 1.5
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DPI_FONT),)
|
||||
MR_DPI_FONT := 96
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -DMR_DPI_FONT=$(MR_DPI_FONT)
|
||||
|
||||
ifneq ($(MR_DPI_MUL),)
|
||||
LOCAL_CFLAGS += -DDPI_MUL=$(MR_DPI_MUL)
|
||||
else
|
||||
$(info MR_DPI_MUL not defined!)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_DISABLE_ALPHA),true)
|
||||
LOCAL_CFLAGS += -DMR_DISABLE_ALPHA
|
||||
endif
|
||||
|
||||
ifneq ($(TW_BRIGHTNESS_PATH),)
|
||||
LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=\"$(TW_BRIGHTNESS_PATH)\"
|
||||
endif
|
||||
|
||||
ifneq ($(MR_DEFAULT_BRIGHTNESS),)
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_BRIGHTNESS=\"$(MR_DEFAULT_BRIGHTNESS)\"
|
||||
else
|
||||
LOCAL_CFLAGS += -DMULTIROM_DEFAULT_BRIGHTNESS=40
|
||||
endif
|
||||
|
||||
ifneq ($(MR_KEXEC_MEM_MIN),)
|
||||
LOCAL_CFLAGS += -DMR_KEXEC_MEM_MIN=\"$(MR_KEXEC_MEM_MIN)\"
|
||||
else
|
||||
$(info MR_KEXEC_MEM_MIN was not defined in device files!)
|
||||
endif
|
||||
|
||||
ifeq ($(MR_KEXEC_DTB),true)
|
||||
LOCAL_CFLAGS += -DMR_KEXEC_DTB
|
||||
endif
|
||||
|
||||
ifeq ($(MR_CONTINUOUS_FB_UPDATE),true)
|
||||
LOCAL_CFLAGS += -DMR_CONTINUOUS_FB_UPDATE
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
|
||||
@@ -4,9 +4,6 @@ include $(CLEAR_VARS)
|
||||
LOCAL_C_INCLUDES += $(multirom_local_path)
|
||||
LOCAL_SRC_FILES:= \
|
||||
fw_mounter.c \
|
||||
../util.c \
|
||||
../fstab.c \
|
||||
../containers.c
|
||||
|
||||
LOCAL_MODULE := fw_mounter
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
@@ -15,8 +12,6 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc
|
||||
|
||||
LOCAL_CFLAGS += -DMR_LOG_TAG=\"fw_mounter\"
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc libmultirom_static
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
@@ -19,13 +19,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../log.h"
|
||||
#include "../util.h"
|
||||
#include "../fstab.h"
|
||||
#include "../lib/log.h"
|
||||
#include "../lib/util.h"
|
||||
#include "../lib/fstab.h"
|
||||
#include "fw_mounter_defines.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mrom_set_log_tag("fw_mounter");
|
||||
|
||||
struct fstab *f = fstab_load(FW_MOUNTER_FSTAB, 0);
|
||||
if(!f)
|
||||
{
|
||||
|
||||
6
kexec.c
6
kexec.c
@@ -20,9 +20,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "kexec.h"
|
||||
#include "containers.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "lib/containers.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/util.h"
|
||||
|
||||
// kexec --load-hardboot ./zImage --command-line="$(cat /proc/cmdline)" --mem-min=0xA0000000 --initrd=./rd.img
|
||||
// --mem-min should be somewhere in System RAM (see /proc/iomem). Location just above kernel seems to work fine.
|
||||
|
||||
141
lib/Android.mk
Normal file
141
lib/Android.mk
Normal file
@@ -0,0 +1,141 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
common_SRC_FILES := \
|
||||
animation.c \
|
||||
button.c \
|
||||
colors.c \
|
||||
containers.c \
|
||||
framebuffer.c \
|
||||
framebuffer_generic.c \
|
||||
framebuffer_png.c \
|
||||
framebuffer_truetype.c \
|
||||
fstab.c \
|
||||
input.c \
|
||||
listview.c \
|
||||
mrom_data.c \
|
||||
notification_card.c \
|
||||
progressdots.c \
|
||||
tabview.c \
|
||||
touch_tracker.c \
|
||||
util.c \
|
||||
workers.c \
|
||||
|
||||
common_C_INCLUDES := $(multirom_local_path)/lib \
|
||||
external/libpng \
|
||||
external/zlib \
|
||||
external/freetype/include
|
||||
|
||||
# With these, GCC optimizes aggressively enough so full-screen alpha blending
|
||||
# is quick enough to be done in an animation
|
||||
common_C_FLAGS := -O3 -funsafe-math-optimizations
|
||||
|
||||
ifeq ($(MR_INPUT_TYPE),)
|
||||
MR_INPUT_TYPE := type_b
|
||||
endif
|
||||
common_SRC_FILES += input_$(MR_INPUT_TYPE).c
|
||||
|
||||
ifeq ($(MR_USE_QCOM_OVERLAY),true)
|
||||
common_CFLAGS += -DMR_USE_QCOM_OVERLAY
|
||||
common_SRC_FILES += framebuffer_qcom_overlay.c
|
||||
ifneq ($(MR_QCOM_OVERLAY_HEADER),)
|
||||
common_CFLAGS += -DMR_QCOM_OVERLAY_HEADER=\"../../../../$(MR_QCOM_OVERLAY_HEADER)\"
|
||||
else
|
||||
$(error MR_USE_QCOM_OVERLAY is true but MR_QCOM_OVERLAY_HEADER was not specified!)
|
||||
endif
|
||||
ifneq ($(MR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT),)
|
||||
common_CFLAGS += -DMR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT=$(MR_QCOM_OVERLAY_CUSTOM_PIXEL_FORMAT)
|
||||
endif
|
||||
ifeq ($(MR_QCOM_OVERLAY_USE_VSYNC),true)
|
||||
common_CFLAGS += -DMR_QCOM_OVERLAY_USE_VSYNC
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libmultirom_static
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
|
||||
LOCAL_CFLAGS += $(common_C_FLAGS)
|
||||
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
|
||||
LOCAL_SRC_FILES := $(common_SRC_FILES)
|
||||
|
||||
include $(multirom_local_path)/device_defines.mk
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libmultirom
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libc libm libpng libz libft2
|
||||
LOCAL_CFLAGS += $(common_C_FLAGS)
|
||||
LOCAL_SRC_FILES := $(common_SRC_FILES)
|
||||
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
|
||||
|
||||
include $(multirom_local_path)/device_defines.mk
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
|
||||
# We need static libtruetype but it isn't in standard android makefile :(
|
||||
LOCAL_PATH := external/freetype/
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# compile in ARM mode, since the glyph loader/renderer is a hotspot
|
||||
# when loading complex pages in the browser
|
||||
#
|
||||
LOCAL_ARM_MODE := arm
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
src/base/ftbbox.c \
|
||||
src/base/ftbitmap.c \
|
||||
src/base/ftfstype.c \
|
||||
src/base/ftglyph.c \
|
||||
src/base/ftlcdfil.c \
|
||||
src/base/ftstroke.c \
|
||||
src/base/fttype1.c \
|
||||
src/base/ftxf86.c \
|
||||
src/base/ftbase.c \
|
||||
src/base/ftsystem.c \
|
||||
src/base/ftinit.c \
|
||||
src/base/ftgasp.c \
|
||||
src/raster/raster.c \
|
||||
src/sfnt/sfnt.c \
|
||||
src/smooth/smooth.c \
|
||||
src/autofit/autofit.c \
|
||||
src/truetype/truetype.c \
|
||||
src/cff/cff.c \
|
||||
src/psnames/psnames.c \
|
||||
src/pshinter/pshinter.c
|
||||
|
||||
ifeq ($(shell if [ -e "$(ANDROID_BUILD_TOP)/external/freetype/src/gzip/ftgzip.c" ]; then echo "hasgzip"; fi),hasgzip)
|
||||
LOCAL_SRC_FILES += src/gzip/ftgzip.c
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/builds \
|
||||
$(LOCAL_PATH)/include \
|
||||
external/libpng \
|
||||
external/zlib
|
||||
|
||||
LOCAL_CFLAGS += -W -Wall
|
||||
LOCAL_CFLAGS += -fPIC -DPIC
|
||||
LOCAL_CFLAGS += "-DDARWIN_NO_CARBON"
|
||||
LOCAL_CFLAGS += "-DFT2_BUILD_LIBRARY"
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libpng libz
|
||||
|
||||
# the following is for testing only, and should not be used in final builds
|
||||
# of the product
|
||||
#LOCAL_CFLAGS += "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER"
|
||||
|
||||
LOCAL_CFLAGS += -O2
|
||||
|
||||
LOCAL_MODULE:= libft2_mrom_static
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
@@ -140,8 +140,8 @@ static inline void anim_int_step(int *prop, int *start, int *last, int *target,
|
||||
static inline int item_anim_is_on_screen(item_anim *anim)
|
||||
{
|
||||
fb_item_header *it = anim->item;
|
||||
return it->x + it->w > 0 && it->x < fb_width &&
|
||||
it->y + it->h > 0 && it->y < fb_height;
|
||||
return it->x + it->w > 0 && it->x < (int)fb_width &&
|
||||
it->y + it->h > 0 && it->y < (int)fb_height;
|
||||
}
|
||||
|
||||
static void item_anim_step(item_anim *anim, float interpolated, int *need_draw)
|
||||
@@ -198,7 +198,7 @@ static void anim_update(uint32_t diff, void *data)
|
||||
|
||||
pthread_mutex_lock(&list->mutex);
|
||||
list->in_update_loop = 1;
|
||||
|
||||
|
||||
for(it = list->first; it; )
|
||||
{
|
||||
anim = it->anim;
|
||||
@@ -20,9 +20,9 @@
|
||||
#include "button.h"
|
||||
#include "input.h"
|
||||
#include "util.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "colors.h"
|
||||
#include "log.h"
|
||||
#include "containers.h"
|
||||
|
||||
void button_init_ui(button *b, const char *text, int size)
|
||||
{
|
||||
155
lib/colors.c
Normal file
155
lib/colors.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "colors.h"
|
||||
#include "util.h"
|
||||
|
||||
static const struct mrom_color_theme color_themes[] = {
|
||||
// 0 - red/white, default
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFFF72F2F,
|
||||
.highlight_hover = 0xFFF85555,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFF0000FF,
|
||||
},
|
||||
// 1 - orange/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFFFF5722,
|
||||
.highlight_hover = 0xFFFF8A65,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 2 - blue/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF5677FC,
|
||||
.highlight_hover = 0xFF91A7FF,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 3 - purple/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF673AB7,
|
||||
.highlight_hover = 0xFF9575CD,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 4 - green/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF259B24,
|
||||
.highlight_hover = 0xFF72D572,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 5 - dark blue
|
||||
{
|
||||
.background = 0xFF263238,
|
||||
.highlight_bg = 0xFF607D8B,
|
||||
.highlight_hover = 0xFF90A4AE,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFFFFFFFF,
|
||||
.text_secondary = 0xFFE6E6E6,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFF607D8B,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 6 - dark blue/black
|
||||
{
|
||||
.background = 0xFF000000,
|
||||
.highlight_bg = 0xFF263238,
|
||||
.highlight_hover = 0xFF607D8B,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFFFFFFFF,
|
||||
.text_secondary = 0xFFE6E6E6,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54424242,
|
||||
.rom_highlight = 0xFF263238,
|
||||
.rom_highlight_shadow = 0x54424242,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
};
|
||||
|
||||
const struct mrom_color_theme *color_theme = &color_themes[0];
|
||||
|
||||
void colors_select(size_t color_theme_idx)
|
||||
{
|
||||
if(color_theme_idx >= ARRAY_SIZE(color_themes))
|
||||
return;
|
||||
color_theme = &color_themes[color_theme_idx];
|
||||
}
|
||||
|
||||
const struct mrom_color_theme *colors_get(size_t color_theme_idx)
|
||||
{
|
||||
if(color_theme_idx >= ARRAY_SIZE(color_themes))
|
||||
return NULL;
|
||||
return &color_themes[color_theme_idx];
|
||||
}
|
||||
|
||||
int colors_count(void)
|
||||
{
|
||||
return ARRAY_SIZE(color_themes);
|
||||
}
|
||||
59
lib/colors.h
Normal file
59
lib/colors.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MROM_COLORS_H
|
||||
#define MROM_COLORS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct mrom_color_theme
|
||||
{
|
||||
uint32_t background;
|
||||
uint32_t highlight_bg;
|
||||
uint32_t highlight_hover;
|
||||
uint32_t highlight_text;
|
||||
uint32_t text;
|
||||
uint32_t text_secondary;
|
||||
uint32_t ncard_bg;
|
||||
uint32_t ncard_text;
|
||||
uint32_t ncard_text_secondary;
|
||||
uint32_t ncard_shadow;
|
||||
uint32_t rom_highlight;
|
||||
uint32_t rom_highlight_shadow;
|
||||
uint32_t keyaction_frame;
|
||||
};
|
||||
|
||||
extern const struct mrom_color_theme *color_theme;
|
||||
#define C_BACKGROUND (color_theme->background)
|
||||
#define C_HIGHLIGHT_BG (color_theme->highlight_bg)
|
||||
#define C_HIGHLIGHT_HOVER (color_theme->highlight_hover)
|
||||
#define C_HIGHLIGHT_TEXT (color_theme->highlight_text)
|
||||
#define C_TEXT (color_theme->text)
|
||||
#define C_TEXT_SECONDARY (color_theme->text_secondary)
|
||||
#define C_NCARD_BG (color_theme->ncard_bg)
|
||||
#define C_NCARD_TEXT (color_theme->ncard_text)
|
||||
#define C_NCARD_TEXT_SECONDARY (color_theme->ncard_text_secondary)
|
||||
#define C_NCARD_SHADOW (color_theme->ncard_shadow)
|
||||
#define C_ROM_HIGHLIGHT (color_theme->rom_highlight)
|
||||
#define C_ROM_HIGHLIGHT_SHADOW (color_theme->rom_highlight_shadow)
|
||||
#define C_KEYACT_FRAME (color_theme->keyaction_frame)
|
||||
|
||||
void colors_select(size_t color_theme_idx);
|
||||
const struct mrom_color_theme *colors_get(size_t color_theme_idx);
|
||||
int colors_count(void);
|
||||
|
||||
#endif
|
||||
@@ -38,9 +38,9 @@
|
||||
#include "util.h"
|
||||
#include "containers.h"
|
||||
#include "animation.h"
|
||||
#include "multirom.h"
|
||||
#include "listview.h"
|
||||
#include "atomics.h"
|
||||
#include "mrom_data.h"
|
||||
|
||||
#if PIXEL_SIZE == 4
|
||||
#define fb_memset(dst, what, len) android_memset32(dst, what, len)
|
||||
@@ -799,9 +799,9 @@ fb_img* fb_add_png_img_lvl(int level, int x, int y, int w, int h, const char *pa
|
||||
px_type *data = NULL;
|
||||
if(strncmp(path, ":/", 2) == 0)
|
||||
{
|
||||
const int full_path_len = strlen(path) + strlen(multirom_dir) + 4;
|
||||
const int full_path_len = strlen(path) + strlen(mrom_dir()) + 4;
|
||||
char *full_path = malloc(full_path_len);
|
||||
snprintf(full_path, full_path_len, "%s/res%s", multirom_dir, path+1);
|
||||
snprintf(full_path, full_path_len, "%s/res%s", mrom_dir(), path+1);
|
||||
data = fb_png_get(full_path, w, h);
|
||||
free(full_path);
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ int fb_save_screenshot(void)
|
||||
char dir[256];
|
||||
char path[256];
|
||||
|
||||
strcpy(dir, multirom_dir);
|
||||
strcpy(dir, mrom_dir());
|
||||
r = strrchr(dir, '/');
|
||||
if(!r)
|
||||
{
|
||||
@@ -95,11 +95,6 @@ static px_type *scale_png_img(px_type *fi_data, int orig_w, int orig_h, int new_
|
||||
return (px_type*)out;
|
||||
}
|
||||
|
||||
// Kanged from TWRP
|
||||
double pow(double x, double y) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static px_type *load_png(const char *path, int destW, int destH)
|
||||
{
|
||||
FILE *fp;
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "framebuffer.h"
|
||||
#include "util.h"
|
||||
#include "containers.h"
|
||||
#include "multirom.h"
|
||||
#include "mrom_data.h"
|
||||
|
||||
#define LINE_SPACING 1.15
|
||||
|
||||
@@ -88,7 +88,7 @@ struct text_line
|
||||
FT_Vector *pos;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
char *text;
|
||||
px_type color;
|
||||
@@ -157,7 +157,7 @@ static struct glyphs_entry *get_cache_for_size(const int style, const int size)
|
||||
{
|
||||
char buff[128];
|
||||
res = mzalloc(sizeof(struct glyphs_entry));
|
||||
snprintf(buff, sizeof(buff), "%s/res/%s", multirom_dir, FONT_FILES[style]);
|
||||
snprintf(buff, sizeof(buff), "%s/res/%s", mrom_dir(), FONT_FILES[style]);
|
||||
error = FT_New_Face(cache.ft_lib, buff, 0, &res->face);
|
||||
if(error)
|
||||
{
|
||||
@@ -21,12 +21,12 @@
|
||||
#include "framebuffer.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "colors.h"
|
||||
#include "workers.h"
|
||||
#include "input.h"
|
||||
#include "animation.h"
|
||||
#include "notification_card.h"
|
||||
#include "containers.h"
|
||||
|
||||
#define MARK_W (10*DPI_MUL)
|
||||
#define MARK_H (50*DPI_MUL)
|
||||
@@ -17,17 +17,17 @@
|
||||
#ifndef _INIT_LOG_H_
|
||||
#define _INIT_LOG_H_
|
||||
|
||||
#include "mrom_data.h"
|
||||
|
||||
#ifdef LOG_TO_STDOUT
|
||||
#include <stdio.h>
|
||||
#define ERROR(fmt, ...) fprintf(stderr, MR_LOG_TAG ": " fmt "\n", ##__VA_ARGS__)
|
||||
#define NOTICE(fmt, ...) printf(MR_LOG_TAG ": " fmt "\n", ##__VA_ARGS__)
|
||||
#define INFO(fmt, ...) printf(MR_LOG_TAG ": " fmt "\n", ##__VA_ARGS__)
|
||||
#define ERROR(fmt, ...) fprintf(stderr, "%s: " fmt "\n", mrom_log_tag(), ##__VA_ARGS__)
|
||||
#define INFO(fmt, ...) printf("%s: " fmt "\n", mrom_log_tag(), ##__VA_ARGS__)
|
||||
#else
|
||||
#include <cutils/klog.h>
|
||||
|
||||
#define ERROR(x...) KLOG_ERROR(MR_LOG_TAG, x)
|
||||
#define NOTICE(x...) KLOG_NOTICE(MR_LOG_TAG, x)
|
||||
#define INFO(x...) KLOG_INFO(MR_LOG_TAG, x)
|
||||
#define ERROR(fmt, ...) klog_write(3, "<3>%s: " fmt, mrom_log_tag(), ##__VA_ARGS__)
|
||||
#define INFO(fmt, ...) klog_write(6, "<6>%s: " fmt, mrom_log_tag(), ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
44
lib/mrom_data.c
Normal file
44
lib/mrom_data.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mrom_data.h"
|
||||
|
||||
static char multirom_dir[128] = { 0 };
|
||||
static char log_tag[64] = { 0 };
|
||||
|
||||
void mrom_set_dir(const char *mrom_dir)
|
||||
{
|
||||
snprintf(multirom_dir, sizeof(multirom_dir), "%s", mrom_dir);
|
||||
}
|
||||
|
||||
void mrom_set_log_tag(const char *tag)
|
||||
{
|
||||
snprintf(log_tag, sizeof(log_tag), "%s", tag);
|
||||
}
|
||||
|
||||
const char *mrom_log_tag(void)
|
||||
{
|
||||
return log_tag;
|
||||
}
|
||||
|
||||
const char *mrom_dir(void)
|
||||
{
|
||||
return multirom_dir;
|
||||
}
|
||||
27
lib/mrom_data.h
Normal file
27
lib/mrom_data.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MROM_DATA_H
|
||||
#define MROM_DATA_H
|
||||
|
||||
void mrom_set_dir(const char *mrom_dir);
|
||||
void mrom_set_log_tag(const char *tag);
|
||||
|
||||
const char *mrom_log_tag(void);
|
||||
const char *mrom_dir(void);
|
||||
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "containers.h"
|
||||
#include "log.h"
|
||||
#include "input.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "colors.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -18,8 +18,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "progressdots.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "colors.h"
|
||||
#include "workers.h"
|
||||
#include "util.h"
|
||||
#include "animation.h"
|
||||
@@ -18,7 +18,6 @@
|
||||
#ifndef PROGRESSDOTS_H
|
||||
#define PROGRESSDOTS_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include "framebuffer.h"
|
||||
|
||||
#define PROGDOTS_W (400*DPI_MUL)
|
||||
72
lib/velocity_tracker.c
Normal file
72
lib/velocity_tracker.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "touch_tracker.h"
|
||||
#include "util.h"
|
||||
|
||||
touch_tracker *touch_tracker_create(void)
|
||||
{
|
||||
touch_tracker *t = mzalloc(sizeof(touch_tracker));
|
||||
return t;
|
||||
}
|
||||
|
||||
void touch_tracker_destroy(touch_tracker *t)
|
||||
{
|
||||
free(t);
|
||||
}
|
||||
|
||||
void touch_tracker_start(touch_tracker *t, touch_event *ev)
|
||||
{
|
||||
t->distance_abs_x = t->distance_abs_y = 0;
|
||||
t->start_x = ev->x;
|
||||
t->start_y = ev->y;
|
||||
t->last_x = ev->x;
|
||||
t->last_y = ev->y;
|
||||
memcpy(&v->time_start, &ev->time, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
void touch_tracker_finish(touch_tracker *t, touch_event *ev)
|
||||
{
|
||||
t->distance_x = ev->x - t->start_x;
|
||||
t->distance_y = ev->y - t->start_y;
|
||||
t->period = timeval_us_diff(ev->time, t->time_start);
|
||||
}
|
||||
|
||||
void touch_tracker_add(touch_tracker *t, touch_event *ev)
|
||||
{
|
||||
t->distance_abs_x += iabs(ev->x - t->last_x);
|
||||
t->distance_abs_y += iabs(ev->y - t->last_y);
|
||||
t->last_x = ev->x;
|
||||
t->last_y = ev->y;
|
||||
}
|
||||
|
||||
float touch_tracker_get_velocity(touch_tracker *t, int axis)
|
||||
{
|
||||
if(axis == TRACKER_X)
|
||||
return ((((float)t->distance_x) / t->period) * 1000000) / DPI_MUL;
|
||||
else
|
||||
return ((((float)t->distance_y) / t->period) * 1000000) / DPI_MUL;
|
||||
}
|
||||
|
||||
float touch_tracker_get_velocity_abs(touch_tracker *t, int axis)
|
||||
{
|
||||
if(axis == TRACKER_X)
|
||||
return ((((float)t->distance_abs_x) / t->period) * 1000000) / DPI_MUL;
|
||||
else
|
||||
return ((((float)t->distance_abs_y) / t->period) * 1000000) / DPI_MUL;
|
||||
}
|
||||
11
main.c
11
main.c
@@ -26,10 +26,11 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "multirom.h"
|
||||
#include "framebuffer.h"
|
||||
#include "log.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/log.h"
|
||||
#include "version.h"
|
||||
#include "util.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/mrom_data.h"
|
||||
|
||||
#define EXEC_MASK (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
#define KEEP_REALDATA "/dev/.keep_realdata"
|
||||
@@ -84,6 +85,8 @@ int main(int argc, const char *argv[])
|
||||
// but it is possible to filter out INFO messages
|
||||
klog_set_level(6);
|
||||
|
||||
mrom_set_log_tag("multirom");
|
||||
|
||||
ERROR("Running MultiROM v%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX);
|
||||
|
||||
// root is mounted read only in android and MultiROM uses
|
||||
@@ -119,4 +122,4 @@ int main(int argc, const char *argv[])
|
||||
vt_set_mode(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
56
multirom.c
56
multirom.c
@@ -37,15 +37,16 @@
|
||||
#error "libbootimg version 0.2.0 or higher is required. Please update libbootimg."
|
||||
#endif
|
||||
|
||||
#include "lib/containers.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/input.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/mrom_data.h"
|
||||
#include "multirom.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "framebuffer.h"
|
||||
#include "input.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "version.h"
|
||||
#include "hooks.h"
|
||||
#include "containers.h"
|
||||
#include "rom_quirks.h"
|
||||
#include "kexec.h"
|
||||
#include "fw_mounter/fw_mounter_defines.h"
|
||||
@@ -62,7 +63,6 @@
|
||||
|
||||
#define BATTERY_CAP "/sys/class/power_supply/battery/capacity"
|
||||
|
||||
char multirom_dir[64] = { 0 };
|
||||
static char busybox_path[64] = { 0 };
|
||||
static char kexec_path[64] = { 0 };
|
||||
static char ntfs_path[64] = { 0 };
|
||||
@@ -92,7 +92,7 @@ int multirom_find_base_dir(void)
|
||||
if(stat(paths[i], &info) < 0)
|
||||
continue;
|
||||
|
||||
strcpy(multirom_dir, paths[i]);
|
||||
mrom_set_dir(paths[i]);
|
||||
|
||||
strncpy(partition_dir, paths[i], strchr(paths[i]+1, '/') - paths[i]);
|
||||
|
||||
@@ -385,7 +385,7 @@ int multirom_default_status(struct multirom_status *s)
|
||||
return -1;
|
||||
|
||||
char roms_path[256];
|
||||
sprintf(roms_path, "%s/roms/"INTERNAL_ROM_NAME, multirom_dir);
|
||||
sprintf(roms_path, "%s/roms/"INTERNAL_ROM_NAME, mrom_dir());
|
||||
DIR *d = opendir(roms_path);
|
||||
if(!d)
|
||||
{
|
||||
@@ -395,7 +395,7 @@ int multirom_default_status(struct multirom_status *s)
|
||||
else
|
||||
closedir(d);
|
||||
|
||||
sprintf(roms_path, "%s/roms", multirom_dir);
|
||||
sprintf(roms_path, "%s/roms", mrom_dir());
|
||||
d = opendir(roms_path);
|
||||
if(!d)
|
||||
{
|
||||
@@ -473,7 +473,7 @@ int multirom_load_status(struct multirom_status *s)
|
||||
multirom_default_status(s);
|
||||
|
||||
char arg[256];
|
||||
sprintf(arg, "%s/multirom.ini", multirom_dir);
|
||||
sprintf(arg, "%s/multirom.ini", mrom_dir());
|
||||
|
||||
FILE *f = fopen(arg, "r");
|
||||
if(!f)
|
||||
@@ -609,7 +609,7 @@ int multirom_save_status(struct multirom_status *s)
|
||||
char auto_boot_name[MAX_ROM_NAME_LEN+1];
|
||||
char current_name[MAX_ROM_NAME_LEN+1];
|
||||
|
||||
snprintf(path, sizeof(path), "%s/multirom.ini", multirom_dir);
|
||||
snprintf(path, sizeof(path), "%s/multirom.ini", mrom_dir());
|
||||
|
||||
FILE *f = fopen(path, "w");
|
||||
if(!f)
|
||||
@@ -853,7 +853,7 @@ int multirom_get_rom_type(struct multirom_rom *rom)
|
||||
// try to copy rom_info.txt in there, ubuntu is deprecated
|
||||
ERROR("Found deprecated Ubuntu 13.04, trying to copy rom_info.txt...\n");
|
||||
char *cmd[] = { busybox_path, "cp", malloc(256), malloc(256), NULL };
|
||||
sprintf(cmd[2], "%s/infos/ubuntu.txt", multirom_dir);
|
||||
sprintf(cmd[2], "%s/infos/ubuntu.txt", mrom_dir());
|
||||
sprintf(cmd[3], "%s/rom_info.txt", b);
|
||||
|
||||
int res = run_cmd(cmd);
|
||||
@@ -889,18 +889,18 @@ void multirom_import_internal(void)
|
||||
char path[256];
|
||||
|
||||
// multirom
|
||||
mkdir(multirom_dir, 0777);
|
||||
mkdir(mrom_dir(), 0777);
|
||||
|
||||
// roms
|
||||
snprintf(path, sizeof(path), "%s/roms", multirom_dir);
|
||||
snprintf(path, sizeof(path), "%s/roms", mrom_dir());
|
||||
mkdir(path, 0777);
|
||||
|
||||
// internal rom
|
||||
snprintf(path, sizeof(path), "%s/roms/%s", multirom_dir, INTERNAL_ROM_NAME);
|
||||
snprintf(path, sizeof(path), "%s/roms/%s", mrom_dir(), INTERNAL_ROM_NAME);
|
||||
mkdir(path, 0777);
|
||||
|
||||
// set default icon if it doesn't exist yet
|
||||
snprintf(path, sizeof(path), "%s/roms/%s/.icon_data", multirom_dir, INTERNAL_ROM_NAME);
|
||||
snprintf(path, sizeof(path), "%s/roms/%s/.icon_data", mrom_dir(), INTERNAL_ROM_NAME);
|
||||
if(access(path, F_OK) < 0)
|
||||
{
|
||||
FILE *f = fopen(path, "w");
|
||||
@@ -1111,7 +1111,7 @@ static int multirom_inject_fw_mounter(char *rc_with_mount_all, struct fstab_part
|
||||
fclose(f);
|
||||
|
||||
// copy fw_mounter to /sbin
|
||||
snprintf(line, sizeof(line), "%s/%s", multirom_dir, FW_MOUNTER_BIN);
|
||||
snprintf(line, sizeof(line), "%s/%s", mrom_dir(), FW_MOUNTER_BIN);
|
||||
copy_file(line, FW_MOUNTER_PATH);
|
||||
chmod(FW_MOUNTER_PATH, 0755);
|
||||
|
||||
@@ -1440,7 +1440,7 @@ int multirom_get_trampoline_ver(void)
|
||||
{
|
||||
ver = -1;
|
||||
|
||||
char buff[sizeof(multirom_dir) + 16];
|
||||
char buff[128];
|
||||
char *cmd[] = { buff, "-v", NULL };
|
||||
|
||||
// If we are booting into another ROM from already running system,
|
||||
@@ -1449,7 +1449,7 @@ int multirom_get_trampoline_ver(void)
|
||||
if(access("/main_init", F_OK) >= 0)
|
||||
snprintf(buff, sizeof(buff), "/init");
|
||||
else
|
||||
snprintf(buff, sizeof(buff), "%s/trampoline", multirom_dir);
|
||||
snprintf(buff, sizeof(buff), "%s/trampoline", mrom_dir());
|
||||
|
||||
char *res = run_get_stdout(cmd);
|
||||
if(res)
|
||||
@@ -2415,7 +2415,7 @@ int multirom_copy_log(char *klog, const char *dest_path_relative)
|
||||
if(klog)
|
||||
{
|
||||
char path[256];
|
||||
snprintf(path, sizeof(path), "%s/%s", multirom_dir, dest_path_relative);
|
||||
snprintf(path, sizeof(path), "%s/%s", mrom_dir(), dest_path_relative);
|
||||
FILE *f = fopen(path, "w");
|
||||
|
||||
if(f)
|
||||
@@ -2556,7 +2556,7 @@ int multirom_update_rd_trampoline(const char *path)
|
||||
else if(magic == 0x184C2102)
|
||||
{
|
||||
type = RD_LZ4;
|
||||
snprintf(buff, sizeof(buff), "cd /mrom_rd; \"%s/lz4\" -d \"%s\" stdout | \"%s\" cpio -i", multirom_dir, path, busybox_path);
|
||||
snprintf(buff, sizeof(buff), "cd /mrom_rd; \"%s/lz4\" -d \"%s\" stdout | \"%s\" cpio -i", mrom_dir(), path, busybox_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2614,7 +2614,7 @@ int multirom_update_rd_trampoline(const char *path)
|
||||
snprintf(buff, sizeof(buff), "B=\"%s\"; cd /mrom_rd; \"$B\" find . | \"$B\" cpio -o -H newc | \"$B\" gzip > \"%s\"", busybox_path, path);
|
||||
break;
|
||||
case RD_LZ4:
|
||||
snprintf(buff, sizeof(buff), "B=\"%s\"; cd /mrom_rd; \"$B\" find . | \"$B\" cpio -o -H newc | \"%s/lz4\" stdin \"%s\"", busybox_path, multirom_dir, path);
|
||||
snprintf(buff, sizeof(buff), "B=\"%s\"; cd /mrom_rd; \"$B\" find . | \"$B\" cpio -o -H newc | \"%s/lz4\" stdin \"%s\"", busybox_path, mrom_dir(), path);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2680,16 +2680,16 @@ void multirom_find_rom_icon(struct multirom_rom *rom)
|
||||
if(!ic_name)
|
||||
goto fail;
|
||||
|
||||
len = strlen(multirom_dir) + 6 + strlen(ic_name)+4+1; // + /icons + .png + \0
|
||||
len = strlen(mrom_dir()) + 6 + strlen(ic_name)+4+1; // + /icons + .png + \0
|
||||
rom->icon_path = malloc(len);
|
||||
snprintf(rom->icon_path, len, "%s/icons%s.png", multirom_dir, ic_name);
|
||||
snprintf(rom->icon_path, len, "%s/icons%s.png", mrom_dir(), ic_name);
|
||||
break;
|
||||
}
|
||||
case IC_TYPE_USER:
|
||||
{
|
||||
len = strlen(multirom_dir) + 1 + USER_IC_PATH_LEN + 1 + len + 4 + 1; // + / + / + .png + \0
|
||||
len = strlen(mrom_dir()) + 1 + USER_IC_PATH_LEN + 1 + len + 4 + 1; // + / + / + .png + \0
|
||||
rom->icon_path = malloc(len);
|
||||
snprintf(rom->icon_path, len, "%s/%s/%s.png", multirom_dir, USER_IC_PATH, buff);
|
||||
snprintf(rom->icon_path, len, "%s/%s/%s.png", mrom_dir(), USER_IC_PATH, buff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2702,7 +2702,7 @@ fail:
|
||||
if(f)
|
||||
fclose(f);
|
||||
|
||||
len = strlen(multirom_dir) + DEFAULT_ICON_LEN + 1;
|
||||
len = strlen(mrom_dir()) + DEFAULT_ICON_LEN + 1;
|
||||
rom->icon_path = realloc(rom->icon_path, len);
|
||||
snprintf(rom->icon_path, len, "%s%s", multirom_dir, DEFAULT_ICON);
|
||||
snprintf(rom->icon_path, len, "%s%s", mrom_dir(), DEFAULT_ICON);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fstab.h"
|
||||
#include "containers.h"
|
||||
#include "lib/fstab.h"
|
||||
#include "lib/containers.h"
|
||||
#include "kexec.h"
|
||||
|
||||
enum
|
||||
@@ -49,7 +49,7 @@ enum
|
||||
#define MASK_LINUX (M(ROM_LINUX_INTERNAL) | M(ROM_LINUX_USB))
|
||||
#define MASK_KEXEC (MASK_LINUX)
|
||||
|
||||
enum
|
||||
enum
|
||||
{
|
||||
EXIT_REBOOT = 0x01,
|
||||
EXIT_UMOUNT = 0x02,
|
||||
@@ -115,8 +115,6 @@ struct multirom_status
|
||||
struct fstab *fstab;
|
||||
};
|
||||
|
||||
extern char multirom_dir[64];
|
||||
|
||||
int multirom(const char *rom_to_boot);
|
||||
int multirom_find_base_dir(void);
|
||||
void multirom_emergency_reboot(void);
|
||||
|
||||
@@ -23,23 +23,25 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/input.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/listview.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/button.h"
|
||||
#include "lib/progressdots.h"
|
||||
#include "lib/workers.h"
|
||||
#include "lib/containers.h"
|
||||
#include "lib/animation.h"
|
||||
#include "lib/notification_card.h"
|
||||
#include "lib/tabview.h"
|
||||
#include "lib/colors.h"
|
||||
|
||||
#include "multirom_ui.h"
|
||||
#include "framebuffer.h"
|
||||
#include "input.h"
|
||||
#include "log.h"
|
||||
#include "listview.h"
|
||||
#include "util.h"
|
||||
#include "button.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "hooks.h"
|
||||
#include "version.h"
|
||||
#include "pong.h"
|
||||
#include "progressdots.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "workers.h"
|
||||
#include "hooks.h"
|
||||
#include "containers.h"
|
||||
#include "animation.h"
|
||||
#include "notification_card.h"
|
||||
#include "tabview.h"
|
||||
|
||||
static struct multirom_status *mrom_status = NULL;
|
||||
static struct multirom_rom *selected_rom = NULL;
|
||||
@@ -132,7 +134,7 @@ int multirom_ui(struct multirom_status *s, struct multirom_rom **to_boot)
|
||||
exit_ui_code = -1;
|
||||
selected_rom = NULL;
|
||||
|
||||
multirom_ui_select_color(s->colors);
|
||||
colors_select(s->colors);
|
||||
themes_info = multirom_ui_init_themes();
|
||||
if((cur_theme = multirom_ui_select_theme(themes_info, fb_width, fb_height)) == NULL)
|
||||
{
|
||||
@@ -214,7 +216,7 @@ int multirom_ui(struct multirom_status *s, struct multirom_rom **to_boot)
|
||||
fb_freeze(1);
|
||||
|
||||
multirom_ui_destroy_theme();
|
||||
multirom_ui_select_color(s->colors);
|
||||
colors_select(s->colors);
|
||||
multirom_ui_init_theme(TAB_MISC);
|
||||
|
||||
fb_freeze(0);
|
||||
@@ -272,7 +274,7 @@ int multirom_ui(struct multirom_status *s, struct multirom_rom **to_boot)
|
||||
|
||||
stop_input_thread();
|
||||
workers_stop();
|
||||
|
||||
|
||||
#if MR_DEVICE_HOOKS >= 2
|
||||
mrom_hook_before_fb_close();
|
||||
#endif
|
||||
@@ -509,6 +511,8 @@ void *multirom_ui_tab_rom_init(int tab_type)
|
||||
|
||||
if(tab_type == TAB_INTERNAL)
|
||||
multirom_ui_fill_rom_list(t->list, MASK_INTERNAL);
|
||||
else
|
||||
multirom_ui_fill_rom_list(t->list, MASK_USB_ROMS);
|
||||
|
||||
listview_update_ui(t->list);
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#define MULTIROM_UI_H
|
||||
|
||||
#include "multirom.h"
|
||||
#include "input.h"
|
||||
#include "listview.h"
|
||||
#include "lib/input.h"
|
||||
#include "lib/listview.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -15,18 +15,19 @@
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../multirom_ui.h"
|
||||
#include "../multirom_ui_themes.h"
|
||||
#include "../multirom.h"
|
||||
#include "../framebuffer.h"
|
||||
#include "../util.h"
|
||||
#include "../button.h"
|
||||
#include "../version.h"
|
||||
#include "../input.h"
|
||||
#include "../log.h"
|
||||
#include "../animation.h"
|
||||
#include "../notification_card.h"
|
||||
#include "../tabview.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "version.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/button.h"
|
||||
#include "lib/input.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/animation.h"
|
||||
#include "lib/notification_card.h"
|
||||
#include "lib/tabview.h"
|
||||
#include "lib/colors.h"
|
||||
|
||||
#define HEADER_HEIGHT (80*DPI_MUL)
|
||||
#define TABS_HEIGHT (HEADER_HEIGHT - STATUS_HEIGHT)
|
||||
@@ -152,13 +153,13 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
tabview_add_item(t->tabs, TAB_MISC, b->rect);
|
||||
tabview_add_item(t->tabs, TAB_MISC, b);
|
||||
|
||||
const int max_colors = multirom_ui_get_color_theme_count();
|
||||
const int max_colors = colors_count();
|
||||
x += (MISCBTN_W/2 - (max_colors*(CLRBTN_TOTAL+CLRBTN_MARGIN))/2);
|
||||
y += MISCBTN_H+30*DPI_MUL + (MISCBTN_H/2 - CLRBTN_TOTAL/2);
|
||||
fb_rect *r;
|
||||
for(i = 0; i < max_colors; ++i)
|
||||
{
|
||||
const struct multirom_color_theme *th = multirom_ui_get_color_theme(i);
|
||||
const struct mrom_color_theme *th = colors_get(i);
|
||||
|
||||
r = fb_add_rect(x, y, CLRBTN_TOTAL, CLRBTN_TOTAL, i == color_scheme ? 0xFFFFCC00 : WHITE);
|
||||
list_add(&d->ui_elements, r);
|
||||
@@ -15,18 +15,19 @@
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../multirom_ui.h"
|
||||
#include "../multirom_ui_themes.h"
|
||||
#include "../multirom.h"
|
||||
#include "../framebuffer.h"
|
||||
#include "../util.h"
|
||||
#include "../button.h"
|
||||
#include "../version.h"
|
||||
#include "../input.h"
|
||||
#include "../log.h"
|
||||
#include "../animation.h"
|
||||
#include "../notification_card.h"
|
||||
#include "../tabview.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "version.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/button.h"
|
||||
#include "lib/input.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/animation.h"
|
||||
#include "lib/notification_card.h"
|
||||
#include "lib/tabview.h"
|
||||
#include "lib/colors.h"
|
||||
|
||||
#define HEADER_HEIGHT (110*DPI_MUL)
|
||||
#define TABS_HEIGHT (HEADER_HEIGHT - STATUS_HEIGHT)
|
||||
@@ -212,12 +213,12 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
text->y = fb_height - text->h;
|
||||
list_add(&d->ui_elements, text);
|
||||
|
||||
const int max_colors = multirom_ui_get_color_theme_count();
|
||||
const int max_colors = colors_count();
|
||||
x = fb_width/2 - (max_colors*(CLRBTN_TOTAL+CLRBTN_MARGIN))/2;
|
||||
fb_rect *r;
|
||||
for(i = 0; i < max_colors; ++i)
|
||||
{
|
||||
const struct multirom_color_theme *th = multirom_ui_get_color_theme(i);
|
||||
const struct mrom_color_theme *th = colors_get(i);
|
||||
|
||||
r = fb_add_rect(x, CLRBTN_Y, CLRBTN_TOTAL, CLRBTN_TOTAL, i == color_scheme ? 0xFFFFCC00 : WHITE);
|
||||
list_add(&d->ui_elements, r);
|
||||
@@ -18,8 +18,8 @@
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/log.h"
|
||||
|
||||
multirom_themes_info *multirom_ui_init_themes(void)
|
||||
{
|
||||
@@ -67,140 +67,3 @@ multirom_theme *multirom_ui_select_theme(multirom_themes_info *i, int w, int h)
|
||||
|
||||
return universal;
|
||||
}
|
||||
|
||||
|
||||
static const struct multirom_color_theme color_themes[] = {
|
||||
// 0 - red/white, default
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFFF72F2F,
|
||||
.highlight_hover = 0xFFF85555,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFF0000FF,
|
||||
},
|
||||
// 1 - orange/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFFFF5722,
|
||||
.highlight_hover = 0xFFFF8A65,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 2 - blue/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF5677FC,
|
||||
.highlight_hover = 0xFF91A7FF,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 3 - purple/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF673AB7,
|
||||
.highlight_hover = 0xFF9575CD,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 4 - green/white
|
||||
{
|
||||
.background = 0xFFDCDCDC,
|
||||
.highlight_bg = 0xFF259B24,
|
||||
.highlight_hover = 0xFF72D572,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFF000000,
|
||||
.text_secondary = 0xFF4D4D4D,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFFFFFFFF,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 5 - dark blue
|
||||
{
|
||||
.background = 0xFF263238,
|
||||
.highlight_bg = 0xFF607D8B,
|
||||
.highlight_hover = 0xFF90A4AE,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFFFFFFFF,
|
||||
.text_secondary = 0xFFE6E6E6,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54000000,
|
||||
.rom_highlight = 0xFF607D8B,
|
||||
.rom_highlight_shadow = 0x54000000,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
// 6 - dark blue/black
|
||||
{
|
||||
.background = 0xFF000000,
|
||||
.highlight_bg = 0xFF263238,
|
||||
.highlight_hover = 0xFF607D8B,
|
||||
.highlight_text = 0xFFFFFFFF,
|
||||
.text = 0xFFFFFFFF,
|
||||
.text_secondary = 0xFFE6E6E6,
|
||||
.ncard_bg = 0xFF37474F,
|
||||
.ncard_text = 0xFFFFFFFF,
|
||||
.ncard_text_secondary = 0xFFE6E6E6,
|
||||
.ncard_shadow = 0x54424242,
|
||||
.rom_highlight = 0xFF263238,
|
||||
.rom_highlight_shadow = 0x54424242,
|
||||
.keyaction_frame = 0xFFFF0000,
|
||||
},
|
||||
};
|
||||
|
||||
const struct multirom_color_theme *color_theme = &color_themes[0];
|
||||
|
||||
void multirom_ui_select_color(size_t color_theme_idx)
|
||||
{
|
||||
if(color_theme_idx >= ARRAY_SIZE(color_themes))
|
||||
return;
|
||||
color_theme = &color_themes[color_theme_idx];
|
||||
}
|
||||
|
||||
const struct multirom_color_theme *multirom_ui_get_color_theme(size_t color_theme_idx)
|
||||
{
|
||||
if(color_theme_idx >= ARRAY_SIZE(color_themes))
|
||||
return NULL;
|
||||
return &color_themes[color_theme_idx];
|
||||
}
|
||||
|
||||
int multirom_ui_get_color_theme_count(void)
|
||||
{
|
||||
return ARRAY_SIZE(color_themes);
|
||||
}
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
#ifndef MULTIROM_UI_P_H
|
||||
#define MULTIROM_UI_P_H
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "button.h"
|
||||
#include "progressdots.h"
|
||||
#include "listview.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/button.h"
|
||||
#include "lib/progressdots.h"
|
||||
#include "lib/listview.h"
|
||||
#include "lib/tabview.h"
|
||||
#include "multirom_ui.h"
|
||||
#include "tabview.h"
|
||||
|
||||
// universal themes has these as width and height,
|
||||
// instead of real resolution
|
||||
#define TH_PORTRAIT (-1)
|
||||
#define TH_LANDSCAPE (-2)
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
listview *list;
|
||||
button **buttons;
|
||||
@@ -41,7 +41,7 @@ typedef struct
|
||||
progdots *usb_prog;
|
||||
} tab_data_roms;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
button **buttons;
|
||||
void **ui_elements;
|
||||
@@ -82,40 +82,4 @@ multirom_themes_info *multirom_ui_init_themes(void);
|
||||
void multirom_ui_free_themes(multirom_themes_info *info);
|
||||
multirom_theme *multirom_ui_select_theme(multirom_themes_info *i, int w, int h);
|
||||
|
||||
struct multirom_color_theme
|
||||
{
|
||||
uint32_t background;
|
||||
uint32_t highlight_bg;
|
||||
uint32_t highlight_hover;
|
||||
uint32_t highlight_text;
|
||||
uint32_t text;
|
||||
uint32_t text_secondary;
|
||||
uint32_t ncard_bg;
|
||||
uint32_t ncard_text;
|
||||
uint32_t ncard_text_secondary;
|
||||
uint32_t ncard_shadow;
|
||||
uint32_t rom_highlight;
|
||||
uint32_t rom_highlight_shadow;
|
||||
uint32_t keyaction_frame;
|
||||
};
|
||||
|
||||
extern const struct multirom_color_theme *color_theme;
|
||||
#define C_BACKGROUND (color_theme->background)
|
||||
#define C_HIGHLIGHT_BG (color_theme->highlight_bg)
|
||||
#define C_HIGHLIGHT_HOVER (color_theme->highlight_hover)
|
||||
#define C_HIGHLIGHT_TEXT (color_theme->highlight_text)
|
||||
#define C_TEXT (color_theme->text)
|
||||
#define C_TEXT_SECONDARY (color_theme->text_secondary)
|
||||
#define C_NCARD_BG (color_theme->ncard_bg)
|
||||
#define C_NCARD_TEXT (color_theme->ncard_text)
|
||||
#define C_NCARD_TEXT_SECONDARY (color_theme->ncard_text_secondary)
|
||||
#define C_NCARD_SHADOW (color_theme->ncard_shadow)
|
||||
#define C_ROM_HIGHLIGHT (color_theme->rom_highlight)
|
||||
#define C_ROM_HIGHLIGHT_SHADOW (color_theme->rom_highlight_shadow)
|
||||
#define C_KEYACT_FRAME (color_theme->keyaction_frame)
|
||||
|
||||
void multirom_ui_select_color(size_t color_theme_idx);
|
||||
const struct multirom_color_theme *multirom_ui_get_color_theme(size_t color_theme_idx);
|
||||
int multirom_ui_get_color_theme_count(void);
|
||||
|
||||
#endif
|
||||
|
||||
8
pong.c
8
pong.c
@@ -22,11 +22,11 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "input.h"
|
||||
#include "lib/framebuffer.h"
|
||||
#include "lib/input.h"
|
||||
#include "pong.h"
|
||||
#include "util.h"
|
||||
#include "containers.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/containers.h"
|
||||
|
||||
#define SCORE_SPACE (75*DPI_MUL)
|
||||
#define L 0
|
||||
|
||||
2
pong.h
2
pong.h
@@ -18,7 +18,7 @@
|
||||
#ifndef PONG_H
|
||||
#define PONG_H
|
||||
|
||||
#include "input.h"
|
||||
#include "lib/input.h"
|
||||
|
||||
void pong(void);
|
||||
int pong_touch_handler(touch_event *ev, void *data);
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include "multirom.h"
|
||||
#include "rom_quirks.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "lib/log.h"
|
||||
#include "lib/util.h"
|
||||
|
||||
#define MULTIROM_DIR_ANDROID "/data/media/0/multirom"
|
||||
#define MULTIROM_DIR_ANDROID_LEN 22
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_C_INCLUDES += $(multirom_local_path)
|
||||
LOCAL_C_INCLUDES += $(multirom_local_path) $(multirom_local_path)/lib
|
||||
LOCAL_SRC_FILES:= \
|
||||
trampoline.c \
|
||||
devices.c \
|
||||
../util.c \
|
||||
adb.c \
|
||||
../fstab.c \
|
||||
../containers.c
|
||||
|
||||
LOCAL_MODULE:= trampoline
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc
|
||||
LOCAL_STATIC_LIBRARIES := libcutils libc libmultirom_static
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
||||
LOCAL_CFLAGS += -DMR_LOG_TAG=\"trampoline\"
|
||||
|
||||
ifeq ($(MR_INIT_DEVICES),)
|
||||
$(info MR_INIT_DEVICES was not defined in device files!)
|
||||
endif
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <linux/loop.h>
|
||||
|
||||
#include "adb.h"
|
||||
#include "../util.h"
|
||||
#include "../log.h"
|
||||
#include "../lib/util.h"
|
||||
#include "../lib/log.h"
|
||||
|
||||
static pthread_t adb_thread;
|
||||
static volatile int run_thread = 0;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
#include <cutils/uevent.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "../util.h"
|
||||
#include "../log.h"
|
||||
#include "../lib/util.h"
|
||||
#include "../lib/log.h"
|
||||
|
||||
//#define DEBUG_MISSING_UEVENTS 1
|
||||
|
||||
@@ -610,7 +610,7 @@ static char **parse_platform_block_device(struct uevent *uevent)
|
||||
p = strdup(uevent->partition_name);
|
||||
sanitize(p);
|
||||
if (strcmp(uevent->partition_name, p))
|
||||
NOTICE("Linking partition '%s' as '%s'\n", uevent->partition_name, p);
|
||||
INFO("Linking partition '%s' as '%s'\n", uevent->partition_name, p);
|
||||
if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0)
|
||||
link_num++;
|
||||
else
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "../log.h"
|
||||
#include "../util.h"
|
||||
#include "../lib/log.h"
|
||||
#include "../lib/util.h"
|
||||
#include "../lib/fstab.h"
|
||||
#include "../version.h"
|
||||
#include "adb.h"
|
||||
#include "../fstab.h"
|
||||
#include "../hooks.h"
|
||||
|
||||
#define EXEC_MASK (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
@@ -260,6 +260,7 @@ int main(int argc, char *argv[])
|
||||
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
||||
|
||||
klog_init();
|
||||
mrom_set_log_tag("trampoline");
|
||||
ERROR("Running trampoline v%d\n", VERSION_TRAMPOLINE);
|
||||
|
||||
if(is_charger_mode())
|
||||
|
||||
@@ -5,17 +5,12 @@ LOCAL_MODULE:= trampoline_encmnt
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libcryptfslollipop
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libcryptfslollipop libmultirom
|
||||
|
||||
mr_twrp_path := bootable/recovery
|
||||
LOCAL_C_INCLUDES += $(multirom_local_path) $(mr_twrp_path) $(mr_twrp_path)/crypto/scrypt/lib/crypto external/openssl/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
encmnt.c \
|
||||
../fstab.c \
|
||||
../containers.c \
|
||||
../util.c \
|
||||
|
||||
LOCAL_CFLAGS += -DMR_LOG_TAG=\"trampoline_encmnt\"
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../log.h"
|
||||
#include "../fstab.h"
|
||||
#include "../lib/log.h"
|
||||
#include "../lib/fstab.h"
|
||||
|
||||
#include "crypto/lollipop/cryptfs.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user