Compare commits

..

9 Commits

Author SHA1 Message Date
suchmememanyskill
09cd6e2bd1 Merge pull request #65 from dezem/master
Add 14.0.0 pkg1
2022-03-22 22:06:38 +01:00
dezem
23cc913bf2 Add 14.0.0 pkg1 2022-03-22 21:55:58 +01:00
suchmememanyskill
eb3fc13385 Add 13.2.1 pkg1 2022-01-21 11:12:04 +01:00
suchmememanyskill
35a6bd9b41 [Script] Return index on array.contains 2022-01-21 11:05:09 +01:00
bleck9999
e87301e160 gotta save those 2.9 seconds 2021-10-16 11:43:26 +01:00
suchmememanyskill
e96ea63479 add .len to unsolved array 2021-10-16 12:41:08 +02:00
bleck9999
c24e028960 fix compiling abadidea 2021-09-25 14:27:47 +01:00
bleck9999
5a12d0c120 add hidread to script
but not that script the other script
2021-09-17 17:10:20 +01:00
suchmememanyskill
785549a9c8 add hidread function to script 2021-09-16 23:44:20 +02:00
6 changed files with 34 additions and 14 deletions

View File

@@ -113,9 +113,9 @@ $(BUILDDIR)/$(TARGET)/script/builtin.c: scripts/*.te
@mkdir -p "$(@D)"
@mkdir -p "$(BUILDDIR)/$(TARGET)/scripts"
ifeq ($(OS),Windows_NT)
@py ts-minifier.py -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@py ts-minifier.py --such-meme -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@py te2c.py "$(BUILDDIR)/$(TARGET)/script/builtin" "$(BUILDDIR)/$(TARGET)/scripts"
else
@python3 ts-minifier.py -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@python3 ts-minifier.py --such-meme -d "$(BUILDDIR)/$(TARGET)/scripts" $(wildcard scripts/*.te)
@python3 te2c.py "$(BUILDDIR)/$(TARGET)/script/builtin" "$(BUILDDIR)/$(TARGET)/scripts"
endif

View File

@@ -42,7 +42,9 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20210129", 10}, //12.0.0 - 12.0.1
{ "20210422", 10}, //12.0.2 - 12.0.3
{ "20210607", 11}, //12.1.0
{ "20210805", 11 },
{ "20210805", 12}, //13.0.0 - 13.2.0
{ "20220105", 12}, //13.2.1
{ "20220209", 13}, //14.0.0+
{ NULL } //End.
};

View File

@@ -180,11 +180,11 @@ ClassFunction(arrayContains) {
if (caller->variableType == StringArrayClass) {
if (!strcmp(arg->string.value, iter.string.value))
return newIntVariablePtr(1);
return newIntVariablePtr(i + 1);
}
else {
if (arg->integer.value == iter.integer.value)
return newIntVariablePtr(1);
return newIntVariablePtr(i + 1);
}
}

View File

@@ -234,13 +234,8 @@ char *powNames[] = {
"volminus",
};
// Takes [int]. Returns dict[a,b,x,y,down,up,right,left,power,volplus,volminus,raw]. int: mask for hidWaitMask
ClassFunction(stdPauseMask){
Variable_t *hidToVar(u32 raw){
Variable_t ret = {.variableType = DictionaryClass, .dictionary.vector = newVec(sizeof(Dict_t), 9)};
Input_t *i = hidWaitMask((u32)getIntValue(*args));
u32 raw = i->buttons;
addIntToDict(&ret, "raw", raw);
for (int i = 0; i < ARRAY_SIZE(abxyNames); i++){
@@ -265,6 +260,19 @@ ClassFunction(stdPauseMask){
return copyVariableToPtr(ret);
}
ClassFunction(stdRead){
Input_t *i = hidRead();
u32 raw = i->buttons;
return hidToVar(raw);
}
// Takes [int]. Returns dict[a,b,x,y,down,up,right,left,power,volplus,volminus,raw]. int: mask for hidWaitMask
ClassFunction(stdPauseMask){
Input_t *i = hidWaitMask((u32)getIntValue(*args));
u32 raw = i->buttons;
return hidToVar(raw);
}
// Takes none. Returns dict (same as stdPauseMask).
ClassFunction(stdPause){
Variable_t a = {.integer.value = 0xFFFFFFFF};
@@ -482,6 +490,7 @@ STUBBED(stdMkdir)
STUBBED(stdGetMemUsage)
STUBBED(stdGetNcaType)
STUBBED(stdPause)
STUBBED(stdRead)
STUBBED(stdPauseMask)
STUBBED(stdColor)
STUBBED(stdMenuFull)
@@ -541,6 +550,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
{"timer", stdGetMs, 0, 0},
{"pause", stdPauseMask, 1, threeIntsStd},
{"pause", stdPause, 0, 0},
{"hidread", stdRead, 0, 0},
{"color", stdColor, 1, threeIntsStd},
{"menu", stdMenuFull, 3, menuArgsStd},
{"menu", stdMenuFull, 2, menuArgsStd},

View File

@@ -152,7 +152,12 @@ Variable_t createUnsolvedArrayVariable(Function_t* f) {
return var;
}
ClassFunction(retZero){
return newIntVariablePtr(0);
}
u8 anotherOneVarArg[] = { VARARGCOUNT };
u8 unsolvedArrayStr[] = { StringClass };
ClassFunction(createTypedArray) {
Vector_t v = { 0 };
@@ -180,6 +185,7 @@ ClassFunction(createTypedArray) {
ClassFunctionTableEntry_t unsolvedArrayFunctions[] = {
{"+", createTypedArray, 1, anotherOneVarArg},
{"add", createTypedArray, 1, anotherOneVarArg},
{"len", retZero, 0, 0},
};
Variable_t getUnsolvedArrayMember(Variable_t* var, char* memberName) {

View File

@@ -1,6 +1,6 @@
# Copyright (c) 2021 bleck9999
# https://github.com/bleck9999/ts-minifier
# Version: 339183b2
# Version: e276c417
import argparse
import itertools
@@ -14,7 +14,7 @@ stdlib = ['if', 'while', 'print', 'println', 'mountsys', 'mountemu', 'readsave',
'readdir', 'copyfile', 'mkdir', 'ncatype', 'pause', 'color', 'menu', 'emu', 'clear', 'timer', 'deldir',
'fsexists', 'delfile', 'copydir', 'movefile', 'payload', 'readfile', 'writefile', 'setpixels', 'printpos',
'emmcread', 'emmcwrite', 'emummcread', 'emummcwrite', 'escapepath', 'combinepath', 'cwd', 'power',
'fuse_patched', 'fuse_hwtype']
'fuse_patched', 'fuse_hwtype', 'hidread']
class Code:
@@ -427,6 +427,8 @@ if __name__ == '__main__':
"and attempt to generate shorter names for reused variables \ndefault: false")
argparser.add_argument("-v", action="store_true", default=False,
help="prints even more information to the console than usual")
argparser.add_argument("--such-meme", action="store_true", default=False,
help="replaces destination file if it already exists \ndefault: false")
args = argparser.parse_args()
files = args.source
@@ -448,7 +450,7 @@ if __name__ == '__main__':
logging.info("Stripping whitespace (pass 2)")
r = whitespacent(r)
file = path.splitext(path.basename(file))[0]
if path.exists(path.join(dest, f"{file}.te")):
if path.exists(path.join(dest, f"{file}.te")) and not args.such_meme:
f = open(path.join(dest, f"{file}_min.te"), 'w')
else:
f = open(path.join(dest, f"{file}.te"), 'w')