-
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
0 parents
commit 9bf0d0c
Showing
15 changed files
with
885 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,61 @@ | ||
#Required lines | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) | ||
if(DEFINED ENV{DOLCESDK}) | ||
set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "toolchain file") | ||
else() | ||
message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!") | ||
endif() | ||
endif() | ||
|
||
|
||
project(VitaForge LANGUAGES C) #This is the name of your project. Note that "LANGUAGES C" is optional | ||
include("${DOLCESDK}/share/dolce.cmake" REQUIRED) #Including the SDK's .cmake script is required | ||
|
||
set(VITA_APP_NAME "VitaForge") #Name displayed on the Home Screen | ||
set(VITA_TITLEID "VITAFORGE") #Title ID : 9 characters, capital letters or digits only | ||
set(VITA_VERSION "01.00") #Version of the app | ||
|
||
#Settings for the compilers, this will output an optimized C binary while displaying all warnings | ||
#(-Wno-unknown-pragmas is for the "#pragma region" used in Visual Studio Code) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Wall -O3 -Wno-unknown-pragmas -fno-lto") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions") | ||
#Settings for the param.sfo flags. This sets parental level to the minimum level. | ||
set(DOLCE_MKSFOEX_FLAGS "${DOLCE_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1") | ||
|
||
#If you have any headers you use, make sure to put the directory here. | ||
#Note that the PSP2, VitaSDK/DolceSDK and taiHEN headers are already included by default. | ||
include_directories() | ||
|
||
#This is equivalent to placing "#define DEBUG" somewhere in your code. | ||
#Useful for testing purposes. | ||
add_definitions(-DDEBUG) | ||
|
||
link_directories( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
#All the .c files used by the project. | ||
add_executable(${PROJECT_NAME} | ||
main.c | ||
debugScreenFont.c | ||
) | ||
|
||
#Libraries the project will be linked against. VitaSDK docs can help you find most of them. | ||
target_link_libraries(${PROJECT_NAME} | ||
SceCtrl_stub | ||
SceTouch_stub | ||
SceLibKernel_stub | ||
SceDisplayUser_stub | ||
SceAppMgr_stub | ||
taihen_stub | ||
) | ||
|
||
#Creates a signed elf (EBOOT.BIN) | ||
dolce_create_self(${PROJECT_NAME}.self ${PROJECT_NAME}) | ||
#Packages the EBOOT.BIN into a vpk for installation. | ||
dolce_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self | ||
VERSION ${VITA_VERSION} | ||
NAME ${VITA_APP_NAME} | ||
) |
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,63 @@ | ||
# You should only use Makefile-based build if you know what you're doing. | ||
# For most vitasdk projects, CMake is a better choice. See CMakeLists.txt for an example. | ||
|
||
PHONY := all package clean | ||
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) | ||
|
||
CC := arm-vita-eabi-gcc | ||
CXX := arm-vita-eabi-g++ | ||
STRIP := arm-vita-eabi-strip | ||
|
||
PROJECT_TITLE := VitaForge | ||
PROJECT_TITLEID := VSDK00007 | ||
|
||
PROJECT := VitaForge | ||
CFLAGS += -Wl,-q -I../common | ||
CXXFLAGS += -Wl,-q -std=c++11 -I../common | ||
|
||
SRC_C :=$(call rwildcard, src/, *.c) | ||
SRC_CPP :=$(call rwildcard, src/, *.cpp) | ||
|
||
OBJ_DIRS := $(addprefix out/, $(dir $(SRC_C:src/%.c=%.o))) $(addprefix out/, $(dir $(SRC_CPP:src/%.cpp=%.o))) | ||
OBJS := $(addprefix out/, $(SRC_C:src/%.c=%.o)) $(addprefix out/, $(SRC_CPP:src/%.cpp=%.o)) | ||
|
||
# Needed by psvDebugScreenPrintf | ||
LIBS += -lSceDisplay_stub -lSceRegistryMgr_stub -lSceCtrl_stub -lSceVshBridge_stub # Added SceRegMgr_stub here | ||
|
||
all: package | ||
|
||
package: $(PROJECT).vpk | ||
|
||
$(PROJECT).vpk: eboot.bin param.sfo | ||
vita-pack-vpk -s param.sfo -b eboot.bin \ | ||
--add sce_sys/icon0.png=sce_sys/icon0.png \ | ||
--add sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \ | ||
--add sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \ | ||
--add sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \ | ||
$(PROJECT).vpk | ||
|
||
eboot.bin: $(PROJECT).velf | ||
vita-make-fself $(PROJECT).velf eboot.bin | ||
|
||
param.sfo: | ||
vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo | ||
|
||
$(PROJECT).velf: $(PROJECT).elf | ||
$(STRIP) -g $< | ||
vita-elf-create $< $@ | ||
|
||
$(PROJECT).elf: $(OBJS) | ||
$(CXX) $(CXXFLAGS) $^ $(LIBS) -o $@ | ||
|
||
$(OBJ_DIRS): | ||
mkdir -p $@ | ||
|
||
out/%.o : src/%.cpp | $(OBJ_DIRS) | ||
arm-vita-eabi-g++ -c $(CXXFLAGS) -o $@ $< | ||
|
||
out/%.o : src/%.c | $(OBJ_DIRS) | ||
arm-vita-eabi-gcc -c $(CFLAGS) -o $@ $< | ||
|
||
clean: | ||
rm -f $(PROJECT).velf $(PROJECT).elf $(PROJECT).vpk param.sfo eboot.bin $(OBJS) | ||
rm -r $(abspath $(OBJ_DIRS)) |
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,28 @@ | ||
## VitaForge - Playstation Vita mod menu v1.00 | ||
|
||
VitaForge - 3DSForge clone for the Playstation Vita | ||
|
||
Note: VitaForge got multiple times tested on real Playstation Viita hardware. | ||
|
||
**DISCLAIMER**: This tool is for educational purposes **ONLY** and I am not responsible for any damage. | ||
|
||
### Options (more coming soon) : | ||
``` | ||
Show full sys info (identy) | ||
| Firmware version | ||
| System version | ||
| Playstation Vita Unit | ||
| Motherboard | ||
| Playstation Vita CID | ||
| PSID | ||
``` | ||
|
||
You can skip the compilation part if you want to. You just have to download the latest precompiled version from the releases. | ||
|
||
### Compilation: | ||
Make sure you have vitasdk cmake g++/gcc installed before running these | ||
``` | ||
git clone https://github.com/SpectrTech/VitaForge.git | ||
cd 3DSForge | ||
make | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<livearea style="a1" format-ver="01.00" content-rev="1"> | ||
<livearea-background> | ||
<image>bg.png</image> | ||
</livearea-background> | ||
|
||
<gate> | ||
<startup-image>startup.png</startup-image> | ||
</gate> | ||
</livearea> |
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,180 @@ | ||
#ifndef DEBUG_SCREEN_H | ||
#define DEBUG_SCREEN_H | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdarg.h> | ||
#include <stdint.h> | ||
|
||
#include <psp2/display.h> | ||
#include <psp2/kernel/sysmem.h> | ||
#include <psp2/kernel/threadmgr.h> | ||
|
||
extern unsigned char psvDebugScreenFont[]; | ||
|
||
#define SCREEN_WIDTH (960) | ||
#define SCREEN_HEIGHT (544) | ||
#define SCREEN_FB_WIDTH (960) | ||
#define SCREEN_FB_SIZE (2 * 1024 * 1024) | ||
#define SCREEN_FB_ALIGN (256 * 1024) | ||
#define SCREEN_GLYPH_W (8) | ||
#define SCREEN_GLYPH_H (8) | ||
|
||
#define COLOR_BLACK 0xFF000000 | ||
#define COLOR_RED 0xFF0000FF | ||
#define COLOR_BLUE 0xFF00FF00 | ||
#define COLOR_YELLOW 0xFF00FFFF | ||
#define COLOR_GREEN 0xFFFF0000 | ||
#define COLOR_MAGENTA 0xFFFF00FF | ||
#define COLOR_CYAN 0xFFFFFF00 | ||
#define COLOR_WHITE 0xFFFFFFFF | ||
#define COLOR_GREY 0xFF808080 | ||
#define COLOR_DEFAULT_FG COLOR_WHITE | ||
#define COLOR_DEFAULT_BG COLOR_BLACK | ||
|
||
static int psvDebugScreenMutex; /*< avoid race condition when outputing strings */ | ||
static uint32_t psvDebugScreenCoordX = 0; | ||
static uint32_t psvDebugScreenCoordY = 0; | ||
static uint32_t psvDebugScreenColorFg = COLOR_DEFAULT_FG; | ||
static uint32_t psvDebugScreenColorBg = COLOR_DEFAULT_BG; | ||
static SceDisplayFrameBuf psvDebugScreenFrameBuf = { | ||
sizeof(SceDisplayFrameBuf), NULL, SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT}; | ||
|
||
/* Set the color of the foreground (text) */ | ||
uint32_t psvDebugScreenSetFgColor(uint32_t color) { | ||
uint32_t prev_color = psvDebugScreenColorFg; | ||
psvDebugScreenColorFg = color; | ||
return prev_color; | ||
} | ||
|
||
/* Set the color of the background*/ | ||
uint32_t psvDebugScreenSetBgColor(uint32_t color) { | ||
uint32_t prev_color = psvDebugScreenColorBg; | ||
psvDebugScreenColorBg = color; | ||
return prev_color; | ||
} | ||
|
||
static size_t psvDebugScreenEscape(const char *str){ | ||
int i,j, p=0, params[8]={}; | ||
for(i=0; i<8 && str[i]!='\0'; i++){ | ||
if(str[i] >= '0' && str[i] <= '9'){ | ||
params[p]=(params[p]*10) + (str[i] - '0'); | ||
}else if(str[i] == ';'){ | ||
p++; | ||
}else if(str[i] == 'f' || str[i] == 'H'){ | ||
psvDebugScreenCoordX = params[0] * SCREEN_GLYPH_W; | ||
psvDebugScreenCoordY = params[1] * SCREEN_GLYPH_H; | ||
break; | ||
}else if (str[i] == 'm'){ | ||
for(j=0; j<=p; j++){ | ||
switch(params[j]/10){/*bold,dim,underline,blink,invert,hidden => unsupported yet */ | ||
#define BIT2BYTE(bit) ( ((!!(bit&4))<<23) | ((!!(bit&2))<<15) | ((!!(bit&1))<<7) ) | ||
case 0:psvDebugScreenSetFgColor(COLOR_DEFAULT_FG);psvDebugScreenSetBgColor(COLOR_DEFAULT_BG);break; | ||
case 3:psvDebugScreenSetFgColor(BIT2BYTE(params[j]%10));break; | ||
case 9:psvDebugScreenSetFgColor(BIT2BYTE(params[j]%10) | 0x7F7F7F7F);break; | ||
case 4:psvDebugScreenSetBgColor(BIT2BYTE(params[j]%10));break; | ||
case 10:psvDebugScreenSetBgColor(BIT2BYTE(params[j]%10) | 0x7F7F7F7F);break; | ||
#undef BIT2BYTE | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
return i; | ||
} | ||
|
||
/*Initializes the psvDebugScreen library. Run this before any other function*/ | ||
int psvDebugScreenInit() { | ||
psvDebugScreenMutex = sceKernelCreateMutex("log_mutex", 0, 0, NULL); | ||
SceUID displayblock = sceKernelAllocMemBlock("display", SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, SCREEN_FB_SIZE, NULL); | ||
sceKernelGetMemBlockBase(displayblock, (void**)&psvDebugScreenFrameBuf.base); | ||
|
||
SceDisplayFrameBuf framebuf = { | ||
.size = sizeof(framebuf), | ||
.base = psvDebugScreenFrameBuf.base, | ||
.pitch = SCREEN_WIDTH, | ||
.pixelformat = SCE_DISPLAY_PIXELFORMAT_A8B8G8R8, | ||
.width = SCREEN_WIDTH, | ||
.height = SCREEN_HEIGHT, | ||
}; | ||
|
||
return sceDisplaySetFrameBuf(&framebuf, SCE_DISPLAY_SETBUF_NEXTFRAME); | ||
} | ||
|
||
/* Clears the screen*/ | ||
void psvDebugScreenClear(int bg_color){ | ||
psvDebugScreenCoordX = psvDebugScreenCoordY = 0; | ||
int i; | ||
for(i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; i++) { | ||
((uint32_t*)psvDebugScreenFrameBuf.base)[i] = bg_color; | ||
} | ||
} | ||
|
||
#define PSV_DEBUG_SCALE 2 | ||
|
||
int psvDebugScreenPuts(const char * text){ | ||
int c, i, j, l, x, y; | ||
uint8_t *font; | ||
uint32_t *vram_ptr; | ||
uint32_t *vram; | ||
|
||
sceKernelLockMutex(psvDebugScreenMutex, 1, NULL); | ||
|
||
for (c = 0; text[c] != '\0' ; c++) { | ||
if (psvDebugScreenCoordX + 8 > SCREEN_WIDTH) { | ||
psvDebugScreenCoordY += SCREEN_GLYPH_H * PSV_DEBUG_SCALE; | ||
psvDebugScreenCoordX = 0; | ||
} | ||
if (psvDebugScreenCoordY + 8 > SCREEN_HEIGHT) { | ||
psvDebugScreenClear(psvDebugScreenColorBg); | ||
} | ||
if (text[c] == '\n') { | ||
psvDebugScreenCoordX = 0; | ||
psvDebugScreenCoordY += SCREEN_GLYPH_H * PSV_DEBUG_SCALE; | ||
continue; | ||
} else if (text[c] == '\r') { | ||
psvDebugScreenCoordX = 0; | ||
continue; | ||
} else if ((text[c] == '\e') && (text[c+1] == '[')) { /* escape code (change color, position ...) */ | ||
c+=psvDebugScreenEscape(text+2)+2; | ||
continue; | ||
} | ||
|
||
vram = (uint32_t*)psvDebugScreenFrameBuf.base; | ||
|
||
font = &psvDebugScreenFont[ (int)text[c] * 8]; | ||
for (i = l = 0; i < SCREEN_GLYPH_W; i++, l += SCREEN_GLYPH_W, font++) { | ||
for (j = 0; j < SCREEN_GLYPH_W; j++) { | ||
for (y = 0; y < PSV_DEBUG_SCALE; y++) { | ||
for (x = 0; x < PSV_DEBUG_SCALE; x++) { | ||
vram_ptr = &vram[(psvDebugScreenCoordX + x + j * PSV_DEBUG_SCALE) + | ||
(psvDebugScreenCoordY + y + i * PSV_DEBUG_SCALE) * SCREEN_FB_WIDTH]; | ||
if ((*font & (128 >> j))) | ||
*vram_ptr = psvDebugScreenColorFg; | ||
else | ||
*vram_ptr = psvDebugScreenColorBg; | ||
} | ||
} | ||
} | ||
} | ||
psvDebugScreenCoordX += SCREEN_GLYPH_W * PSV_DEBUG_SCALE; | ||
} | ||
|
||
sceKernelUnlockMutex(psvDebugScreenMutex, 1); | ||
return c; | ||
} | ||
|
||
/* printf to the screen */ | ||
int psvDebugScreenPrintf(const char *format, ...) { | ||
char buf[512]; | ||
|
||
va_list opt; | ||
va_start(opt, format); | ||
int ret = vsnprintf(buf, sizeof(buf), format, opt); | ||
psvDebugScreenPuts(buf); | ||
va_end(opt); | ||
|
||
return ret; | ||
} | ||
|
||
#endif |
Oops, something went wrong.