Add source code

This commit is contained in:
Li 2022-05-25 03:33:02 +12:00
parent e25745d42c
commit e74c23a783
6 changed files with 95 additions and 11 deletions

2
.gitignore vendored
View File

@ -1,4 +1,3 @@
# ---> C
# Prerequisites
*.d
@ -51,4 +50,3 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@ -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

View File

@ -1,3 +1,3 @@
# PocketstationUnlocker
- PocketStationUnlocker -
Forces pocketstation support in all PS1 games.
Forces PocketStation support in all PS1 games.

51
src/CMakeLists.txt Normal file
View File

@ -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
)

8
src/exports.yml Normal file
View File

@ -0,0 +1,8 @@
PocketStationUnlcoker:
attributes: 0
version:
major: 1
minor: 1
main:
start: module_start
stop: module_stop

View File

@ -0,0 +1,33 @@
// PocketStationUnlocker
// Created by SilicaAndPina (she/they)
#include <stdio.h>
#include <stdarg.h>
#include <taihen.h>
#include <vitasdkkern.h>
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;
}