-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on Northfear's work for the Kyuhen homebrew contest.
- Loading branch information
Showing
21 changed files
with
619 additions
and
5 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,85 @@ | ||
include (CMakeParseArguments) | ||
include("${VITASDK}/share/vita.cmake" REQUIRED) | ||
set(GenerateVPKCurrentDir ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
function(generate_vita_package target) | ||
set (options) | ||
set (oneValueArgs | ||
APP_NAME | ||
TITLE_ID | ||
ICON | ||
TEMPLATE | ||
LOAD_IMAGE | ||
BACKGROUND | ||
VERSION | ||
) | ||
set (multiValueArgs) | ||
cmake_parse_arguments(VITA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
get_target_property(VITA_EXECUTABLE ${target} OUTPUT_NAME) | ||
|
||
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d ATTRIBUTE2=12") | ||
vita_create_self(${VITA_EXECUTABLE}.self ${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}) | ||
|
||
if(NOT VITA_APP_NAME OR "${VITA_APP_NAME}" STREQUAL "") | ||
set(VITA_APP_NAME "VitaApp") | ||
endif() | ||
|
||
if(NOT VITA_TITLE_ID OR "${VITA_TITLE_ID}" STREQUAL "") | ||
set(VITA_TITLE_ID "UNKN00000") | ||
endif() | ||
|
||
if(NOT VITA_VERSION OR "${VITA_VERSION}" STREQUAL "") | ||
set(VITA_VERSION "01.00") | ||
endif() | ||
|
||
if(NOT VITA_TEMPLATE OR "${VITA_TEMPLATE}" STREQUAL "") | ||
set(VITA_TEMPLATE ${GenerateVPKCurrentDir}/template.xml) | ||
list(APPEND VPK_FILE_LIST FILE ${VITA_TEMPLATE} sce_sys/livearea/contents/template.xml) | ||
endif() | ||
|
||
if(VITA_ICON) | ||
find_package(ImageMagick COMPONENTS convert) | ||
|
||
if(NOT ImageMagick_convert_FOUND) | ||
message(WARNING "ImageMagick was not found, icons will not be generated.") | ||
endif() | ||
|
||
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_icon0.png" | ||
COMMAND ${ImageMagick_convert_EXECUTABLE} -background none -density 72 -resize 128x128 -units "PixelsPerInch" -type Palette -colors 255 ${VITA_ICON} "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_icon0.png" | ||
MAIN_DEPENDENCY ${VITA_ICON} | ||
COMMENT "Vita Bubble Icon Generation: ${VITA_EXECUTABLE}_icon0.png" | ||
) | ||
|
||
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_startup.png" | ||
COMMAND ${ImageMagick_convert_EXECUTABLE} -background none -density 72 -resize 158x158 -gravity center -extent 280x158 -type Palette -units "PixelsPerInch" -colors 255 ${VITA_ICON} "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_startup.png" | ||
MAIN_DEPENDENCY ${VITA_ICON} | ||
COMMENT "Vita Startup Icon Generation: ${VITA_EXECUTABLE}_startup.png" | ||
) | ||
|
||
add_custom_target(${VITA_EXECUTABLE}_icons | ||
DEPENDS "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_icon0.png" "${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_startup.png" | ||
) | ||
|
||
list(APPEND VPK_FILE_LIST FILE ${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_icon0.png sce_sys/icon0.png) | ||
list(APPEND VPK_FILE_LIST FILE ${CMAKE_BINARY_DIR}/${VITA_EXECUTABLE}_startup.png sce_sys/livearea/contents/startup.png) | ||
add_dependencies(${VITA_EXECUTABLE}.self-self ${VITA_EXECUTABLE}_icons) | ||
endif() | ||
|
||
if(VITA_LOAD_IMAGE) | ||
list(APPEND VPK_FILE_LIST FILE ${VITA_LOAD_IMAGE} sce_sys/pic0.png) | ||
endif() | ||
|
||
if(VITA_BACKGROUND) | ||
list(APPEND VPK_FILE_LIST FILE ${VITA_BACKGROUND} sce_sys/livearea/contents/bg.png) | ||
endif() | ||
|
||
set(VITA_PACK_VPK_FLAGS "") | ||
|
||
vita_create_vpk(${VITA_EXECUTABLE}.vpk ${VITA_TITLE_ID} ${CMAKE_CURRENT_BINARY_DIR}/${VITA_EXECUTABLE}.self | ||
VERSION ${VITA_VERSION} | ||
NAME ${VITA_APP_NAME} | ||
${VPK_FILE_LIST} | ||
) | ||
add_dependencies(${VITA_EXECUTABLE}.self-self ${target}) | ||
endfunction() |
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="psmobile" 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
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
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
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
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
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,92 @@ | ||
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is free | ||
// software: you can redistribute it and/or modify it under the terms of | ||
// the GNU General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
|
||
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed | ||
// in the hope that it will be useful, but with permitted additional restrictions | ||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT | ||
// distributed with this program. You should have received a copy of the | ||
// GNU General Public License along with permitted additional restrictions | ||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection | ||
|
||
#include "paths.h" | ||
|
||
#include <cstring> | ||
#include <psp2/io/dirent.h> | ||
#include <psp2/io/stat.h> | ||
|
||
#define PATH_MAX 256 | ||
|
||
static std::string VitaGamePath; | ||
|
||
const char* PathsClass::Program_Path() | ||
{ | ||
if (ProgramPath.empty()) { | ||
ProgramPath = VitaGamePath; | ||
} | ||
|
||
return ProgramPath.c_str(); | ||
} | ||
|
||
const char* PathsClass::Data_Path() | ||
{ | ||
if (DataPath.empty()) { | ||
if (ProgramPath.empty()) { | ||
// Init the program path first if it hasn't been done already. | ||
Program_Path(); | ||
} | ||
|
||
DataPath = VitaGamePath; | ||
|
||
if (!Suffix.empty()) { | ||
DataPath += SEP + Suffix; | ||
} | ||
} | ||
|
||
return DataPath.c_str(); | ||
} | ||
|
||
const char* PathsClass::User_Path() | ||
{ | ||
if (UserPath.empty()) { | ||
UserPath = VitaGamePath; | ||
|
||
if (!Suffix.empty()) { | ||
UserPath += SEP + Suffix; | ||
} | ||
|
||
Create_Directory(UserPath.c_str()); | ||
} | ||
|
||
return UserPath.c_str(); | ||
} | ||
|
||
bool PathsClass::Create_Directory(const char* dirname) | ||
{ | ||
bool ret = true; | ||
|
||
if (dirname == nullptr) { | ||
return ret; | ||
} | ||
|
||
std::string temp = dirname; | ||
size_t pos = 0; | ||
do { | ||
pos = temp.find_first_of("/", pos + 1); | ||
sceIoMkdir(temp.substr(0, pos).c_str(), 0700); | ||
} while (pos != std::string::npos); | ||
|
||
return ret; | ||
} | ||
|
||
bool PathsClass::Is_Absolute(const char* path) | ||
{ | ||
return path != nullptr && path[0] == 'u' && path[1] == 'x' && path[2] == '0'; | ||
} | ||
|
||
std::string PathsClass::Argv_Path(const char* cmd_arg) | ||
{ | ||
VitaGamePath = cmd_arg; | ||
return VitaGamePath; | ||
} |
Oops, something went wrong.