Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
technicaljicama authored Sep 30, 2023
1 parent 0eb7872 commit 747206f
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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(ReHomeArcade)
include("${VITASDK}/share/vita.cmake" REQUIRED)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions")

include_directories(
)

link_directories(
${CMAKE_CURRENT_BINARY_DIR}
)

if (NOT ${RELEASE})
add_definitions(-DENABLE_LOGGING)
endif()

add_executable(ReHomeArcade
ReHomeArcade.c
)

target_link_libraries(ReHomeArcade
taihen_stub
SceLibKernel_stub
SceLibc_stub
)

set_target_properties(ReHomeArcade
PROPERTIES LINK_FLAGS "-nostdlib"
)

vita_create_self(ReHomeArcade.suprx ReHomeArcade
CONFIG ${CMAKE_SOURCE_DIR}/ReHomeArcade.yml
)
74 changes: 74 additions & 0 deletions ReHomeArcade.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include <psp2/kernel/modulemgr.h>
#include <taihen.h>
#include <string.h>
#include <vitasdk.h>
#include <stdarg.h>


static SceUID xml_bypass;
static SceUID xml_bypass2;

static tai_hook_ref_t xml_bypass2_ref;
static tai_hook_ref_t xml_bypass_ref;

static int has_free = 0;
static int has_demo = 0;

int xml_get_key(int handle, char *key) {
SceUID ret;

ret = TAI_CONTINUE(int, xml_bypass_ref, handle, key);

if(!sceClibStrcmp(key, "free")) {
sceClibPrintf("[ReHomeArcade] key %s\n", key);
has_free = 1;
return 1;
}

if(!sceClibStrcmp(key, "demo_mode")) {
sceClibPrintf("[ReHomeArcade] key %s\n", key);
has_demo = 1;
return 0;
}

return ret;
}

int xml_get_key_value(int handle, int val) {
SceUID ret;

ret = TAI_CONTINUE(int, xml_bypass2_ref, handle, val);

if(has_free) {
has_free = 0;
return 1;
}

if(has_demo) {
has_demo = 0;
return 0;
}

return ret;
}


void _start() __attribute__ ((weak, alias ("module_start")));
void module_start(SceSize argc, const void *args) {
sceClibPrintf("[ReHomeArcade] START\n");

tai_module_info_t tai_info;
tai_info.size = sizeof(tai_module_info_t);

taiGetModuleInfo(TAI_MAIN_MODULE, &tai_info);

xml_bypass = taiHookFunctionOffset(&xml_bypass_ref, tai_info.modid, 0, 0xE06, 1, xml_get_key);
xml_bypass2 = taiHookFunctionOffset(&xml_bypass2_ref, tai_info.modid, 0, 0x11A0, 1, xml_get_key_value);
}

int module_stop(SceSize argc, const void *args) {
taiHookRelease(xml_bypass, xml_bypass_ref);
taiHookRelease(xml_bypass2, xml_bypass2_ref);

return SCE_KERNEL_STOP_SUCCESS;
}
8 changes: 8 additions & 0 deletions ReHomeArcade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ReHomeArcade:
attributes: 0
version:
major: 1
minor: 1
main:
start: module_start
stop: module_stop

0 comments on commit 747206f

Please sign in to comment.