Skip to content

Commit

Permalink
git
Browse files Browse the repository at this point in the history
  • Loading branch information
Mithrenes committed Oct 12, 2016
1 parent b55084a commit 2a08b22
Show file tree
Hide file tree
Showing 84 changed files with 173,419 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.537976214">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.537976214" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" id="cdt.managedbuild.toolchain.gnu.mingw.base.537976214" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.537976214.229107754" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.1329969805" name="cdt.managedbuild.toolchain.gnu.mingw.base" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.mingw.base.1638706878" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
<builder id="cdt.managedbuild.toolchain.gnu.mingw.base.537976214.1275635279" managedBuildOn="false" name="Gnu Make Builder.Preference Configuration" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.1963496907" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1003168677" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1953137592" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.base.1459694767" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.119935351" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.567894449" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="TEMA.null.1930253224" name="TEMA"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Custom for Visual Studio
*.cs diff=csharp
*.c
*.o
*.h

# Standard to msysgit
*.doc diff=astextplain
Expand Down
27 changes: 27 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TEMA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
TITLE_ID = TEMA00001
TARGET = TEMA
PSVITAIP = 195.160.0.0
PROJECT_TITLE := TEMA
OBJS = src/main.o src/font.o src/graphics.o src/init.o src/net.o \
src/package_installer.o src/archive.o src/file.o \
src/utils.o src/sha1.o minizip/unzip.o minizip/ioapi.o \
src/sfo.o src/vita_sqlite.o sqlite-3.6.23.1/sqlite3.o

LIBS = -lSceDisplay_stub -lSceSysmodule_stub -lSceNet_stub \
-lSceNetCtl_stub -lSceHttp_stub -lSceAppMgr_stub -lSceAppUtil_stub \
-lScePower_stub libpromoter/libScePromoterUtil_stub.a -lz \
-lSceKernel_stub \
-lSceGxm_stub \
-lSceCtrl_stub \
-lScePgf_stub \
-lz \
-lm \
-lvita2d \
-lfreetype \

DEFINES = -DSQLITE_OS_OTHER=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_THREADSAFE=0

PREFIX = arm-vita-eabi
CC = $(PREFIX)-gcc
CFLAGS = -Wl,-q -O3 -std=c99 $(DEFINES)
ASFLAGS = $(CFLAGS)

all: $(TARGET).vpk

$(TARGET).vpk: eboot.bin
vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=01.20 -s TITLE_ID=$(TITLE_ID) "$(PROJECT_TITLE)" param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin -a res/icon0.png=sce_sys/icon0.png \
-a res/template.xml=sce_sys/livearea/contents/template.xml \
-a res/startup.png=sce_sys/livearea/contents/startup.png \
-a res/bg0.png=sce_sys/livearea/contents/bg0.png $@


eboot.bin: $(TARGET).velf
vita-make-fself $< eboot.bin

$(TARGET).velf: $(TARGET).elf
vita-elf-create $< $@ libpromoter/promoterutil.json

$(TARGET).elf: $(OBJS)
$(CC) $(CFLAGS) $^ $(LIBS) -o $@

clean:
@rm -rf *.velf *.elf *.vpk $(OBJS) param.sfo eboot.bin

vpksend: $(TARGET).vpk
curl -T $(TARGET).vpk ftp://$(PSVITAIP):1337/ux0:/
@echo "Sent."

send: eboot.bin
curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/$(TITLE_ID)/
@echo "Sent."
Binary file added TEMA.elf
Binary file not shown.
Binary file added TEMA.velf
Binary file not shown.
Binary file added TEMA.vpk
Binary file not shown.
Binary file added eboot.bin
Binary file not shown.
12 changes: 12 additions & 0 deletions libpromoter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
TARGET_LIB=libScePromoterUtil_stub.a

$(TARGET_LIB): promoterutil.json
-rm -rf build_lib
mkdir build_lib
vita-libs-gen $< build_lib
cd build_lib && make
mv build_lib/$(TARGET_LIB) $(TARGET_LIB)
rm -rf build_lib

clean:
rm $(TARGET_LIB)
Binary file added libpromoter/libScePromoterUtil_stub.a
Binary file not shown.
28 changes: 28 additions & 0 deletions libpromoter/promoterutil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef _PSP2_PROMOTERUTIL_H_
#define _PSP2_PROMOTERUTIL_H_

#include <psp2/types.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ScePromoterUtilityLAUpdate {
char titleid[12]; // target app
char path[128]; // directory of extracted LA update data
} ScePromoterUtilityLAUpdate;

int scePromoterUtilityInit(void);
int scePromoterUtilityExit(void);
int scePromoterUtilityDeletePkg(void *unk);
int scePromoterUtilityUpdateLiveArea(ScePromoterUtilityLAUpdate *args);
int scePromoterUtilityPromotePkg(char *path, int unk);
int scePromoterUtilityPromotePkgWithRif(const char *path, int unk);
int scePromoterUtilityGetState(int *state);
int scePromoterUtilityGetResult(int *res);

#ifdef __cplusplus
}
#endif

#endif /* _PSP2_PROMOTERUTIL_H_ */
23 changes: 23 additions & 0 deletions libpromoter/promoterutil.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"ScePromoterUtil": {
"nid": 3004968284,
"modules": {
"ScePromoterUtil": {
"nid": 837957558,
"kernel": false,
"functions": {
"scePromoterUtilityInit": 2470778166,
"scePromoterUtilityExit": 3378324646,
"scePromoterUtilityDeletePkg": 2101769519,
"scePromoterUtilityUpdateLiveArea": 399982282,
"scePromoterUtilityPromotePkg": 1902936564,
"scePromoterUtilityPromotePkgWithRif": 2254707654,
"scePromoterUtilityGetState": 2884400338,
"scePromoterUtilityGetResult": 1236562928
},
"variables": {
}
}
}
}
}
137 changes: 137 additions & 0 deletions minizip/crypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/* crypt.h -- base code for traditional PKWARE encryption
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
See the Info-ZIP LICENSE file version 2000-Apr-09 or later for terms of use
which also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
The encryption/decryption parts of this source code (as opposed to the
non-echoing password parts) were originally written in Europe. The
whole source package can be freely distributed, including from the USA.
(Prior to January 2000, re-export from the US was a violation of US law.)
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
If you don't need crypting in your application, just define symbols
NOCRYPT and NOUNCRYPT.
Mar 8th, 2016 - Lucio Cosmo
Fixed support for 64bit builds for archives with "PKWARE" password.
Changed long, unsigned long, unsigned to unsigned int in
access functions to crctables and pkeys
*/

#define CRC32(c, b) ((*(pcrc_32_tab+(((unsigned int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))

/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
static int decrypt_byte(unsigned int* pkeys)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */

temp = ((unsigned int)(*(pkeys+2)) & 0xffff) | 2;
return (unsigned int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}

/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
static int update_keys(unsigned int* pkeys,const unsigned int* pcrc_32_tab,int c)
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{
register int keyshift = (int)((*(pkeys+1)) >> 24);
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
}
return c;
}


/***********************************************************************
* Initialize the encryption keys and the random header according to
* the given password.
*/
static void init_keys(const char* passwd,unsigned int* pkeys,const unsigned int* pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L;
while (*passwd != 0)
{
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
passwd++;
}
}

#define zdecode(pkeys,pcrc_32_tab,c) \
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys)))

#define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys), update_keys(pkeys,pcrc_32_tab,c), t^(c))

#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED

#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif

static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned int* pkeys,
const unsigned int* pcrc_32_tab,
unsigned int crcForCrypting)
{
int n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
static unsigned calls = 0; /* ensure different random header each time */

if (bufSize < RAND_HEAD_LEN)
return 0;

/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
* output of rand() to get less predictability, since rand() is
* often poorly implemented.
*/
if (++calls == 1)
{
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
}
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
c = (rand() >> 7) & 0xff;
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
}
/* Encrypt random header (last two bytes is high word of crc) */
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
}
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
return n;
}

#endif
Loading

0 comments on commit 2a08b22

Please sign in to comment.