summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiko Asakura2021-02-27 10:18:51 -0500
committerReiko Asakura2021-02-27 10:18:51 -0500
commitf05a4c08da1102eaec3fdaff36151815e3e1587a (patch)
tree8e28d730e137de0aa9d05594611a2da4d41d7ac2
parentBuild with DolceSDK (diff)
downloadmusicpremium-f05a4c08da1102eaec3fdaff36151815e3e1587a.tar.gz
Port to Vita Development Suite
-rw-r--r--CMakeLists.txt44
-rw-r--r--exports.yml8
-rw-r--r--musicpremium.c19
-rw-r--r--musicpremium.emd4
4 files changed, 39 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c2680e..7562cf2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,41 +1,49 @@
#
-# Copyright (C) 2020 Reiko Asakura. All Rights Reserved.
+# Copyright (C) 2020-2021 Reiko Asakura. All Rights Reserved.
#
# Music Premium
#
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.19)
-if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- if(DEFINED ENV{DOLCESDK})
- set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "toolchain file")
- else()
- message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!")
- endif()
-endif()
+set(CMAKE_TOOLCHAIN_FILE "$ENV{SCE_PSP2_SDK_DIR}/host_tools/build/cmake/psp2-snc-toolchain.cmake")
project(music_premium LANGUAGES C)
-include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdlib -Wall -Wextra -O3 -std=c99")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib")
+include(VitaDevelopmentSuite)
+enable_language(EMD)
+set(CMAKE_C_STANDARD 99)
+
+include_directories(SYSTEM
+ ${VDSUITE_KERNEL_INCLUDE_DIRECTORIES}
+)
+
+link_directories(
+ ${VDSUITE_LIBRARY_DIRECTORIES}
+)
+
+add_compile_options(
+ -Xdiag=2
+)
+
+add_link_options(
+ --prx-no-runtime-support
+)
set(ELF "${PROJECT_NAME}.elf")
set(SELF "${PROJECT_NAME}.skprx")
-add_executable("${ELF}"
+add_library("${ELF}" MODULE
musicpremium.c
+ musicpremium.emd
)
target_link_libraries("${ELF}"
SceSblACMgrForDriver_stub
+ SceSysclibForDriver_stub
SceSysrootForKernel_stub
taihenForKernel_stub
taihenModuleUtils_stub
)
-dolce_create_self("${SELF}"
- "${ELF}"
- CONFIG exports.yml
- UNSAFE
-)
+VDSuiteSignElf("${SELF}" "${ELF}")
diff --git a/exports.yml b/exports.yml
deleted file mode 100644
index 91332c1..0000000
--- a/exports.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-MusicPremium:
- attributes: 0
- version:
- major: 1
- minor: 0
- main:
- start: module_start
- stop: module_stop
diff --git a/musicpremium.c b/musicpremium.c
index 552de96..71ade12 100644
--- a/musicpremium.c
+++ b/musicpremium.c
@@ -1,15 +1,15 @@
/*
- Copyright (C) 2020 Reiko Asakura. All Rights Reserved.
+ Copyright (C) 2020-2021 Reiko Asakura. All Rights Reserved.
Music Premium
*/
#include <string.h>
-#include <psp2kern/audioout.h>
-#include <psp2kern/kernel/modulemgr.h>
-#include <psp2kern/kernel/processmgr.h>
-#include <psp2kern/kernel/sysmem.h>
-#include <psp2kern/sblacmgr.h>
+#include <audioout.h>
+#include <kernel/modulemgr.h>
+#include <kernel/constant.h>
+#include <kernel/sysmem.h>
+#include <sblacmgr.h>
#include <taihen.h>
#define GLZ(x) do {\
@@ -110,7 +110,7 @@ static int get_addr(void **inject_addr, void **hook_addr) {
static int sceAudioOutOpenPort_hook(int portType, int len, int freq, int param) {
int port;
- if (portType == SCE_AUDIO_OUT_PORT_TYPE_BGM && ksceSblACMgrIsPspEmu(SCE_KERNEL_PROCESS_ID_SELF)) {
+ if (portType == SCE_AUDIO_OUT_PORT_TYPE_BGM && sceSblACMgrIsPspEmu(SCE_KERNEL_PROCESS_ID_SELF)) {
tai_module_info_t minfo;
minfo.size = sizeof(minfo);
@@ -130,9 +130,9 @@ done:
static int sceAppMgrAcquireBgmPort_impl_hook(void) {
int ret;
- if (ksceSblACMgrIsShell(SCE_KERNEL_PROCESS_ID_SELF)) {
+ if (sceSblACMgrIsShell(SCE_KERNEL_PROCESS_ID_SELF)) {
char tid[0x20];
- ksceKernelGetProcessTitleId(SCE_KERNEL_PROCESS_ID_SELF, tid, sizeof(tid));
+ sceKernelGetProcessTitleId(SCE_KERNEL_PROCESS_ID_SELF, tid, sizeof(tid));
if (STREQ(tid, "VITASHELL") || STREQ(tid, "ELEVENMPV")) {
ret = TAI_CONTINUE(int, hook_ref[1]);
@@ -163,7 +163,6 @@ static void cleanup(void) {
}
}
-int _start() __attribute__ ((weak, alias("module_start")));
int module_start(SceSize argc, const void *argv) { (void)argc; (void)argv;
startup();
diff --git a/musicpremium.emd b/musicpremium.emd
new file mode 100644
index 0000000..e23b4d2
--- /dev/null
+++ b/musicpremium.emd
@@ -0,0 +1,4 @@
+Module: MusicPremium major_version: 1 minor_version: 1
+sceModuleInfo_type: 6
+module_function: module_start localname: module_start
+module_function: module_stop localname: module_stop