diff --git a/.gitignore b/.gitignore index cd531cf..c6127b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -# ---> C # Prerequisites *.d @@ -51,4 +50,3 @@ modules.order Module.symvers Mkfile.old dkms.conf - diff --git a/LICENSE b/LICENSE index fe5bff9..84731b0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1 @@ -This Program 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; version 2 of the License. - -This Program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this Program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -In addition, as a special exception, Red Hat, Inc. gives You the additional right to link the code of this Program with code not covered under the GNU General Public License ("Non-GPL Code") and to distribute linked combinations including the two, subject to the limitations in this paragraph. Non-GPL Code permitted under this exception must only link to the code of this Program through those well defined interfaces identified in the file named EXCEPTION found in the source code files (the "Approved Interfaces"). The files of Non-GPL Code may instantiate templates or use macros or inline functions from the Approved Interfaces without causing the resulting work to be covered by the GNU General Public License. Only Red Hat, Inc. may make changes or additions to the list of Approved Interfaces. You must obey the GNU General Public License in all respects for all of the Program code and other code used in conjunction with the Program except the Non-GPL Code covered by this exception. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to provide this exception without modification, you must delete this exception statement from your version and license this file solely under the GPL without exception. +This software and all associated source code, is hereby entered into The Public Domain \ No newline at end of file diff --git a/README.md b/README.md index a54da03..769af15 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# PocketstationUnlocker +- PocketStationUnlocker - -Forces pocketstation support in all PS1 games. \ No newline at end of file +Forces PocketStation support in all PS1 games. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..1ace7ae --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 2.8) + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + if(DEFINED ENV{VITASDK}) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") + else() + message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") + endif() +endif() + +project(pocketstationunlocker) +include("$ENV{VITASDK}/share/vita.cmake" REQUIRED) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions") + +link_directories( + ${CMAKE_CURRENT_BINARY_DIR} +) + +add_executable(${PROJECT_NAME} + pocketstationunlocker.c +) + +target_link_libraries(${PROJECT_NAME} + k + SceSysmemForDriver_stub + SceThreadmgrForDriver_stub + SceIofilemgrForDriver_stub + SceCpuForDriver_stub + taihenForKernel_stub + gcc + -nostdlib +) +vita_create_self(${PROJECT_NAME}.skprx ${PROJECT_NAME} + UNSAFE + CONFIG ${CMAKE_SOURCE_DIR}/exports.yml +) +vita_create_stubs(${PROJECT_NAME}-stubs ${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/exports.yml + KERNEL +) + +install(DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-stubs/ + DESTINATION lib + FILES_MATCHING PATTERN "*.a" +) + +install(FILES savestates.h + DESTINATION include +) diff --git a/src/exports.yml b/src/exports.yml new file mode 100644 index 0000000..b29fa4f --- /dev/null +++ b/src/exports.yml @@ -0,0 +1,8 @@ +PocketStationUnlcoker: + attributes: 0 + version: + major: 1 + minor: 1 + main: + start: module_start + stop: module_stop diff --git a/src/pocketstationunlocker.c b/src/pocketstationunlocker.c new file mode 100644 index 0000000..2dc6a00 --- /dev/null +++ b/src/pocketstationunlocker.c @@ -0,0 +1,33 @@ +// PocketStationUnlocker +// Created by SilicaAndPina (she/they) + +#include +#include +#include +#include + +static int ispstitle = -1; +static tai_hook_ref_t ref_ispstitle; + +static int return_1() { + return 1; +} + +void _start() __attribute__ ((weak, alias ("module_start"))); +int module_start(SceSize argc, const void *args) +{ + ispstitle = taiHookFunctionExportForKernel(KERNEL_PID, + &ref_ispstitle, + "SceCompat", + TAI_ANY_LIBRARY, + 0x7DCFBCCE, + return_1); + return SCE_KERNEL_START_SUCCESS; +} + +int module_stop(SceSize argc, const void *args) +{ + if (ispstitle >= 0) taiHookReleaseForKernel(ispstitle, ref_ispstitle); + + return SCE_KERNEL_STOP_SUCCESS; +}