Skip to content

Commit

Permalink
release v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SiSTR0 committed May 22, 2019
1 parent 854e5cf commit 1ab670c
Show file tree
Hide file tree
Showing 24 changed files with 1,723 additions and 1,730 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PS4HEN v2.0
# PS4HEN v2.1

## Features
- Homebrew Enabler
Expand All @@ -9,6 +9,9 @@
- VR Support
- Remote Package Install
- Rest Mode Support

## Fixes
- Black Screen Fix on Rest Mode

## Contributors
Massive credits to the following:
Expand All @@ -20,8 +23,13 @@ Massive credits to the following:
- [Vortex](https://github.com/xvortex)
- [zecoxao](https://twitter.com/notzecoxao)
- [SiSTRo](https://github.com/SiSTR0)
- [SocraticBliss](https://twitter.com/SocraticBliss)
- [ChendoChap](https://github.com/ChendoChap)
- Anonymous

## Testers
- [SCORPION](https://twitter.com/SCORPION1399)
- [SocraticBliss](https://mobile.twitter.com/SocraticBliss)
- [KiiWii](https://twitter.com/defaultdnb)
- [Leeful74](https://twitter.com/leeful74b)
- [opoisso893](https://twitter.com/opoisso893)
- Anonymous
2 changes: 1 addition & 1 deletion exploit.template

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion exploit/index.html

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions installer/include/debug.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
#ifndef DEBUG_H
#define DEBUG_H

#define PRIx64 "llx"
#define PRIu64 "llu"
#define PRId64 "lld"
#ifndef __DEBUG_H__
#define __DEBUG_H__
#pragma once

int sock;

void initDebugSocket(void);
void closeDebugSocket(void);

#ifdef DEBUG_SOCKET
#define printfsocket(format, ...)\
do {\
char __printfsocket_buffer[512];\
int __printfsocket_size = sprintf(__printfsocket_buffer, format, ##__VA_ARGS__);\
sceNetSend(sock, __printfsocket_buffer, __printfsocket_size, 0);\
#define printfsocket(format, ...) \
do { \
char __printfsocket_buffer[512]; \
int __printfsocket_size = sprintf(__printfsocket_buffer, format, ##__VA_ARGS__); \
sceNetSend(sock, __printfsocket_buffer, __printfsocket_size, 0); \
} while(0)
#else
#define printfsocket(format, ...) (void)0
Expand Down
138 changes: 64 additions & 74 deletions installer/include/defines.h
Original file line number Diff line number Diff line change
@@ -1,121 +1,111 @@
#ifndef __DEFINES
#define __DEFINES
#ifndef __DEFINES_H__
#define __DEFINES_H__
#pragma once

#define VERSION "2.0"
#define VERSION "2.1"

//#define DEBUG_SOCKET

#define LOG_IP "192.168.1.3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
#define LOG_PORT 9023

struct filedesc {
void *useless1[3];
void *fd_rdir;
void *fd_jdir;
void *useless1[3];
void *fd_rdir;
void *fd_jdir;
};

struct proc {
char useless[64];
struct ucred *p_ucred;
struct filedesc *p_fd;
char useless[64];
struct ucred *p_ucred;
struct filedesc *p_fd;
};

struct thread {
void *useless;
struct proc *td_proc;
void *useless;
struct proc *td_proc;
};

struct auditinfo_addr {
char useless[184];
char useless[184];
};

struct ucred {
uint32_t useless1;
uint32_t cr_uid; // effective user id
uint32_t cr_ruid; // real user id
uint32_t useless2;
uint32_t useless3;
uint32_t cr_rgid; // real group id
uint32_t useless4;
void *useless5;
void *useless6;
void *cr_prison; // jail(2)
void *useless7;
uint32_t useless8;
void *useless9[2];
void *useless10;
struct auditinfo_addr useless11;
uint32_t *cr_groups; // groups
uint32_t useless12;
uint32_t useless1;
uint32_t cr_uid; // effective user id
uint32_t cr_ruid; // real user id
uint32_t useless2;
uint32_t useless3;
uint32_t cr_rgid; // real group id
uint32_t useless4;
void *useless5;
void *useless6;
void *cr_prison; // jail(2)
void *useless7;
uint32_t useless8;
void *useless9[2];
void *useless10;
struct auditinfo_addr useless11;
uint32_t *cr_groups; // groups
uint32_t useless12;
};

struct payload_info
{
uint8_t* buffer;
size_t size;
struct payload_info {
uint8_t* buffer;
size_t size;
};

struct payload_header
{
uint64_t signature;
size_t entrypoint_offset;
struct payload_header {
uint64_t signature;
size_t entrypoint_offset;
};

struct install_payload_args
{
void* syscall_handler;
struct payload_info* payload_info;
struct install_payload_args {
void* syscall_handler;
struct payload_info* payload_info;
};

static inline __attribute__((always_inline)) uint64_t __readmsr(unsigned long __register)
{
unsigned long __edx;
unsigned long __eax;
__asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
return (((uint64_t)__edx) << 32) | (uint64_t)__eax;
static inline __attribute__((always_inline)) uint64_t __readmsr(unsigned long __register) {
unsigned long __edx;
unsigned long __eax;
__asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
return (((uint64_t)__edx) << 32) | (uint64_t)__eax;
}

#define X86_CR0_WP (1 << 16)

static inline __attribute__((always_inline)) uint64_t readCr0(void)
{
uint64_t cr0;
__asm__ volatile ("movq %0, %%cr0" : "=r" (cr0) : : "memory");
return cr0;
static inline __attribute__((always_inline)) uint64_t readCr0(void) {
uint64_t cr0;
__asm__ volatile ("movq %0, %%cr0" : "=r" (cr0) : : "memory");
return cr0;
}

static inline __attribute__((always_inline)) void writeCr0(uint64_t cr0)
{
__asm__ volatile("movq %%cr0, %0" : : "r" (cr0) : "memory");
static inline __attribute__((always_inline)) void writeCr0(uint64_t cr0) {
__asm__ volatile("movq %%cr0, %0" : : "r" (cr0) : "memory");
}

static inline __attribute__((always_inline)) void disable_interrupts(void)
{
asm volatile("cli");
static inline __attribute__((always_inline)) void disable_interrupts(void) {
__asm__ volatile("cli");
}

static inline __attribute__((always_inline)) void enable_interrupts(void)
{
asm volatile("sti");
static inline __attribute__((always_inline)) void enable_interrupts(void) {
__asm__ volatile("sti");
}

static inline __attribute__((always_inline)) uint64_t read_flags(void)
{
uint64_t flags;
asm volatile("pushf; pop %0;" : "=r" (flags));
return flags;
static inline __attribute__((always_inline)) uint64_t read_flags(void) {
uint64_t flags;
__asm__ volatile("pushf; pop %0;" : "=r" (flags));
return flags;
}

static inline __attribute__((always_inline)) uint64_t intr_disable(void)
{
uint64_t flags = read_flags();
disable_interrupts();
return flags;
static inline __attribute__((always_inline)) uint64_t intr_disable(void) {
uint64_t flags = read_flags();
disable_interrupts();
return flags;
}

static inline __attribute__((always_inline)) void intr_restore(uint64_t flags)
{
asm volatile("push %0; popf;" : : "rm" (flags) : "memory");
static inline __attribute__((always_inline)) void intr_restore(uint64_t flags) {
__asm__ volatile("push %0; popf;" : : "rm" (flags) : "memory");
}

#endif
33 changes: 33 additions & 0 deletions installer/include/offsets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef __OFFSETS_H__
#define __OFFSETS_H__
#pragma once

// 5.05
#define XFAST_SYSCALL_addr 0x00001C0

// Names - Data
#define PRISON0_addr 0x10986A0
#define ROOTVNODE_addr 0x22C1A70
#define PMAP_STORE_addr 0x22CB570
#define DT_HASH_SEGMENT_addr 0x0B5EF30

// Functions
#define pmap_protect_addr 0x02E3090
#define pmap_protect_p_addr 0x02E30D4

// Patches
// debug menu error
#define debug_menu_error_patch1 0x04F9048
#define debug_menu_error_patch2 0x04FA15C

// disable signature check
#define disable_signature_check_patch 0x06A2700

// enable debug RIFs
#define enable_debug_rifs_patch1 0x064B2B0
#define enable_debug_rifs_patch2 0x064B2D0

// enable VR
#define enable_vr_patch 0x14A63F1

#endif
5 changes: 2 additions & 3 deletions installer/source/debug.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ps4.h"
#include <ps4.h>

#include "defines.h"

#ifdef DEBUG_SOCKET
Expand All @@ -22,9 +23,7 @@ void initDebugSocket(void)
}

void closeDebugSocket(void)
{
sceNetSocketClose(sock);
}

#endif

Expand Down
Loading

0 comments on commit 1ab670c

Please sign in to comment.