First pass adding vita support

This commit is contained in:
2023-03-13 12:07:29 -07:00
parent a3b4da498e
commit 3587efb9ad
21 changed files with 271 additions and 116 deletions

View File

@ -0,0 +1,48 @@
# Copyright (c) 2022 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Libraries
target_link_libraries(${DAWN_TARGET_NAME}
SceLibKernel_stub
SceDisplay_stub
stdc++
pthread
)
# Includes
target_include_directories(${DAWN_TARGET_NAME}
PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)
# Platform variables
# Subdirs
add_subdirectory(host)
# Toolchain
include("$ENV{VITASDK}/share/vita.cmake" REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11" CACHE INTERNAL ${DAWN_CACHE_TARGET})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE INTERNAL ${DAWN_CACHE_TARGET})
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1" CACHE INTERNAL ${DAWN_CACHE_TARGET})
# VPK Packaging
if(NOT DEFINED DAWN_VITA_APP_NAME)
message(FATAL_ERROR "Please define DAWN_VITA_APP_NAME in your target.")
endif()
if(NOT DEFINED DAWN_VITA_TITLEID)
message(FATAL_ERROR "Please define DAWN_VITA_TITLEID in your target.")
endif()
if(NOT DEFINED DAWN_VITA_VERSION)
message(FATAL_ERROR "Please define DAWN_VITA_VERSION in your target.")
endif()
# The Vita SDK actually assumes that the binary is in the same dir as the build,
# so we actually need to hijack this and point to a file instead.
vita_create_self(${DAWN_TARGET_NAME}.self ${DAWN_BUILD_BINARY})
vita_create_vpk(${DAWN_TARGET_NAME}.vpk ${DAWN_VITA_TITLEID} ${DAWN_TARGET_NAME}.self
VERSION ${DAWN_VITA_VERSION}
NAME ${DAWN_VITA_APP_NAME}
)

View File

@ -0,0 +1,10 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
DawnHostVita.cpp
)

View File

@ -0,0 +1,27 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "DawnHostVita.hpp"
int main(int argc, char **args) {
// Success
std::stringstream output;
std::vector<std::string> hello = { "Hello" };
hello.push_back(",");
hello.push_back(" C++ ");
hello.push_back("world!");
for (auto &s : hello) {
// std::cout does't work ATM :(
output << s;
}
output << std::endl;
printf("%s\n", output.str().c_str());
while(1) {
}
sceKernelExitProcess(0);
return 0;
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include <sstream>
#include <vector>
#include <cstdio>
#include <psp2/kernel/processmgr.h>
/**
* Main entry function received by parent Win32 Operating System.
*
* @param argc Count of arguments passed to the program.
* @param args Array of strings provided to the program.
* @return 0 for success, else for any issue/error.
*/
int main(int argc, char **args);