-
Notifications
You must be signed in to change notification settings - Fork 12
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
0 parents
commit cc5fc34
Showing
5 changed files
with
746 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,56 @@ | ||
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(ds3vita) | ||
|
||
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} | ||
) | ||
|
||
if (${RELEASE} EQUAL 1) | ||
add_definitions(-DRELEASE) | ||
endif() | ||
|
||
add_executable(${PROJECT_NAME}.elf | ||
main.c | ||
log.c | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME}.elf | ||
gcc | ||
taihenForKernel_stub | ||
SceSysclibForDriver_stub | ||
SceSysmemForDriver_stub | ||
SceSysmemForKernel_stub | ||
SceThreadmgrForKernel_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 ${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,8 @@ | ||
ds3vita: | ||
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 "ds3vita_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.
cc5fc34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dear xerpi, can you make L2 R2 to be vol- and vol+ ? And also, I need LED to be fixed. Thank you a lot xerpi! You made my dreams come true!