Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f730f4a08e | ||
|
|
ec64658a6a | ||
|
|
86db030bda | ||
|
|
d27832effb | ||
|
|
5057bb2863 | ||
|
|
963987d639 | ||
|
|
3f80693d9e | ||
|
|
5485f5ca06 | ||
|
|
981e5435ea | ||
|
|
99c2abeaf3 |
2
Makefile
2
Makefile
@@ -11,7 +11,7 @@ include $(DEVKITARM)/base_rules
|
|||||||
IPL_LOAD_ADDR := 0x40003000
|
IPL_LOAD_ADDR := 0x40003000
|
||||||
LPVERSION_MAJOR := 3
|
LPVERSION_MAJOR := 3
|
||||||
LPVERSION_MINOR := 0
|
LPVERSION_MINOR := 0
|
||||||
LPVERSION_BUGFX := 0
|
LPVERSION_BUGFX := 1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -5929,6 +5929,7 @@ FRESULT f_mkfs (
|
|||||||
|
|
||||||
#if FF_FS_EXFAT
|
#if FF_FS_EXFAT
|
||||||
if (fmt == FS_EXFAT) { /* Create an exFAT volume */
|
if (fmt == FS_EXFAT) { /* Create an exFAT volume */
|
||||||
|
LEAVE_MKFS(FR_NO_FILESYSTEM); // Muh frii bytes
|
||||||
DWORD szb_bit, szb_case, sum, nb, cl;
|
DWORD szb_bit, szb_case, sum, nb, cl;
|
||||||
WCHAR ch, si;
|
WCHAR ch, si;
|
||||||
UINT j, st;
|
UINT j, st;
|
||||||
|
|||||||
@@ -37,9 +37,8 @@ ErrCode_t FileCopy(const char *locin, const char *locout, u8 options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options & COPY_MODE_PRINT){
|
if (options & COPY_MODE_PRINT){
|
||||||
gfx_printf("[ ]");
|
gfx_printf("[ 0%%]");
|
||||||
x += 16;
|
x += 16;
|
||||||
gfx_con_setpos(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buff = malloc(TConf.FSBuffSize);
|
buff = malloc(TConf.FSBuffSize);
|
||||||
@@ -62,8 +61,8 @@ ErrCode_t FileCopy(const char *locin, const char *locout, u8 options){
|
|||||||
sizeRemaining -= toCopy;
|
sizeRemaining -= toCopy;
|
||||||
|
|
||||||
if (options & COPY_MODE_PRINT){
|
if (options & COPY_MODE_PRINT){
|
||||||
gfx_printf("%3d%%", (u32)(((totalsize - sizeRemaining) * 100) / totalsize));
|
|
||||||
gfx_con_setpos(x, y);
|
gfx_con_setpos(x, y);
|
||||||
|
gfx_printf("%3d%%", (u32)(((totalsize - sizeRemaining) * 100) / totalsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & COPY_MODE_CANCEL && btn_read() & (BTN_VOL_DOWN | BTN_VOL_UP)){
|
if (options & COPY_MODE_CANCEL && btn_read() & (BTN_VOL_DOWN | BTN_VOL_UP)){
|
||||||
@@ -78,6 +77,10 @@ ErrCode_t FileCopy(const char *locin, const char *locout, u8 options){
|
|||||||
|
|
||||||
f_chmod(locout, in_info.fattrib, 0x3A);
|
f_chmod(locout, in_info.fattrib, 0x3A);
|
||||||
|
|
||||||
|
if (options & COPY_MODE_PRINT){
|
||||||
|
gfx_con_setpos(x - 16, y);
|
||||||
|
}
|
||||||
|
|
||||||
//f_stat(locin, &in_info); //somehow stops fatfs from being weird
|
//f_stat(locin, &in_info); //somehow stops fatfs from being weird
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ typedef struct {
|
|||||||
};
|
};
|
||||||
u16 sizeUnion;
|
u16 sizeUnion;
|
||||||
};
|
};
|
||||||
} FSEntry_t;
|
} FSEntry_t;
|
||||||
|
|
||||||
|
#define newFSEntry(filename) (FSEntry_t) {.name = filename}
|
||||||
@@ -59,7 +59,8 @@ void DeleteFile(char *path, FSEntry_t entry){
|
|||||||
gfx_con_setpos(384 + 16, 200 + 16 + 10 * 16);
|
gfx_con_setpos(384 + 16, 200 + 16 + 10 * 16);
|
||||||
SETCOLOR(COLOR_RED, COLOR_DARKGREY);
|
SETCOLOR(COLOR_RED, COLOR_DARKGREY);
|
||||||
gfx_printf("Are you sure? ");
|
gfx_printf("Are you sure? ");
|
||||||
|
|
||||||
|
WaitFor(500);
|
||||||
if (!MakeYesNoHorzMenu(3, COLOR_DARKGREY))
|
if (!MakeYesNoHorzMenu(3, COLOR_DARKGREY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ void RunScript(char *path, FSEntry_t entry){
|
|||||||
|
|
||||||
gfx_clearscreen();
|
gfx_clearscreen();
|
||||||
scriptCtx_t ctx = createScriptCtx();
|
scriptCtx_t ctx = createScriptCtx();
|
||||||
ctx.script = runLexar(script, size);
|
ctx.script = runLexer(script, size);
|
||||||
free(script);
|
free(script);
|
||||||
|
|
||||||
dictVectorAdd(&ctx.varDict, newDict(CpyStr("_CWD"), (newVar(StringType, 0, .stringType = path))));
|
dictVectorAdd(&ctx.varDict, newDict(CpyStr("_CWD"), (newVar(StringType, 0, .stringType = path))));
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
|
|
||||||
typedef void (*fileMenuPath)(char *path, FSEntry_t entry);
|
typedef void (*fileMenuPath)(char *path, FSEntry_t entry);
|
||||||
|
|
||||||
void FileMenu(char *path, FSEntry_t entry);
|
void FileMenu(char *path, FSEntry_t entry);
|
||||||
|
void RunScript(char *path, FSEntry_t entry);
|
||||||
@@ -121,6 +121,7 @@ static const u8 _gfx_font[] = {
|
|||||||
0x00, 0x00, 0x00, 0x4C, 0x32, 0x00, 0x00, 0x00, // Char 126 (~)
|
0x00, 0x00, 0x00, 0x4C, 0x32, 0x00, 0x00, 0x00, // Char 126 (~)
|
||||||
0x00, 0x0C, 0x12, 0x7E, 0x42, 0x42, 0x7E, 0x00, // Char 127 (folder)
|
0x00, 0x0C, 0x12, 0x7E, 0x42, 0x42, 0x7E, 0x00, // Char 127 (folder)
|
||||||
0x00, 0x0E, 0x12, 0x22, 0x22, 0x22, 0x3E, 0x00, // Char 128 (file)
|
0x00, 0x0E, 0x12, 0x22, 0x22, 0x22, 0x3E, 0x00, // Char 128 (file)
|
||||||
|
0x00, 0x08, 0x0C, 0x0E, 0x7E, 0x70, 0x30, 0x10, // Char 129 (Charging)
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 YLeftConfig = YLEFT;
|
u32 YLeftConfig = YLEFT;
|
||||||
@@ -188,7 +189,7 @@ void gfx_putc(char c)
|
|||||||
switch (gfx_con.fntsz)
|
switch (gfx_con.fntsz)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
if (c >= 32 && c <= 128)
|
if (c >= 32 && c <= 129)
|
||||||
{
|
{
|
||||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
||||||
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
||||||
@@ -265,7 +266,7 @@ void gfx_putc(char c)
|
|||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
default:
|
default:
|
||||||
if (c >= 30 && c <= 126)
|
if (c >= 30 && c <= 129)
|
||||||
{
|
{
|
||||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
||||||
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
#include "gfxutils.h"
|
#include "gfxutils.h"
|
||||||
#include <power/max17050.h>
|
#include <power/max17050.h>
|
||||||
|
#include <power/max17050.h>
|
||||||
|
#include <power/bq24193.h>
|
||||||
#include "../hid/hid.h"
|
#include "../hid/hid.h"
|
||||||
|
|
||||||
void gfx_clearscreen(){
|
void gfx_printTopInfo() {
|
||||||
int battery = 0;
|
int battery = 0;
|
||||||
max17050_get_property(MAX17050_RepSOC, &battery);
|
max17050_get_property(MAX17050_RepSOC, &battery);
|
||||||
|
|
||||||
//gfx_clear_grey(0x1B);
|
int current_charge_status = 0;
|
||||||
gfx_boxGrey(0, 16, 1279, 703, 0x1b);
|
bq24193_get_property(BQ24193_ChargeStatus, ¤t_charge_status);
|
||||||
SETCOLOR(COLOR_DEFAULT, COLOR_WHITE);
|
SETCOLOR(COLOR_DEFAULT, COLOR_WHITE);
|
||||||
|
gfx_con_setpos(0, 0);
|
||||||
|
gfx_printf("Tegraexplorer %d.%d.%d | Battery: %d%% %c\n", LP_VER_MJ, LP_VER_MN, LP_VER_BF, battery >> 8, ((current_charge_status) ? 129 : 32));
|
||||||
|
RESETCOLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gfx_clearscreen(){
|
||||||
|
gfx_boxGrey(0, 16, 1279, 703, 0x1b);
|
||||||
|
|
||||||
gfx_boxGrey(0, 703, 1279, 719, 0xFF);
|
gfx_boxGrey(0, 703, 1279, 719, 0xFF);
|
||||||
gfx_boxGrey(0, 0, 1279, 15, 0xFF);
|
gfx_boxGrey(0, 0, 1279, 15, 0xFF);
|
||||||
gfx_con_setpos(0, 0);
|
|
||||||
gfx_printf("Tegraexplorer %d.%d.%d | Battery: %3d%%\n", LP_VER_MJ, LP_VER_MN, LP_VER_BF, battery >> 8);
|
|
||||||
|
|
||||||
RESETCOLOR;
|
|
||||||
|
gfx_printTopInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuEntry_t YesNoEntries[] = {
|
MenuEntry_t YesNoEntries[] = {
|
||||||
|
|||||||
@@ -15,4 +15,5 @@
|
|||||||
|
|
||||||
void gfx_clearscreen();
|
void gfx_clearscreen();
|
||||||
int MakeHorizontalMenu(MenuEntry_t *entries, int len, int spacesBetween, u32 bg, int startPos);
|
int MakeHorizontalMenu(MenuEntry_t *entries, int len, int spacesBetween, u32 bg, int startPos);
|
||||||
int MakeYesNoHorzMenu(int spacesBetween, u32 bg);
|
int MakeYesNoHorzMenu(int spacesBetween, u32 bg);
|
||||||
|
void gfx_printTopInfo();
|
||||||
@@ -160,8 +160,10 @@ int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 op
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
holdTimer = 300;
|
holdTimer = 300;
|
||||||
|
gfx_printTopInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPress = get_tmr_ms();
|
lastPress = get_tmr_ms();
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <utils/types.h>
|
#include <utils/types.h>
|
||||||
#include <utils/util.h>
|
#include <utils/util.h>
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
|
#include "../tegraexplorer/tools.h"
|
||||||
|
#include <gfx/di.h>
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
static Input_t inputs = {0};
|
static Input_t inputs = {0};
|
||||||
u16 LbaseX = 0, LbaseY = 0, RbaseX = 0, RbaseY = 0;
|
u16 LbaseX = 0, LbaseY = 0, RbaseX = 0, RbaseY = 0;
|
||||||
@@ -13,15 +16,22 @@ void hidInit(){
|
|||||||
jc_init_hw();
|
jc_init_hw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern hekate_config h_cfg;
|
||||||
|
|
||||||
Input_t *hidRead(){
|
Input_t *hidRead(){
|
||||||
jc_gamepad_rpt_t *controller = joycon_poll();
|
jc_gamepad_rpt_t *controller = joycon_poll();
|
||||||
|
|
||||||
//if (controller->cap)
|
if (h_cfg.t210b01){ // Disable home and capture buttons on mariko to avoid weird behaviour
|
||||||
// utils_takeScreenshot();
|
controller->home = 0;
|
||||||
|
controller->cap = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller->home)
|
if (controller->home)
|
||||||
RebootToPayloadOrRcm();
|
RebootToPayloadOrRcm();
|
||||||
|
|
||||||
|
if (controller->cap)
|
||||||
|
TakeScreenshot();
|
||||||
|
|
||||||
inputs.buttons = controller->buttons;
|
inputs.buttons = controller->buttons;
|
||||||
|
|
||||||
u8 btn = btn_read();
|
u8 btn = btn_read();
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
#include "keys/keys.h"
|
#include "keys/keys.h"
|
||||||
#include "keys/keyfile.h"
|
#include "keys/keyfile.h"
|
||||||
#include "storage/mountmanager.h"
|
#include "storage/mountmanager.h"
|
||||||
|
#include "fs/fsutils.h"
|
||||||
|
#include "fs/fstypes.h"
|
||||||
|
#include "fs/menus/filemenu.h"
|
||||||
|
|
||||||
|
|
||||||
hekate_config h_cfg;
|
hekate_config h_cfg;
|
||||||
@@ -304,6 +307,10 @@ void ipl_main()
|
|||||||
|
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
hidWait();
|
hidWait();
|
||||||
|
|
||||||
|
if (FileExists("sd:/startup.te"))
|
||||||
|
RunScript("sd:/", newFSEntry("startup.te"));
|
||||||
|
|
||||||
EnterMainMenu();
|
EnterMainMenu();
|
||||||
|
|
||||||
// Halt BPMP if we managed to get out of execution.
|
// Halt BPMP if we managed to get out of execution.
|
||||||
|
|||||||
@@ -132,42 +132,44 @@ Variable_t getVarFromToken(scriptCtx_t* ctx, lexarToken_t* tokens, int* index, u
|
|||||||
|
|
||||||
val = executeFunction(ctx, tokens[i - 2].text, &tokens[i], argCount);
|
val = executeFunction(ctx, tokens[i - 2].text, &tokens[i], argCount);
|
||||||
|
|
||||||
//val = IntValue(1);
|
|
||||||
i += argCount;
|
i += argCount;
|
||||||
}
|
}
|
||||||
ELIFTX(LSBracket) {
|
ELIFTX(LSBracket) {
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
int argCount = distanceBetweenTokens(&tokens[i], maxLen - 1, LSBracket, RSBracket);
|
int argCount = distanceBetweenTokens(&tokens[i], maxLen - 1, LSBracket, RSBracket);
|
||||||
if (argCount <= 0)
|
if (argCount < 0)
|
||||||
return ErrValue(ERRSYNTAX);
|
return ErrValue(ERRSYNTAX);
|
||||||
|
|
||||||
// ArrayVars should be a Vector_t containing Variable_t's. Not implemented yet!
|
val.varType = EmptyArrayType;
|
||||||
Vector_t arrayVars = extractVars(ctx, &tokens[i], argCount);
|
|
||||||
Variable_t* variables = vecGetArray(Variable_t*, arrayVars);
|
|
||||||
int type = variables[0].varType;
|
|
||||||
if (!(type == StringType || type == IntType))
|
|
||||||
return ErrValue(ERRINVALIDTYPE);
|
|
||||||
|
|
||||||
val.varType = (type + 2);
|
if (argCount > 0){
|
||||||
val.free = 1;
|
Vector_t arrayVars = extractVars(ctx, &tokens[i], argCount);
|
||||||
val.vectorType = newVec((type == IntType) ? sizeof(int) : sizeof(char*), arrayVars.count);
|
Variable_t* variables = vecGetArray(Variable_t*, arrayVars);
|
||||||
|
int type = variables[0].varType;
|
||||||
|
if (!(type == StringType || type == IntType))
|
||||||
|
return ErrValue(ERRINVALIDTYPE);
|
||||||
|
|
||||||
for (int i = 0; i < arrayVars.count; i++) {
|
val.varType = (type + 2);
|
||||||
if (variables[i].varType != type)
|
val.free = 1;
|
||||||
return ErrValue(ERRINVALIDTYPE); // Free-ing issue!!
|
val.vectorType = newVec((type == IntType) ? sizeof(int) : sizeof(char*), arrayVars.count);
|
||||||
|
|
||||||
if (type == StringType) {
|
for (int j = 0; j < arrayVars.count; j++) {
|
||||||
char* temp = CpyStr(variables[i].stringType);
|
if (variables[j].varType != type)
|
||||||
vecAddElement(&val.vectorType, temp);
|
return ErrValue(ERRINVALIDTYPE); // Free-ing issue!!
|
||||||
}
|
|
||||||
else {
|
if (type == StringType) {
|
||||||
vecAddElement(&val.vectorType, variables[i].integerType);
|
char* temp = CpyStr(variables[j].stringType);
|
||||||
|
vecAddElement(&val.vectorType, temp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vecAddElement(&val.vectorType, variables[j].integerType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i += argCount;
|
||||||
|
freeVariableVector(&arrayVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
i += argCount;
|
|
||||||
freeVariableVector(&arrayVars);
|
|
||||||
}
|
}
|
||||||
ELIFTX(LBracket) {
|
ELIFTX(LBracket) {
|
||||||
i++;
|
i++;
|
||||||
@@ -397,6 +399,43 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
|
|||||||
else
|
else
|
||||||
return ErrValue(ERRBADOPERATOR);
|
return ErrValue(ERRBADOPERATOR);
|
||||||
}
|
}
|
||||||
|
else if (res.varType == EmptyArrayType && localOpToken == Plus){
|
||||||
|
res.free = 1;
|
||||||
|
res.varType = val.varType + 2;
|
||||||
|
|
||||||
|
if (val.varType == IntType){
|
||||||
|
res.vectorType = newVec(sizeof(int), 4);
|
||||||
|
vecAddElem(&res.vectorType, val.integerType);
|
||||||
|
}
|
||||||
|
else if (val.varType == StringType) {
|
||||||
|
res.vectorType = newVec(sizeof(char*), 4);
|
||||||
|
char *temp = CpyStr(val.stringType);
|
||||||
|
vecAddElem(&res.vectorType, temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return ErrValue(ERRBADOPERATOR);
|
||||||
|
|
||||||
|
freeVariable(val);
|
||||||
|
}
|
||||||
|
else if (res.varType == StringArrayType && val.varType == StringType){
|
||||||
|
if (localOpToken == Plus){
|
||||||
|
Vector_t new = vecCopy(&res.vectorType);
|
||||||
|
vecDefArray(char **, strings, new);
|
||||||
|
for (int j = 0; j < new.count; j++){
|
||||||
|
strings[j] = CpyStr(strings[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
freeVariable(res);
|
||||||
|
|
||||||
|
char *temp = CpyStr(val.stringType);
|
||||||
|
vecAddElem(&new, temp);
|
||||||
|
|
||||||
|
res.free = 1;
|
||||||
|
res.vectorType = new;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return ErrValue(ERRBADOPERATOR);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return ErrValue(ERRBADOPERATOR);
|
return ErrValue(ERRBADOPERATOR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,8 @@ ColorCombo_t combos[] = {
|
|||||||
{"YELLOW", COLOR_YELLOW},
|
{"YELLOW", COLOR_YELLOW},
|
||||||
{"GREEN", COLOR_GREEN},
|
{"GREEN", COLOR_GREEN},
|
||||||
{"BLUE", COLOR_BLUE},
|
{"BLUE", COLOR_BLUE},
|
||||||
{"VIOLET", COLOR_VIOLET}
|
{"VIOLET", COLOR_VIOLET},
|
||||||
|
{"GREY", COLOR_GREY},
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 GetColor(char *color){
|
u32 GetColor(char *color){
|
||||||
@@ -256,16 +257,26 @@ scriptFunction(funcMakeMenu){
|
|||||||
Vector_t menuEntries = newVec(sizeof(MenuEntry_t), vars[0].vectorType.count);
|
Vector_t menuEntries = newVec(sizeof(MenuEntry_t), vars[0].vectorType.count);
|
||||||
vecDefArray(char**, names, vars[0].vectorType);
|
vecDefArray(char**, names, vars[0].vectorType);
|
||||||
char **colors;
|
char **colors;
|
||||||
if (varLen == 3)
|
if (varLen >= 3)
|
||||||
colors = vecGetArray(char**, vars[2].vectorType);
|
colors = vecGetArray(char**, vars[2].vectorType);
|
||||||
|
|
||||||
|
int *options;
|
||||||
|
if (varLen == 4)
|
||||||
|
options = vecGetArray(int*, vars[3].vectorType);
|
||||||
|
|
||||||
for (int i = 0; i < vars[0].vectorType.count; i++){
|
for (int i = 0; i < vars[0].vectorType.count; i++){
|
||||||
u32 color = COLORTORGB(((varLen == 3) ? GetColor(colors[i]) : COLOR_WHITE));
|
u32 color = COLORTORGB(((varLen >= 3) ? GetColor(colors[i]) : COLOR_WHITE));
|
||||||
MenuEntry_t a = {.optionUnion = color, .name = names[i]};
|
MenuEntry_t a = {.optionUnion = color, .name = names[i]};
|
||||||
|
|
||||||
|
if (varLen == 4){
|
||||||
|
a.skip = (options[i] & 1) ? 1 : 0;
|
||||||
|
a.hide = (options[i] & 2) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
vecAddElem(&menuEntries, a);
|
vecAddElem(&menuEntries, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = newMenu(&menuEntries, vars[1].integerType, 78, 10, ENABLEB, menuEntries.count);
|
int res = newMenu(&menuEntries, vars[1].integerType, 78, 10, ENABLEB | ALWAYSREDRAW, menuEntries.count);
|
||||||
vecFree(menuEntries);
|
vecFree(menuEntries);
|
||||||
return varInt(res);
|
return varInt(res);
|
||||||
}
|
}
|
||||||
@@ -332,6 +343,7 @@ scriptFunction(funcMkdir){
|
|||||||
return varInt((f_mkdir(vars[0].stringType)));
|
return varInt((f_mkdir(vars[0].stringType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
scriptFunction(funcReadDir){
|
scriptFunction(funcReadDir){
|
||||||
int res = 0;
|
int res = 0;
|
||||||
Vector_t files = ReadFolder(vars[0].stringType, &res);
|
Vector_t files = ReadFolder(vars[0].stringType, &res);
|
||||||
@@ -358,26 +370,32 @@ scriptFunction(funcReadDir){
|
|||||||
return newVar(StringArrayType, 1, .vectorType = fileNames);
|
return newVar(StringArrayType, 1, .vectorType = fileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str, Str
|
||||||
scriptFunction(funcCopyDir){
|
scriptFunction(funcCopyDir){
|
||||||
return varInt((FolderCopy(vars[0].stringType, vars[1].stringType).err));
|
return varInt((FolderCopy(vars[0].stringType, vars[1].stringType).err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
scriptFunction(funcDelDir){
|
scriptFunction(funcDelDir){
|
||||||
return varInt((FolderDelete(vars[0].stringType).err));
|
return varInt((FolderDelete(vars[0].stringType).err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
scriptFunction(funcDelFile){
|
scriptFunction(funcDelFile){
|
||||||
return varInt((f_unlink(vars[0].stringType)));
|
return varInt((f_unlink(vars[0].stringType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str, Str
|
||||||
scriptFunction(funcMmcDump){
|
scriptFunction(funcMmcDump){
|
||||||
return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 0, 1).err));
|
return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 0, 1).err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str, Str, Int
|
||||||
scriptFunction(funcMmcRestore){
|
scriptFunction(funcMmcRestore){
|
||||||
return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 1, vars[2].integerType).err));
|
return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 1, vars[2].integerType).err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
scriptFunction(funcGetNcaType){
|
scriptFunction(funcGetNcaType){
|
||||||
if (!TConf.keysDumped)
|
if (!TConf.keysDumped)
|
||||||
return ErrVar(ERRFATALFUNCFAIL);
|
return ErrVar(ERRFATALFUNCFAIL);
|
||||||
@@ -385,6 +403,7 @@ scriptFunction(funcGetNcaType){
|
|||||||
return varInt((GetNcaType(vars[0].stringType)));
|
return varInt((GetNcaType(vars[0].stringType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
scriptFunction(funcSignSave){
|
scriptFunction(funcSignSave){
|
||||||
if (!TConf.keysDumped)
|
if (!TConf.keysDumped)
|
||||||
return ErrVar(ERRFATALFUNCFAIL);
|
return ErrVar(ERRFATALFUNCFAIL);
|
||||||
@@ -396,6 +415,13 @@ scriptFunction(funcGetMs){
|
|||||||
return varInt(get_tmr_ms());
|
return varInt(get_tmr_ms());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int launch_payload(char *path);
|
||||||
|
|
||||||
|
// Args: Str
|
||||||
|
scriptFunction(funcLaunchPayload){
|
||||||
|
return varInt(launch_payload(vars[0].stringType));
|
||||||
|
}
|
||||||
|
|
||||||
u8 fiveInts[] = {IntType, IntType, IntType, IntType, IntType};
|
u8 fiveInts[] = {IntType, IntType, IntType, IntType, IntType};
|
||||||
u8 singleIntArray[] = { IntArrayType };
|
u8 singleIntArray[] = { IntArrayType };
|
||||||
u8 singleInt[] = { IntType };
|
u8 singleInt[] = { IntType };
|
||||||
@@ -403,7 +429,7 @@ u8 singleAny[] = { varArgs };
|
|||||||
u8 singleStr[] = { StringType };
|
u8 singleStr[] = { StringType };
|
||||||
u8 singleByteArr[] = { ByteArrayType };
|
u8 singleByteArr[] = { ByteArrayType };
|
||||||
u8 StrByteVec[] = { StringType, ByteArrayType};
|
u8 StrByteVec[] = { StringType, ByteArrayType};
|
||||||
u8 MenuArgs[] = { StringArrayType, IntType, StringArrayType};
|
u8 MenuArgs[] = { StringArrayType, IntType, StringArrayType, IntArrayType};
|
||||||
u8 twoStrings[] = { StringType, StringType };
|
u8 twoStrings[] = { StringType, StringType };
|
||||||
u8 mmcReadWrite[] = { StringType, StringType, IntType};
|
u8 mmcReadWrite[] = { StringType, StringType, IntType};
|
||||||
|
|
||||||
@@ -432,6 +458,7 @@ functionStruct_t scriptFunctions[] = {
|
|||||||
{"version", funcGetVer, 0, NULL},
|
{"version", funcGetVer, 0, NULL},
|
||||||
{"menu", funcMakeMenu, 2, MenuArgs}, // for the optional arg
|
{"menu", funcMakeMenu, 2, MenuArgs}, // for the optional arg
|
||||||
{"menu", funcMakeMenu, 3, MenuArgs},
|
{"menu", funcMakeMenu, 3, MenuArgs},
|
||||||
|
{"menu", funcMakeMenu, 4, MenuArgs},
|
||||||
{"pathCombine", funcCombinePath, varArgs, NULL},
|
{"pathCombine", funcCombinePath, varArgs, NULL},
|
||||||
{"pathEscFolder", funcEscFolder, 1, singleStr},
|
{"pathEscFolder", funcEscFolder, 1, singleStr},
|
||||||
{"fileMove", funcFileMove, 2, twoStrings},
|
{"fileMove", funcFileMove, 2, twoStrings},
|
||||||
@@ -448,6 +475,7 @@ functionStruct_t scriptFunctions[] = {
|
|||||||
{"ncaGetType", funcGetNcaType, 1, singleStr},
|
{"ncaGetType", funcGetNcaType, 1, singleStr},
|
||||||
{"saveSign", funcSignSave, 1, singleStr},
|
{"saveSign", funcSignSave, 1, singleStr},
|
||||||
{"timerMs", funcGetMs, 0, NULL},
|
{"timerMs", funcGetMs, 0, NULL},
|
||||||
|
{"launchPayload", funcLaunchPayload, 1, singleStr},
|
||||||
// Left from old: keyboard(?)
|
// Left from old: keyboard(?)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void lexarVectorClear(Vector_t *v){
|
|||||||
|
|
||||||
#define ELIFC(c) else if (*in == c)
|
#define ELIFC(c) else if (*in == c)
|
||||||
|
|
||||||
Vector_t runLexar(const char* in, u32 len) {
|
Vector_t runLexer(const char* in, u32 len) {
|
||||||
const char *start = in;
|
const char *start = in;
|
||||||
Vector_t vec = newVec(sizeof(lexarToken_t), 16);
|
Vector_t vec = newVec(sizeof(lexarToken_t), 16);
|
||||||
// store last var for re-assignment
|
// store last var for re-assignment
|
||||||
@@ -251,16 +251,24 @@ Vector_t runLexar(const char* in, u32 len) {
|
|||||||
vecAddElement(&vec, makeLexarToken(BitShiftRight, 0));
|
vecAddElement(&vec, makeLexarToken(BitShiftRight, 0));
|
||||||
in++;
|
in++;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
int a = (in[1] == '=') ? 1 : 0;
|
||||||
vecAddElement(&vec, makeLexarToken(Bigger, 0));
|
vecAddElement(&vec, makeLexarToken(Bigger, 0));
|
||||||
|
in += a;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ELIFC('<'){
|
ELIFC('<'){
|
||||||
if (in[1] == '<'){
|
if (in[1] == '<'){
|
||||||
vecAddElement(&vec, makeLexarToken(BitShiftLeft, 0));
|
vecAddElement(&vec, makeLexarToken(BitShiftLeft, 0));
|
||||||
in++;
|
in++;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
vecAddElement(&vec, makeLexarToken(Smaller, 0));
|
int a = (in[1] == '=') ? 1 : 0;
|
||||||
|
vecAddElement(&vec, makeLexarToken(Smaller + a, 0));
|
||||||
|
in += a;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
Vector_t runLexar(const char* in, u32 len);
|
Vector_t runLexer(const char* in, u32 len);
|
||||||
char lexarDebugGetTokenC(u8 tokenN);
|
char lexarDebugGetTokenC(u8 tokenN);
|
||||||
void lexarVectorClear(Vector_t *v);
|
void lexarVectorClear(Vector_t *v);
|
||||||
@@ -74,6 +74,7 @@ enum Variables {
|
|||||||
DictType,
|
DictType,
|
||||||
NullType,
|
NullType,
|
||||||
ErrType,
|
ErrType,
|
||||||
|
EmptyArrayType,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct { // this is to keep track of how many {} we passed. Keep an internal var with the "indentation level", +1 for {, -1 for }. have an array with the following def on what to do (on func: enter, set indentation & jump back, on while, jump to while, use while as if, on if simply set true or false)
|
typedef struct { // this is to keep track of how many {} we passed. Keep an internal var with the "indentation level", +1 for {, -1 for }. have an array with the following def on what to do (on func: enter, set indentation & jump back, on while, jump to while, use while as if, on if simply set true or false)
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ void GptMenu(u8 MMCType){
|
|||||||
gfx_clearscreen();
|
gfx_clearscreen();
|
||||||
char *fileName = CpyStr(strrchr(TConf.srcCopy, '/') + 1);
|
char *fileName = CpyStr(strrchr(TConf.srcCopy, '/') + 1);
|
||||||
|
|
||||||
for (int i = 0; i < strlen(fileName); i++){
|
|
||||||
if (fileName[i] >= 'a' && fileName[i] <= 'z')
|
|
||||||
fileName[i] &= ~BIT(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx_printf("Are you sure you want to flash %s? ", fileName);
|
gfx_printf("Are you sure you want to flash %s? ", fileName);
|
||||||
if (MakeYesNoHorzMenu(3, COLOR_DEFAULT)){
|
if (MakeYesNoHorzMenu(3, COLOR_DEFAULT)){
|
||||||
RESETCOLOR;
|
RESETCOLOR;
|
||||||
|
|||||||
@@ -196,4 +196,66 @@ void FormatSD(){
|
|||||||
|
|
||||||
free(work);
|
free(work);
|
||||||
hidWait();
|
hidWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern bool sd_mounted;
|
||||||
|
|
||||||
|
void TakeScreenshot(){
|
||||||
|
static u32 timer = 0;
|
||||||
|
|
||||||
|
if (!TConf.minervaEnabled || !sd_mounted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (timer + 3 < get_tmr_s())
|
||||||
|
timer = get_tmr_s();
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
char *name, *path;
|
||||||
|
const char basepath[] = "sd:/tegraexplorer/screenshots";
|
||||||
|
name = malloc(40);
|
||||||
|
sprintf(name, "Screenshot_%08X.bmp", get_tmr_us());
|
||||||
|
|
||||||
|
f_mkdir("sd:/tegraexplorer");
|
||||||
|
f_mkdir(basepath);
|
||||||
|
path = CombinePaths(basepath, name);
|
||||||
|
free(name);
|
||||||
|
|
||||||
|
const u32 file_size = 0x384000 + 0x36;
|
||||||
|
u8 *bitmap = malloc(file_size);
|
||||||
|
u32 *fb = malloc(0x384000);
|
||||||
|
u32 *fb_ptr = gfx_ctxt.fb;
|
||||||
|
|
||||||
|
for (int x = 1279; x >= 0; x--)
|
||||||
|
{
|
||||||
|
for (int y = 719; y >= 0; y--)
|
||||||
|
fb[y * 1280 + x] = *fb_ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(bitmap + 0x36, fb, 0x384000);
|
||||||
|
bmp_t *bmp = (bmp_t *)bitmap;
|
||||||
|
|
||||||
|
bmp->magic = 0x4D42;
|
||||||
|
bmp->size = file_size;
|
||||||
|
bmp->rsvd = 0;
|
||||||
|
bmp->data_off = 0x36;
|
||||||
|
bmp->hdr_size = 40;
|
||||||
|
bmp->width = 1280;
|
||||||
|
bmp->height = 720;
|
||||||
|
bmp->planes = 1;
|
||||||
|
bmp->pxl_bits = 32;
|
||||||
|
bmp->comp = 0;
|
||||||
|
bmp->img_size = 0x384000;
|
||||||
|
bmp->res_h = 2834;
|
||||||
|
bmp->res_v = 2834;
|
||||||
|
bmp->rsvd2 = 0;
|
||||||
|
|
||||||
|
sd_save_to_file(bitmap, file_size, path);
|
||||||
|
free(bitmap);
|
||||||
|
free(fb);
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
display_backlight_brightness(255, 1000);
|
||||||
|
msleep(100);
|
||||||
|
display_backlight_brightness(100, 1000);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,24 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <utils/types.h>
|
||||||
|
|
||||||
|
typedef struct _bmp_t
|
||||||
|
{
|
||||||
|
u16 magic;
|
||||||
|
u32 size;
|
||||||
|
u32 rsvd;
|
||||||
|
u32 data_off;
|
||||||
|
u32 hdr_size;
|
||||||
|
u32 width;
|
||||||
|
u32 height;
|
||||||
|
u16 planes;
|
||||||
|
u16 pxl_bits;
|
||||||
|
u32 comp;
|
||||||
|
u32 img_size;
|
||||||
|
u32 res_h;
|
||||||
|
u32 res_v;
|
||||||
|
u64 rsvd2;
|
||||||
|
} __attribute__((packed)) bmp_t;
|
||||||
|
|
||||||
void DumpSysFw();
|
void DumpSysFw();
|
||||||
void FormatSD();
|
void FormatSD();
|
||||||
|
void TakeScreenshot();
|
||||||
@@ -142,6 +142,7 @@ char *ShowKeyboard(const char *toEdit, u8 alwaysRet){
|
|||||||
}
|
}
|
||||||
int val = (input->up || input->down) ? 11 : 1;
|
int val = (input->up || input->down) ? 11 : 1;
|
||||||
|
|
||||||
|
// Btn buttons do not work lol
|
||||||
if (input->buttons & (JoyLLeft | JoyLUp | BtnVolM)){
|
if (input->buttons & (JoyLLeft | JoyLUp | BtnVolM)){
|
||||||
if (pos > -1 + val)
|
if (pos > -1 + val)
|
||||||
pos -= val;
|
pos -= val;
|
||||||
|
|||||||
Reference in New Issue
Block a user