-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Vita port. #818
Draft
OmniBlade
wants to merge
1
commit into
TheAssemblyArmada:vanilla
Choose a base branch
from
OmniBlade:port/vita
base: vanilla
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Initial Vita port. #818
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,93 @@ | ||
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 magick) | ||
|
||
if(ImageMagick_magick_FOUND) | ||
set(ImageMagick_convert_FOUND TRUE) | ||
set(ImageMagick_convert_EXECUTABLE ${ImageMagick_magick_EXECUTABLE}) | ||
set(ImageMagick_convert_ARGS convert) | ||
else() | ||
find_package(ImageMagick COMPONENTS convert) | ||
endif() | ||
|
||
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} ${ImageMagick_convert_ARGS} -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} ${ImageMagick_convert_ARGS} -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,97 @@ | ||
// 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::Concatenate_Paths(const char* path1, const char* path2) | ||
{ | ||
return std::string(path1) + SEP + path2; | ||
} | ||
|
||
std::string PathsClass::Argv_Path(const char* cmd_arg) | ||
{ | ||
VitaGamePath = cmd_arg; | ||
return VitaGamePath; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Same thing here. Maybe we should test if the platform has a
basename
implementation on build time?