Skip to content

Commit

Permalink
STORE Version: 2.1-V-2021-12-26T00:15:33
Browse files Browse the repository at this point in the history
  • Loading branch information
LightningMods committed Dec 26, 2021
1 parent ade367d commit bb411e7
Show file tree
Hide file tree
Showing 46 changed files with 2,952 additions and 757 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ StoreOnUSB=0 //store pkgs on usb OPTIONAL
BETA_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxx //for Beta Builds (define)
Adavnced_Enabled=1 // need it for advanced settings optional
CDN_For_Devkit_Modules=CDN_FOR_ONLY_DEVKIT_MODULES //optional
Legacy=0 //enables old Store APIs
Legacy=0 // Enables old Store APIs
Home_Redirection=1 // Enables the Home Menu Redirect
Daemon_on_start=0 // Disables the Daemon from auto starting with the app
```

## App details
Expand Down
8 changes: 2 additions & 6 deletions Store/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ TargetFile=homebrew.elf

include $(ORBISDEV)/make/ps4sdk.mk

LinkerFlags += -lkernel_stub -lSceLibcInternal_stub -lSceSysmodule_stub -lSceSystemService_stub -lSceNet_stub -lSceUserService_stub -lScePigletv2VSH_stub -lSceVideoOut_stub -lSceImeDialog_stub -lSceGnmDriver_stub -lorbisGl -lorbis -lScePad_stub -lSceCommonDialog_stub -lSceMsgDialog_stub -lSceAudioOut_stub -lSceIme_stub -lSceAppInstUtil_stub -lSceBgft_stub -lSceSysUtil_stub -lSceHttp_stub -lSceSsl_stub -lSceNetCtl_stub
LinkerFlags += -lfreetype-gl -lSceFreeTypeOl_stub
LinkerFlags += -lkernel_sys_stub
# testing exports
LinkerFlags += -lSceLncUtil_stub
LinkerFlags += -luser_mem_sys -lkernel_stub -lSceLibcInternal_stub -lSceSysmodule_stub -lSceSystemService_stub -lSceNet_stub -lSceUserService_stub -lScePigletv2VSH_stub -lSceVideoOut_stub -lSceImeDialog_stub -lSceGnmDriver_stub -lorbis -lorbisGl -lScePad_stub -lSceCommonDialog_stub -lSceMsgDialog_stub -lSceAudioOut_stub -lSceIme_stub -lSceAppInstUtil_stub -lSceBgft_stub -lSceSysUtil_stub -lSceHttp_stub -lSceSsl_stub -lSceNetCtl_stub -lfreetype-gl -lSceFreeTypeOl_stub -lkernel_sys_stub -lSceLncUtil_stub

CompilerFlags += -D__PS4__ -D__ORBIS__
CompilerFlags += -D__PS4__ -D__ORBIS__ -fstack-protector-all

IncludePath += -I$(ORBISDEV)/usr/include -I$(ORBISDEV)/usr/include/c++/v1 -I$(ORBISDEV)/usr/include/orbis
IncludePath += -I$(ORBISDEV)/usr/include/orbis/freetype-gl
Expand Down
1 change: 1 addition & 0 deletions Store/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ../itemz-daemon/ && make clean && make -j8 && make oelf && make eboot && cd ../Store/ && make clean && make -j8 && make oelf && make eboot
3 changes: 2 additions & 1 deletion Store/include/GLES2_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern layout_t *active_p, // the active panel moves selector around
*/
extern item_t *games,
*groups,
*i_apps; // Installed_Apps
*all_apps; // Installed_Apps
/*
auxiliary array of item_index_t:
- shared for Search/Groups
Expand All @@ -68,6 +68,7 @@ extern dl_arg_t *pt_info;
// GLES2_layout
void layout_update_fsize(layout_t *l);
void layout_update_sele (layout_t *l, int movement);
void GLES2_Refresh_for_settings();
void layout_set_active (layout_t *l);
void swap_panels(void);
void GLES2_render_layout_v2(layout_t *l, int unused);
Expand Down
5 changes: 3 additions & 2 deletions Store/include/Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <Ssl.h>
#include <sys/_types.h>
#include <sys/fcntl.h> //O_CEAT
#include <user_mem.h>

#define SCE_KERNEL_MAX_MODULES 256
#define SCE_KERNEL_MAX_NAME_LENGTH 256
Expand All @@ -27,7 +28,7 @@

#define IS_INTERNAL 0

int loadmsg(char* format, ...);

int pingtest(int libnetMemId, int libhttpCtxId, const char* src);
int32_t netInit(void);
#define DIFFERENT_HASH 1
Expand Down Expand Up @@ -103,7 +104,7 @@ void logshit(char* format, ...);


#define VERSION_MAJOR 2
#define VERSION_MINOR 00
#define VERSION_MINOR 01

#define BUILD_YEAR_CH0 (__DATE__[ 7])
#define BUILD_YEAR_CH1 (__DATE__[ 8])
Expand Down
31 changes: 25 additions & 6 deletions Store/include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <math.h>
#include <time.h>
#include "log.h"
#include <user_mem.h>

#if defined (__ORBIS__)

Expand Down Expand Up @@ -89,6 +90,10 @@
#define SCE_SYSCORE_ERROR_LNC_INVALID_STATE 0x80aa000a
#define SCE_LNC_UTIL_ERROR_NOT_INITIALIZED 0x80940001

#define APP_HOME_DATA_FOLDER "/user/app/NPXS29998"
#define APP_HOME_DATA_TID "NPXS29998"
#define STORE_TID "NPXS39041"

/// from fileIO.c
unsigned char *orbisFileGetFileContent( const char *filename );
extern size_t _orbisFile_lastopenFile_size;
Expand Down Expand Up @@ -188,18 +193,15 @@ void filledRect(int x1, int y1, int x2, int y2, unsigned char r, unsigned char g
#define NUM_OF_SPRITES (6)

/// from ls_dir()
int ls_dir(char *dirpath);
bool if_exists(const char *path);
int check_stat(const char *filepath);

int get_item_count(void); // to remove
typedef struct
{
char *name;
//size_t size;
} entry_t;
entry_t *get_item_entries(const char *dirpath, int *count);
void free_item_entries(entry_t *e);
void free_item_entries(entry_t* e, int num);

// from my_rects.c
vec2 px_pos_to_normalized(vec2 *pos);
Expand Down Expand Up @@ -237,6 +239,7 @@ void ORBIS_RenderFillRects(enum SH_type SL_program, const vec4 *rgba, const vec4
void ORBIS_RenderDrawBox (enum SH_type SL_program, const vec4 *rgba, const vec4 *rect);
void GLES2_DrawFillingRect(vec4 *frect, vec4 *color, double *percentage);


// reuse this type to index texts around!
typedef struct
{
Expand All @@ -245,6 +248,7 @@ typedef struct
} item_idx_t;



enum views
{
ON_TEST_ANI = -2,
Expand Down Expand Up @@ -319,7 +323,7 @@ int sceKernelAvailableFlexibleMemorySize(size_t *free_mem);

int notify(char *message);
void escalate_priv(void);
int initGL_for_the_store(void);
int initGL_for_the_store(bool reload_apps,int ref_pages);
int pingtest(int libnetMemId, int libhttpCtxId, const char* src);

/*
Expand Down Expand Up @@ -349,6 +353,21 @@ typedef enum badge_t
NUM_OF_BADGES
} badge_t;


#define ARRAYSIZE(a) ((sizeof(a) / sizeof(*(a))) / ((size_t)(!(sizeof(a) % sizeof(*(a))))))

struct _ent {
char fname[4096];
uint32_t sz;
};

struct CVec
{
uint32_t sz, cur; // In BYTES
void* ptr;

};

typedef struct
{
item_idx_t *token_d; // data
Expand Down Expand Up @@ -387,7 +406,7 @@ typedef struct
item_idx_t *analyze_item_t (item_t *items, int item_count);
item_t *analyze_item_t_v2 (item_t *items, int item_count);
item_idx_t *search_item_t (item_t *items, int item_count, enum token_name TN, char *pattern);
item_t *index_items_from_dir(const char *dirpath);
item_t *index_items_from_dir(const char *dirpath, const char* dirpath2);

void build_char_from_items(char **data, item_idx_t *filter);
item_idx_t *build_item_list(item_t *items, int item_count, enum token_name TN);
Expand Down
4 changes: 1 addition & 3 deletions Store/include/memory.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef _USER_MEM_H
#define _USER_MEM_H

void* lmalloc(unsigned long size);
void *lrealloc(void *ptr,size_t size);
#include <user_mem.h>


#endif
101 changes: 95 additions & 6 deletions Store/include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <KeyboardDialog.h>
#include <sys/param.h> // MIN
#include "log.h"
#include <sys/_iovec.h>
#include <user_mem.h>

#define DIM(x) (sizeof(x)/sizeof(*(x)))
#define KB(x) ((size_t) (x) << 10)
Expand All @@ -20,7 +22,61 @@ enum MSG_DIALOG {
WARNING
};


enum IPC_Errors
{
INVALID = -1,
NO_ERROR = 0,
REDIRECT_OPERATION_FAILED = 1,
DEAMON_UPDATING = 100
};


enum IPC_Commands
{
CONNECTION_TEST = 1,
ENABLE_HOME_REDIRECT = 2,
DISABLE_HOME_REDIRECT = 3,
DEAMON_UPDATE = 100
};




typedef struct SceNetEtherAddr {
uint8_t data[6];
} SceNetEtherAddr;

typedef union SceNetCtlInfo {
uint32_t device;
SceNetEtherAddr ether_addr;
uint32_t mtu;
uint32_t link;
SceNetEtherAddr bssid;
char ssid[33];
uint32_t wifi_security;
int32_t rssi_dbm;
uint8_t rssi_percentage;
uint8_t channel;
uint32_t ip_config;
char dhcp_hostname[256];
char pppoe_auth_name[128];
char ip_address[16];
char netmask[16];
char default_route[16];
char primary_dns[16];
char secondary_dns[16];
uint32_t http_proxy_config;
char http_proxy_server[256];
uint16_t http_proxy_port;
} SceNetCtlInfo;



#define STORE_LOG "/user/app/NPXS39041/logs/log.txt"
#define STANDALONE_APP 0
#define DAEMON_PATH "/system/vsh/app/ITEM00002"
#define DAEMON_INI_DOESNT_EXIST 0

//#define assert(expr) if (!(expr)) msgok(FATAL, "Assertion Failed!");

Expand Down Expand Up @@ -50,7 +106,7 @@ static const char *option_panel_text[] =
{
"Content Delivery Network",
"Temporary Path",
"Detected USB",
"Set as Home Menu(XMB)",
"INI Path",
"Custom FreeType font Path",
// following doesn't store strings for any Paths...
Expand Down Expand Up @@ -78,6 +134,23 @@ enum STR_type
};


enum Settings_options
{
CDN_SETTING,
TMP__SETTING,
HOME_MENU_SETTING,
INI_SETTING,
FNT__SETTING,
STORE_USB_SETTING,
CLEAR_CACHE_SETTING,
USE_REFLECTION_SETTING,
USE_PIXELSHADER_SETTING,
SAVE_SETTINGS,
NUM_OF_SETTINGS
};


extern int HDD_count;
enum CHECK_OPTS
{
MD5_HASH,
Expand All @@ -89,12 +162,14 @@ enum CHECK_OPTS
NUM_OF_STRING
};

#define SCE_SYSMODULE_INTERNAL_COMMON_DIALOG 0x80000018
#define SCE_SYSMODULE_INTERNAL_SYSUTIL 0x80000018

// indexed options
typedef struct
{
char *opt[ NUM_OF_STRINGS ];
int StoreOnUSB;
int Legacy;
bool StoreOnUSB, Legacy, HomeMenu_Redirection, Daemon_on_start;
// more options
} StoreOptions;

Expand All @@ -110,9 +185,9 @@ uint32_t SysctlByName_get_sdk_version(void);

char *calculateSize(uint64_t size);


int msgok(enum MSG_DIALOG level, char* format, ...);
int loadmsg(char* format, ...);
extern bool is_connected_app;
void msgok(enum MSG_DIALOG level, char* format, ...);
void loadmsg(char* format, ...);
long CalcAppsize(char *path);
char* cutoff(const char* str, int from, int to);

Expand All @@ -128,6 +203,20 @@ int check_download_counter(StoreOptions* set, char* title_id);
bool rmtree(const char path[]);
void setup_store_assets(StoreOptions* get);
void refresh_apps_for_cf(void);
int64_t sys_dynlib_load_prx(char* prxPath, int* moduleID);
int64_t sys_dynlib_unload_prx(int64_t prxID);
int64_t sys_dynlib_dlsym(int64_t moduleHandle, const char* functionName, void* destFuncOffset);
struct sockaddr_in IPCAddress(uint16_t port);
int OpenConnection(const char* name);
bool IPCOpenConnection();
int IPCReceiveData(uint8_t* buffer, int32_t size);
int IPCSendData(uint8_t* buffer, int32_t size);
int IPCCloseConnection();
#define DAEMON_BUFF_MAX 100
void GetIPCMessageWithoutError(uint8_t* buf, uint32_t sz);
uint32_t Launch_App(char* TITLE_ID, bool silent);
int mountfs(const char* device, const char* mountpoint, const char* fstype, const char* mode, uint64_t flags);

//int check_store_from_url(char* cdn, enum CHECK_OPTS opt, int *page_number);

extern bool dump;
Expand Down
7 changes: 4 additions & 3 deletions Store/source/GLES2_atlas.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
*/

#include "defines.h"

#include <semaphore.h>
#include <memory.h> // lmalloc()


extern vec4 c[8]; // palette
extern vec2 resolution;
extern int *dump_buffer;
// import Installed_Apps AOS
extern layout_t *icon_panel;
extern item_t *i_apps;
extern item_t *all_apps;
extern double u_t;
extern GLuint fallback_t; // fallback texture

Expand Down Expand Up @@ -128,7 +129,7 @@ void create_tcache(layout_t *l)
if( ! dump_buffer )
{
#if defined __ORBIS__
dump_buffer = lmalloc(resolution.x * resolution.y * sizeof(int));
dump_buffer = malloc(resolution.x * resolution.y * sizeof(int));
#else
dump_buffer = calloc(resolution.x * resolution.y, sizeof(int));
#endif
Expand Down
Loading

0 comments on commit bb411e7

Please sign in to comment.