forked from xerpi/ds4vita
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,025 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
set(CMAKE_SYSTEM_NAME "Generic") | ||
set(CMAKE_C_COMPILER "arm-vita-eabi-gcc") | ||
set(CMAKE_CXX_COMPILER "arm-vita-eabi-g++") | ||
|
||
project(ds4vita) | ||
|
||
set(CMAKE_C_FLAGS "-Wl,-q -Wall -O3 -std=gnu99") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -fno-rtti -fno-exceptions") | ||
|
||
include_directories( | ||
) | ||
|
||
link_directories( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
option(RELEASE "Release build" OFF) | ||
|
||
if (RELEASE) | ||
add_definitions(-DRELEASE) | ||
endif(RELEASE) | ||
|
||
add_executable(${PROJECT_NAME}.elf | ||
main.c | ||
log.c | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME}.elf | ||
m | ||
gcc | ||
taihenForKernel_stub | ||
SceSysclibForDriver_stub | ||
SceSysmemForDriver_stub | ||
SceSysmemForKernel_stub | ||
SceThreadmgrForDriver_stub | ||
SceIofilemgrForDriver_stub | ||
SceBtForDriver_stub | ||
SceKernelSuspendForDriver_stub | ||
SceCtrlForDriver_stub | ||
) | ||
|
||
set_target_properties(${PROJECT_NAME}.elf | ||
PROPERTIES LINK_FLAGS "-nostdlib" | ||
COMPILE_FLAGS "-D__VITA_KERNEL__" | ||
) | ||
|
||
add_custom_target(${PROJECT_NAME}.skprx ALL | ||
COMMAND vita-elf-create -e ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.yml ${PROJECT_NAME}.elf ${PROJECT_NAME}.velf | ||
COMMAND vita-make-fself -c ${PROJECT_NAME}.velf ${PROJECT_NAME}.skprx | ||
) | ||
add_dependencies(${PROJECT_NAME}.skprx ${PROJECT_NAME}.elf) | ||
|
||
add_custom_target(send | ||
COMMAND curl -T ${PROJECT_NAME}.skprx ftp://$(PSVITAIP):1337/ux0:/data/tai/kplugin.skprx | ||
DEPENDS ${PROJECT_NAME}.skprx | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Ds4Vita-Unofficial_Mod | ||
A custom version for Xerpi's ds4vita: https://github.com/xerpi/ds4vita | ||
|
||
**Enable the plugin:** | ||
|
||
1. Add ds4vita.skprx to taiHEN's config (ux0:/tai/config.txt): | ||
``` | ||
*KERNEL | ||
ux0:tai/ds4vita.skprx | ||
``` | ||
2. You need to refresh the config.txt by rebooting or through VitaShell. | ||
|
||
**Using it for the first time (pairing the controller):** | ||
|
||
1. Go to Settings -> Devices -> Bluetooth Devices | ||
2. Press SHARE+PS on the DS4 for about 3-4 seconds, until the lightbar blinks very quickly | ||
3. The DS4 will then connect and be paired (don't press over it when it appears) | ||
|
||
**Using it once paired (see above):** | ||
1. Just press the PS button and it will connect to the Vita | ||
|
||
**Note**: If you use Mai, don't put the plugin inside ux0:/plugins because Mai will load all stuff you put in there... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ds4vita: | ||
attributes: 0 | ||
version: | ||
major: 1 | ||
minor: 1 | ||
main: | ||
start: module_start | ||
stop: module_stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "log.h" | ||
#include <psp2kern/io/fcntl.h> | ||
|
||
extern int ksceIoMkdir(const char *, int); | ||
|
||
#ifndef RELEASE | ||
static unsigned int log_buf_ptr = 0; | ||
static char log_buf[16 * 1024]; | ||
#endif | ||
|
||
void log_reset() | ||
{ | ||
#ifndef RELEASE | ||
SceUID fd = ksceIoOpen(LOG_FILE, | ||
SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 6); | ||
if (fd < 0) | ||
return; | ||
|
||
ksceIoClose(fd); | ||
|
||
memset(log_buf, 0, sizeof(log_buf)); | ||
#endif | ||
} | ||
|
||
void log_write(const char *buffer, size_t length) | ||
{ | ||
#ifndef RELEASE | ||
if ((log_buf_ptr + length) >= sizeof(log_buf)) | ||
return; | ||
|
||
memcpy(log_buf + log_buf_ptr, buffer, length); | ||
|
||
log_buf_ptr = log_buf_ptr + length; | ||
#endif | ||
} | ||
|
||
void log_flush() | ||
{ | ||
#ifndef RELEASE | ||
ksceIoMkdir(LOG_PATH, 6); | ||
|
||
SceUID fd = ksceIoOpen(LOG_FILE, | ||
SCE_O_WRONLY | SCE_O_CREAT | SCE_O_APPEND, 6); | ||
if (fd < 0) | ||
return; | ||
|
||
ksceIoWrite(fd, log_buf, strlen(log_buf)); | ||
ksceIoClose(fd); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef LOG_H | ||
#define LOG_H | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#define LOG_PATH "ux0:dump/" | ||
#define LOG_FILE LOG_PATH "ds4vita_log.txt" | ||
|
||
void log_reset(); | ||
void log_write(const char *buffer, size_t length); | ||
void log_flush(); | ||
|
||
#ifndef RELEASE | ||
# define LOG(...) \ | ||
do { \ | ||
char buffer[256]; \ | ||
snprintf(buffer, sizeof(buffer), ##__VA_ARGS__); \ | ||
log_write(buffer, strlen(buffer)); \ | ||
} while (0) | ||
#else | ||
# define LOG(...) (void)0 | ||
#endif | ||
|
||
#define TEST_CALL(f, ...) ({ \ | ||
int ret = f(__VA_ARGS__); \ | ||
LOG(# f " returned 0x%08X\n", ret); \ | ||
ret; \ | ||
}) | ||
|
||
#endif |
Oops, something went wrong.