From c2bea29dfdce64718cc0774b10a1711dfb23fe30 Mon Sep 17 00:00:00 2001 From: olebeck <31539311+olebeck@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:22:20 +0200 Subject: [PATCH] add base for vita config app --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 +- CONFIG_vita/CMakeLists.txt | 43 ++ CONFIG_vita/ScePaf/CMakeLists.txt | 90 +++ CONFIG_vita/ScePaf/ScePaf.patch | 846 ++++++++++++++++++++++++++ CONFIG_vita/ScePaf/emd2yml.py | 87 +++ CONFIG_vita/ScePaf/include/declspec.h | 3 + CONFIG_vita/ScePaf/include/map | 166 +++++ CONFIG_vita/ScePaf/include/math.h | 162 +++++ CONFIG_vita/exports.yml | 8 + CONFIG_vita/src/app.cpp | 56 ++ CONFIG_vita/src/main.cpp | 66 ++ 12 files changed, 1529 insertions(+), 2 deletions(-) create mode 100644 CONFIG_vita/CMakeLists.txt create mode 100644 CONFIG_vita/ScePaf/CMakeLists.txt create mode 100644 CONFIG_vita/ScePaf/ScePaf.patch create mode 100644 CONFIG_vita/ScePaf/emd2yml.py create mode 100644 CONFIG_vita/ScePaf/include/declspec.h create mode 100644 CONFIG_vita/ScePaf/include/map create mode 100644 CONFIG_vita/ScePaf/include/math.h create mode 100644 CONFIG_vita/exports.yml create mode 100644 CONFIG_vita/src/app.cpp create mode 100644 CONFIG_vita/src/main.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d249e34a..8061e75d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: if: ${{ matrix.vita }} run: | cd build - mkdir dist + mkdir -p dist mv *.vpk dist/ - name: Upload Build Artifacts diff --git a/CMakeLists.txt b/CMakeLists.txt index 00819ca6..08a03c45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,7 +705,7 @@ if(VITA) vita_create_self(isle.self isle UNSAFE) - #add_subdirectory(CONFIG_vita) + add_subdirectory(CONFIG_vita) if(VITA_USE_OPENGLES2) set(VPK_FILE_ARGS) diff --git a/CONFIG_vita/CMakeLists.txt b/CONFIG_vita/CMakeLists.txt new file mode 100644 index 00000000..95ef6b3c --- /dev/null +++ b/CONFIG_vita/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR) + +project(isle-config LANGUAGES CXX C VERSION 0.1) + +add_subdirectory(ScePaf) + +enable_language(CXX ASM) + +add_executable(${PROJECT_NAME} + src/app.cpp + src/main.cpp +) + +target_compile_options(${PROJECT_NAME} PRIVATE + -fno-rtti -fno-exceptions -Wl,-q -Wall -fno-builtin -fshort-wchar -Wno-unused-function -Wno-sign-compare +) + +# todo _start symbol warning +target_link_options(${PROJECT_NAME} PRIVATE + -nostartfiles -nostdlib +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + SceAppMgr_stub + SceLibKernel_stub + SceSysmodule_stub + + ScePafToplevel_stub + ScePafResource_stub + ScePafWidget_stub + ScePafCommon_stub + ScePafStdc_stub +) + +block() + set(VITA_MAKE_FSELF_FLAGS "${VITA_MAKE_FSELF_FLAGS} -a 0x2F00000000000101") + vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME} + CONFIG exports.yml + UNSAFE + STRIPPED + REL_OPTIMIZE + ) +endblock() diff --git a/CONFIG_vita/ScePaf/CMakeLists.txt b/CONFIG_vita/ScePaf/CMakeLists.txt new file mode 100644 index 00000000..6b65b097 --- /dev/null +++ b/CONFIG_vita/ScePaf/CMakeLists.txt @@ -0,0 +1,90 @@ +cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR) + +project(ScePaf) + +FetchContent_Declare( + ScePaf_RE + GIT_REPOSITORY "https://github.com/GrapheneCt/ScePaf-RE" + GIT_TAG "b76d6ae00516b107d37e7e8a1a16211e3b729a07" + UPDATE_DISCONNECTED TRUE + EXCLUDE_FROM_ALL + PATCH_COMMAND patch -p2 < ${CMAKE_CURRENT_LIST_DIR}/ScePaf.patch +) + +FetchContent_MakeAvailable(ScePaf_RE) + +set(SCEPAF_LIBRARIES + ScePafCommon + ScePafThread + ScePafAutoTestTty + ScePafMisc + ScePafLowlayer + ScePafWidget + ScePafStdc + ScePafGraphics + ScePafResource + ScePafToplevel + SceAppSettings + SceCommonGuiDialog + ScePafWebMapView + SceWebUIPlugin +) + +file(MAKE_DIRECTORY ${scepaf_re_BINARY_DIR}/include) +add_custom_command( + OUTPUT ${scepaf_re_BINARY_DIR}/include/paf.h + COMMAND cp -r ${scepaf_re_SOURCE_DIR}/include/ ${scepaf_re_BINARY_DIR} + COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/include/map ${scepaf_re_BINARY_DIR}/include/paf/std/map + COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/include/math.h ${scepaf_re_BINARY_DIR}/include/paf/math/math.h +) + +foreach(library ${SCEPAF_LIBRARIES}) + set(emd ${scepaf_re_SOURCE_DIR}/lib/${library}.emd) + set(yml ${scepaf_re_BINARY_DIR}/${library}.yml) + set(libdir ${scepaf_re_BINARY_DIR}/lib/${library}) + set(libbuilddir ${scepaf_re_BINARY_DIR}/libbuild/${library}) + set(stub ${libdir}/lib${library}_stub.a) + file(MAKE_DIRECTORY ${libbuilddir}) + add_custom_command( + OUTPUT "${yml}" + DEPENDS "${emd}" + COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/emd2yml.py "${yml}" "${emd}" + COMMENT emd2yml ${library} + ) + add_custom_command( + OUTPUT "${stub}" + DEPENDS "${yml}" + COMMAND vita-libs-gen-2 --yml="${yml}" --output="${libbuilddir}" --cmake=true + COMMAND cmake "${libbuilddir}" -B "${libbuilddir}/cmake" + COMMAND cmake --build "${libbuilddir}/cmake" + COMMAND cp "${libbuilddir}/cmake/lib${library}_stub.a" "${stub}" + COMMENT vita-libs-gen ${library} + ) + list(APPEND SCEPAF_STUBS ${stub}) +endforeach() + +add_custom_target( + ScePaf_stubs + DEPENDS ${SCEPAF_STUBS} +) + +add_custom_target( + paf_includes + DEPENDS ${scepaf_re_BINARY_DIR}/include/paf.h +) + +foreach(library ${SCEPAF_LIBRARIES}) + set(stub "${scepaf_re_BINARY_DIR}/lib/${library}/lib${library}_stub.a") + add_library(${library}_stub STATIC IMPORTED GLOBAL) + target_include_directories(${library}_stub INTERFACE + ${scepaf_re_BINARY_DIR}/include + ) + target_link_directories(${library}_stub INTERFACE + "${scepaf_re_BINARY_DIR}/lib/${library}" + ) + set_target_properties(${library}_stub PROPERTIES + IMPORTED_LOCATION ${stub} + ) + target_compile_options(${library}_stub INTERFACE -include ${CMAKE_CURRENT_LIST_DIR}/include/declspec.h) + add_dependencies(${library}_stub paf_includes) +endforeach() diff --git a/CONFIG_vita/ScePaf/ScePaf.patch b/CONFIG_vita/ScePaf/ScePaf.patch new file mode 100644 index 00000000..86aea0b3 --- /dev/null +++ b/CONFIG_vita/ScePaf/ScePaf.patch @@ -0,0 +1,846 @@ +diff -u -r ./ScePaf-RE/include/paf/autotest/tty.h ./include/paf/autotest/tty.h +--- ./ScePaf-RE/include/paf/autotest/tty.h 2025-05-19 23:50:58.286731500 +0900 ++++ ./include/paf/autotest/tty.h 2025-05-19 23:51:02.277580600 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + + namespace paf { + namespace autotest +diff -u -r ./ScePaf-RE/include/paf/common/array_func.h ./include/paf/common/array_func.h +--- ./ScePaf-RE/include/paf/common/array_func.h 2025-05-19 23:50:58.329477700 +0900 ++++ ./include/paf/common/array_func.h 2025-05-19 23:51:02.384806600 +0900 +@@ -25,7 +25,7 @@ + + } + +- assign(T* a_data, size_t a_capacity, size_t a_size) ++ void assign(T* a_data, size_t a_capacity, size_t a_size) + { + m_buffer = a_data; + m_size = a_size; +diff -u -r ./ScePaf-RE/include/paf/common/averaged_value.h ./include/paf/common/averaged_value.h +--- ./ScePaf-RE/include/paf/common/averaged_value.h 2025-05-19 23:50:58.334478500 +0900 ++++ ./include/paf/common/averaged_value.h 2025-05-19 23:51:02.433758400 +0900 +@@ -60,6 +60,7 @@ + _last_avg = _sum / _avg; + _count = 0; + } ++ return *this; + } + + operator float() const +diff -u -r ./ScePaf-RE/include/paf/common/call_list.h ./include/paf/common/call_list.h +--- ./ScePaf-RE/include/paf/common/call_list.h 2025-05-19 23:50:58.337522100 +0900 ++++ ./include/paf/common/call_list.h 2025-05-19 23:51:02.446775200 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_COMMON_CALL_LIST_H + #define _VDSUITE_USER_PAF_COMMON_CALL_LIST_H + +-#include ++#include + #include + + namespace paf { +diff -u -r ./ScePaf-RE/include/paf/common/halt_assert.h ./include/paf/common/halt_assert.h +--- ./ScePaf-RE/include/paf/common/halt_assert.h 2025-05-19 23:50:58.351876400 +0900 ++++ ./include/paf/common/halt_assert.h 2025-05-19 23:51:02.451774900 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_COMMON_HALT_ASSERT_H + #define _VDSUITE_USER_PAF_COMMON_HALT_ASSERT_H + +-#include ++#include + + namespace paf { + namespace common_internal { +@@ -19,7 +19,7 @@ + + namespace common { + +- __declspec (dllimport) void* _error_callback; ++ __declspec (dllimport) extern void* _error_callback; + } + } + +diff -u -r ./ScePaf-RE/include/paf/common/shared_ptr.h ./include/paf/common/shared_ptr.h +--- ./ScePaf-RE/include/paf/common/shared_ptr.h 2025-05-19 23:50:58.375962800 +0900 ++++ ./include/paf/common/shared_ptr.h 2025-05-19 23:51:02.377806000 +0900 +@@ -19,7 +19,7 @@ + class RefCounter + { + +- template friend class SharedPtr; ++ // template friend class SharedPtr; + + public: + +diff -u -r ./ScePaf-RE/include/paf/common/small_string.h ./include/paf/common/small_string.h +--- ./ScePaf-RE/include/paf/common/small_string.h 2025-05-19 23:50:58.378966900 +0900 ++++ ./include/paf/common/small_string.h 2025-05-19 23:51:02.408946400 +0900 +@@ -49,7 +49,7 @@ + do { + *(char *)((int)_data + i) = src[i]; + i++; +- } while (i < minlen); ++ } while (i < (int32_t)minlen); + } + *(char *)((int)_data + i) = 0; + return; +diff -u -r ./ScePaf-RE/include/paf/common/tokenizer.h ./include/paf/common/tokenizer.h +--- ./ScePaf-RE/include/paf/common/tokenizer.h 2025-05-19 23:50:58.399000600 +0900 ++++ ./include/paf/common/tokenizer.h 2025-05-19 23:51:02.316900500 +0900 +@@ -50,7 +50,7 @@ + + void addSeparatorChars(string const& value) + { +- for (int32_t i = 0; i != value.size(); i++) ++ for (int32_t i = 0; i != (int32_t)value.size(); i++) + { + string sep(value, i, 1); + addSeparator(sep); +@@ -75,7 +75,7 @@ + } + else + { +- for (int32_t i = 0; i != _tokens.size(); i++) ++ for (int32_t i = 0; i != (int32_t)_tokens.size(); i++) + { + if (match(_loc._next_pos, _tokens[i].c_str())) + { +@@ -87,7 +87,7 @@ + } + } + +- for (int32_t i = 0; i != _separators.size(); i++) ++ for (int32_t i = 0; i != (int32_t)_separators.size(); i++) + { + if (match(_loc._next_pos, _separators[i].c_str())) + { +@@ -176,7 +176,7 @@ + bool match(size_t pos, const char *str) const + { + const char *spos = str; +- for (int32_t i = pos; (*spos != '\0' && (i < _src_size)); i++) ++ for (int32_t i = pos; (*spos != '\0' && (i < (int32_t)_src_size)); i++) + { + if (*spos != _src[i]) + { +diff -u -r ./ScePaf-RE/include/paf/file/bufferedfile.h ./include/paf/file/bufferedfile.h +--- ./ScePaf-RE/include/paf/file/bufferedfile.h 2025-05-19 23:50:58.445551300 +0900 ++++ ./include/paf/file/bufferedfile.h 2025-05-19 23:51:02.210581400 +0900 +@@ -7,7 +7,6 @@ + + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/file/file.h ./include/paf/file/file.h +--- ./ScePaf-RE/include/paf/file/file.h 2025-05-19 23:50:58.451551200 +0900 ++++ ./include/paf/file/file.h 2025-05-19 23:51:02.215731000 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + #include + + namespace paf { +diff -u -r ./ScePaf-RE/include/paf/file/httpfile.h ./include/paf/file/httpfile.h +--- ./ScePaf-RE/include/paf/file/httpfile.h 2025-05-19 23:50:58.453552300 +0900 ++++ ./include/paf/file/httpfile.h 2025-05-19 23:51:02.221734700 +0900 +@@ -7,7 +7,6 @@ + + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/file/localfile.h ./include/paf/file/localfile.h +--- ./ScePaf-RE/include/paf/file/localfile.h 2025-05-19 23:50:58.463600400 +0900 ++++ ./include/paf/file/localfile.h 2025-05-19 23:51:02.233069200 +0900 +@@ -7,7 +7,6 @@ + + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/file/localfile_psp2.h ./include/paf/file/localfile_psp2.h +--- ./ScePaf-RE/include/paf/file/localfile_psp2.h 2025-05-19 23:50:58.482127800 +0900 ++++ ./include/paf/file/localfile_psp2.h 2025-05-19 23:51:02.238576400 +0900 +@@ -7,7 +7,6 @@ + + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/file/memfile.h ./include/paf/file/memfile.h +--- ./ScePaf-RE/include/paf/file/memfile.h 2025-05-19 23:50:58.491636300 +0900 ++++ ./include/paf/file/memfile.h 2025-05-19 23:51:02.253603500 +0900 +@@ -7,7 +7,6 @@ + + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/framework.h ./include/paf/framework.h +--- ./ScePaf-RE/include/paf/framework.h 2025-05-19 23:50:58.494635700 +0900 ++++ ./include/paf/framework.h 2025-05-19 23:51:00.114615600 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include +@@ -221,7 +221,7 @@ + + Locale GetCommonResourceLocale() const; + +- Locale paf::Framework::GetLocale() const ++ Locale GetLocale() const + { + return m_locale; + } +diff -u -r ./ScePaf-RE/include/paf/graphics/arl/gxm/gxm_arl_frontend.h ./include/paf/graphics/arl/gxm/gxm_arl_frontend.h +--- ./ScePaf-RE/include/paf/graphics/arl/gxm/gxm_arl_frontend.h 2025-05-19 23:50:58.521754900 +0900 ++++ ./include/paf/graphics/arl/gxm/gxm_arl_frontend.h 2025-05-19 23:51:00.149011200 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_GRAPHICS_ARL_GXM_GXM_ARL_FRONTEND_H + + #include +-#include ++#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/graphics/drawobj/plane_obj.h ./include/paf/graphics/drawobj/plane_obj.h +--- ./ScePaf-RE/include/paf/graphics/drawobj/plane_obj.h 2025-05-19 23:50:58.542778600 +0900 ++++ ./include/paf/graphics/drawobj/plane_obj.h 2025-05-19 23:51:00.183589500 +0900 +@@ -18,7 +18,7 @@ + { + public: + +- enum AlignMode ++ enum AlignMode : int + { + ALIGN_CENTER = 0, + ALIGN_NONE = 0, +@@ -30,7 +30,7 @@ + ALIGN_TOP = 2 + }; + +- enum ScaleMode ++ enum ScaleMode : int + { + SCALE_SIZE = 0, + SCALE_SURFACE = 1, +diff -u -r ./ScePaf-RE/include/paf/graphics/surface/surface.h ./include/paf/graphics/surface/surface.h +--- ./ScePaf-RE/include/paf/graphics/surface/surface.h 2025-05-19 23:50:58.575951800 +0900 ++++ ./include/paf/graphics/surface/surface.h 2025-05-19 23:51:00.237074500 +0900 +@@ -7,7 +7,8 @@ + + #include + #include +-#include ++#include ++#include + #include + #include + #include +@@ -53,7 +54,7 @@ + + int32_t UnsafeRelease() + { +- sceAtomicDecrement32AcqRel(&m_ref_count); ++ sceKernelAtomicAddAndGet32((SceInt32 *)&m_ref_count, ~0); + return m_ref_count; + }; + +@@ -232,7 +233,7 @@ + + static intrusive_ptr Load(SurfacePool *pool, common::SharedPtr src, LoadOption *option = NULL); + +- static intrusive_ptr Load(SurfacePool *pool, void *buf, off_t size, LoadOption *option); ++ static intrusive_ptr Load(SurfacePool *pool, void *buf, SceInt64 size, LoadOption *option); + + //static intrusive_ptr Load(SurfacePool *pool, void *buf, off_t size, uint32_t ununsed = 0, LoadOption *option = NULL); + +@@ -352,7 +353,7 @@ + + int32_t UnsafeRelease() + { +- sceAtomicDecrement32AcqRel(&m_ref_count); ++ sceKernelAtomicAddAndGet32((SceInt32 *)&m_ref_count, ~0); + return m_ref_count; + }; + +diff -u -r ./ScePaf-RE/include/paf/graphics/surface/surface_display.h ./include/paf/graphics/surface/surface_display.h +--- ./ScePaf-RE/include/paf/graphics/surface/surface_display.h 2025-05-19 23:50:58.586014200 +0900 ++++ ./include/paf/graphics/surface/surface_display.h 2025-05-19 23:51:00.251583800 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/graphics/surface/surface_screen.h ./include/paf/graphics/surface/surface_screen.h +--- ./ScePaf-RE/include/paf/graphics/surface/surface_screen.h 2025-05-19 23:50:58.599521900 +0900 ++++ ./include/paf/graphics/surface/surface_screen.h 2025-05-19 23:51:00.264905700 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/inputdevice/keyboard/keyboard.h ./include/paf/inputdevice/keyboard/keyboard.h +--- ./ScePaf-RE/include/paf/inputdevice/keyboard/keyboard.h 2025-05-19 23:50:58.680824500 +0900 ++++ ./include/paf/inputdevice/keyboard/keyboard.h 2025-05-19 23:51:00.540807400 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_INPUTDEVICE_KEYBOARD_KEYBOARD_H + + #include +-#include ++#include + + namespace paf { + namespace inputdevice { +diff -u -r ./ScePaf-RE/include/paf/inputdevice/pad/pad.h ./include/paf/inputdevice/pad/pad.h +--- ./ScePaf-RE/include/paf/inputdevice/pad/pad.h 2025-05-19 23:50:58.697843700 +0900 ++++ ./include/paf/inputdevice/pad/pad.h 2025-05-19 23:51:00.565996500 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_INPUTDEVICE_PAD_PAD_H + + #include +-#include ++#include + + namespace paf { + namespace inputdevice { +diff -u -r ./ScePaf-RE/include/paf/job/job.h ./include/paf/job/job.h +--- ./ScePaf-RE/include/paf/job/job.h 2025-05-19 23:50:58.723490800 +0900 ++++ ./include/paf/job/job.h 2025-05-19 23:51:00.589683600 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_JOB_JOB_H + + #include +-#include ++#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf/math/ngp/misc.h ./include/paf/math/ngp/misc.h +--- ./ScePaf-RE/include/paf/math/ngp/misc.h 2025-05-19 23:50:58.758738000 +0900 ++++ ./include/paf/math/ngp/misc.h 2025-05-19 23:51:00.626774100 +0900 +@@ -58,7 +58,7 @@ + + static inline bool is_pow2(int i) + { +- return ((i | 0x80000000U) & i - 1U) == 0; ++ return ((i | 0x80000000U) & (i - 1U)) == 0; + } + + static float rand1(uint32_t *seed) +diff -u -r ./ScePaf-RE/include/paf/module/module.h ./include/paf/module/module.h +--- ./ScePaf-RE/include/paf/module/module.h 2025-05-19 23:50:58.865358300 +0900 ++++ ./include/paf/module/module.h 2025-05-19 23:51:00.751858300 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_MODULE_MODULE_H + + #include +-#include ++#include + #include + #include + +diff -u -r ./ScePaf-RE/include/paf/paf_cdlg.h ./include/paf/paf_cdlg.h +--- ./ScePaf-RE/include/paf/paf_cdlg.h 2025-05-19 23:50:58.869362600 +0900 ++++ ./include/paf/paf_cdlg.h 2025-05-19 23:51:00.757920800 +0900 +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++#include + + namespace paf { + namespace cdlg { +diff -u -r ./ScePaf-RE/include/paf/paf_types.h ./include/paf/paf_types.h +--- ./ScePaf-RE/include/paf/paf_types.h 2025-05-19 23:50:58.873424000 +0900 ++++ ./include/paf/paf_types.h 2025-05-19 23:51:00.761922300 +0900 +@@ -11,7 +11,7 @@ + extern "C" { + #endif + +-typedef int64_t off_t; ++// typedef int64_t off_t; + + typedef enum ImageMode { + ImageMode_NONE = -1, +diff -u -r ./ScePaf-RE/include/paf/std/list ./include/paf/std/list +--- ./ScePaf-RE/include/paf/std/list 2025-05-19 23:50:58.994744200 +0900 ++++ ./include/paf/std/list 2025-05-19 23:51:00.879902300 +0900 +@@ -159,9 +159,9 @@ + _list_node<_Type, _Alloc> *cnode = root_node->next; + if (cnode != root_node) + { ++ _list_node<_Type, _Alloc> *nnode = cnode->next; + do + { +- _list_node<_Type, _Alloc> *nnode = cnode->next; + _release_node(cnode); + cnode = nnode; + } while (nnode != root_node); +diff -u -r ./ScePaf-RE/include/paf/std/stdc ./include/paf/std/stdc +--- ./ScePaf-RE/include/paf/std/stdc 2025-05-19 23:50:59.043927500 +0900 ++++ ./include/paf/std/stdc 2025-05-19 23:51:00.926642800 +0900 +@@ -1,7 +1,7 @@ + #ifndef _VDSUITE_USER_PAF_STD_STDC_H + #define _VDSUITE_USER_PAF_STD_STDC_H + +-#include ++#include + + namespace paf { + class TTY +diff -u -r ./ScePaf-RE/include/paf/std/stdlib.h ./include/paf/std/stdlib.h +--- ./ScePaf-RE/include/paf/std/stdlib.h 2025-05-19 23:50:59.062661400 +0900 ++++ ./include/paf/std/stdlib.h 2025-05-19 23:51:00.937155300 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_STD_STDLIB_H + #define _VDSUITE_USER_PAF_STD_STDLIB_H + +-#include <../../stddef.h> ++#include + + #ifdef __cplusplus + extern "C" { +diff -u -r ./ScePaf-RE/include/paf/std/string.h ./include/paf/std/string.h +--- ./ScePaf-RE/include/paf/std/string.h 2025-05-19 23:50:59.069416000 +0900 ++++ ./include/paf/std/string.h 2025-05-19 23:51:00.953662800 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_STD_STRING_H + #define _VDSUITE_USER_PAF_STD_STRING_H + +-#include <../../stddef.h> ++#include + + #ifdef __cplusplus + extern "C" { +diff -u -r ./ScePaf-RE/include/paf/std/vector ./include/paf/std/vector +--- ./ScePaf-RE/include/paf/std/vector 2025-05-19 23:50:59.075931800 +0900 ++++ ./include/paf/std/vector 2025-05-19 23:51:00.985950100 +0900 +@@ -1,7 +1,6 @@ + #ifndef _VDSUITE_USER_PAF_STD_VECTOR_H + #define _VDSUITE_USER_PAF_STD_VECTOR_H + +-#include + #include + #include + +diff -u -r ./ScePaf-RE/include/paf/thread/atomic.h ./include/paf/thread/atomic.h +--- ./ScePaf-RE/include/paf/thread/atomic.h 2025-05-19 23:50:59.103955800 +0900 ++++ ./include/paf/thread/atomic.h 2025-05-19 23:51:01.046617400 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_ATOMIC_H + + #include +-#include ++#include + + namespace paf { + namespace thread { +@@ -14,12 +14,12 @@ + + static inline int32_t dec32(volatile int32_t* ptr) + { +- return sceAtomicDecrement32(ptr); ++ return sceKernelAtomicGetAndAdd32((SceInt32 *)ptr, ~0); + } + + static inline int32_t inc32(volatile int32_t* ptr) + { +- return sceAtomicIncrement32(ptr); ++ return sceKernelAtomicGetAndAdd32((SceInt32 *)ptr, 1); + } + } + } +diff -u -r ./ScePaf-RE/include/paf/thread/callqueue.h ./include/paf/thread/callqueue.h +--- ./ScePaf-RE/include/paf/thread/callqueue.h 2025-05-19 23:50:59.113108700 +0900 ++++ ./include/paf/thread/callqueue.h 2025-05-19 23:51:01.051616900 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_CALLQUEUE_H + + #include +-#include ++#include + #include + + namespace paf { +diff -u -r ./ScePaf-RE/include/paf/thread/cond.h ./include/paf/thread/cond.h +--- ./ScePaf-RE/include/paf/thread/cond.h 2025-05-19 23:50:59.119617300 +0900 ++++ ./include/paf/thread/cond.h 2025-05-19 23:51:01.056788500 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_COND_H + + #include +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/mutex.h ./include/paf/thread/mutex.h +--- ./ScePaf-RE/include/paf/thread/mutex.h 2025-05-19 23:50:59.124616900 +0900 ++++ ./include/paf/thread/mutex.h 2025-05-19 23:51:01.062790400 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_THREAD_MUTEX_H + #define _VDSUITE_USER_PAF_THREAD_MUTEX_H + +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/rmutex.h ./include/paf/thread/rmutex.h +--- ./ScePaf-RE/include/paf/thread/rmutex.h 2025-05-19 23:50:59.138038400 +0900 ++++ ./include/paf/thread/rmutex.h 2025-05-19 23:51:01.073384300 +0900 +@@ -5,7 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_THREAD_RMUTEX_H + #define _VDSUITE_USER_PAF_THREAD_RMUTEX_H + +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/rwlock.h ./include/paf/thread/rwlock.h +--- ./ScePaf-RE/include/paf/thread/rwlock.h 2025-05-19 23:50:59.147548200 +0900 ++++ ./include/paf/thread/rwlock.h 2025-05-19 23:51:01.078893000 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_RWLOCK_H + + #include +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/semaphore.h ./include/paf/thread/semaphore.h +--- ./ScePaf-RE/include/paf/thread/semaphore.h 2025-05-19 23:50:59.154547900 +0900 ++++ ./include/paf/thread/semaphore.h 2025-05-19 23:51:01.083893200 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_SEMAPHORE_H + + #include +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/synccall.h ./include/paf/thread/synccall.h +--- ./ScePaf-RE/include/paf/thread/synccall.h 2025-05-19 23:50:59.162064000 +0900 ++++ ./include/paf/thread/synccall.h 2025-05-19 23:51:01.088966200 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_SYNCCALL_H + + #include +-#include ++#include + + namespace paf { + namespace thread { +diff -u -r ./ScePaf-RE/include/paf/thread/thread.h ./include/paf/thread/thread.h +--- ./ScePaf-RE/include/paf/thread/thread.h 2025-05-19 23:50:59.170076900 +0900 ++++ ./include/paf/thread/thread.h 2025-05-19 23:51:01.094967600 +0900 +@@ -6,8 +6,8 @@ + #define _VDSUITE_USER_PAF_THREAD_THREAD_H + + #include +-#include +-#include ++#include ++#include + #include + + namespace paf { +diff -u -r ./ScePaf-RE/include/paf/thread/threadid.h ./include/paf/thread/threadid.h +--- ./ScePaf-RE/include/paf/thread/threadid.h 2025-05-19 23:50:59.179590700 +0900 ++++ ./include/paf/thread/threadid.h 2025-05-19 23:51:01.100477500 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_THREAD_THREADID_H + + #include +-#include ++#include + + typedef SceUID ThreadID; + +diff -u -r ./ScePaf-RE/include/paf/url/url.h ./include/paf/url/url.h +--- ./ScePaf-RE/include/paf/url/url.h 2025-05-19 23:50:59.229043600 +0900 ++++ ./include/paf/url/url.h 2025-05-19 23:51:01.217508800 +0900 +@@ -6,7 +6,7 @@ + #define _VDSUITE_USER_PAF_URL_URL_H + + #include +-#include ++#include + #include + + namespace paf { +diff -u -r ./ScePaf-RE/include/paf/widget/core/event.h ./include/paf/widget/core/event.h +--- ./ScePaf-RE/include/paf/widget/core/event.h 2025-05-19 23:50:59.276212800 +0900 ++++ ./include/paf/widget/core/event.h 2025-05-19 23:51:01.288126400 +0900 +@@ -50,27 +50,27 @@ + + void Forward() + { +- type = type & 0xfff0ffff | ROUTE_FORWARD; ++ type = (type & 0xfff0ffff) | ROUTE_FORWARD; + } + + void Back() + { +- type = type & 0xfff0ffff | ROUTE_BACK; ++ type = (type & 0xfff0ffff) | ROUTE_BACK; + } + + void Consume() + { +- type = type & 0xf0ffffff | STATE_CONSUME; ++ type = (type & 0xf0ffffff) | STATE_CONSUME; + } + + void Direct() + { +- type = type & 0xff0fffff | MODE_DIRECT; ++ type = (type & 0xff0fffff) | MODE_DIRECT; + } + + void Do(uint32_t _type, Handler *w) + { +- type = type & 0xff0fffff | MODE_DO; ++ type = (type & 0xff0fffff) | MODE_DO; + dotype = _type; + target = w; + } +@@ -92,7 +92,7 @@ + + void Grabbed() + { +- type = type & 0xfffffff | 0x10000000; ++ type = (type & 0xfffffff) | 0x10000000; + } + + void SetDetail(uint32_t _detail) +@@ -102,7 +102,7 @@ + + void SetRoute(int32_t route) + { +- type = type & 0xfff0ffff | route; ++ type = (type & 0xfff0ffff) | route; + } + + void SetTarget(Handler *w) +@@ -116,7 +116,7 @@ + + void SetType(uint32_t _type) + { +- type = type & 0xffff0000 | _type & 0xffff; ++ type = (type & 0xffff0000) | (_type & 0xffff); + } + + int32_t SetValue4(int32_t val, int32_t num) +@@ -136,7 +136,7 @@ + + void Term() + { +- type = type & 0xfff0ffff | 0x40000; ++ type = (type & 0xfff0ffff) | 0x40000; + } + + Event& operator=(Event const& rhs) +diff -u -r ./ScePaf-RE/include/paf/widget/core/handler.h ./include/paf/widget/core/handler.h +--- ./ScePaf-RE/include/paf/widget/core/handler.h 2025-05-19 23:50:59.280212600 +0900 ++++ ./include/paf/widget/core/handler.h 2025-05-19 23:51:01.294629200 +0900 +@@ -19,9 +19,10 @@ + { + public: + +- EventCBListener(HandlerCB func, void *data) : m_func(func), m_data(data) ++ EventCBListener(HandlerCB func, void *data) + { +- ++ m_func = func; ++ m_data = data; + } + + virtual ~EventCBListener() +diff -u -r ./ScePaf-RE/include/paf/widget/core/widget.h ./include/paf/widget/core/widget.h +--- ./ScePaf-RE/include/paf/widget/core/widget.h 2025-05-19 23:50:59.306036900 +0900 ++++ ./include/paf/widget/core/widget.h 2025-05-19 23:51:01.314653200 +0900 +@@ -903,7 +903,7 @@ + + int32_t SetAnimDelay(int32_t id, float time, int32_t option) + { +- Timer *timer = new Timer(time, Timer::FUNC_LINEAR, 0, -1, NULL, NULL); ++ Timer *timer = new Timer(time, Timer::FUNC_LINEAR, 0, -1, NULL, 0); + AnimListener *listener = new AnimListener(timer, this, NULL, NULL, NULL); + return SetAnimListener(id, listener, option); + } +diff -u -r ./ScePaf-RE/include/paf/widget/w_button.h ./include/paf/widget/w_button.h +--- ./ScePaf-RE/include/paf/widget/w_button.h 2025-05-19 23:50:59.341569100 +0900 ++++ ./include/paf/widget/w_button.h 2025-05-19 23:51:02.092657700 +0900 +@@ -88,7 +88,7 @@ + + math::v4 GetLayoutSize(math::v4 const& fit_size, math::v4 const& offs); + +- StyleType paf::ui::Button::GetStyleType() const ++ StyleType GetStyleType() const + { + return m_style_type; + } +diff -u -r ./ScePaf-RE/include/paf/widget/w_image_slidebar.h ./include/paf/widget/w_image_slidebar.h +--- ./ScePaf-RE/include/paf/widget/w_image_slidebar.h 2025-05-19 23:50:59.454962400 +0900 ++++ ./include/paf/widget/w_image_slidebar.h 2025-05-19 23:51:01.598622800 +0900 +@@ -40,13 +40,13 @@ + PARTS_IMAGE_SLIDEBAR_END = 2 + }; + +- enum BaseMode ++ enum BaseMode : int + { + BASE_MODE_ZERO_BASED = 0, + BASE_MODE_ONE_BASED = 1 + }; + +- enum TextureMode ++ enum TextureMode : int + { + TEXTURE_MODE_WHOLE = 0, + TEXTURE_MODE_STEP = 1 +diff -u -r ./ScePaf-RE/include/paf/widget/w_progressbar.h ./include/paf/widget/w_progressbar.h +--- ./ScePaf-RE/include/paf/widget/w_progressbar.h 2025-05-19 23:50:59.521830200 +0900 ++++ ./include/paf/widget/w_progressbar.h 2025-05-19 23:51:01.772481100 +0900 +@@ -38,26 +38,26 @@ + CB_PROGRESSBAR_IMMEDIATE_END = 0x20000001 + }; + +- enum BarMode ++ enum BarMode : int + { + BAR_MODE_SINGLE = 0, + BAR_MODE_DOUBLE = 1 + }; + +- enum BarId ++ enum BarId : int + { + BAR_FORE = 0, + BAR_BACK = 1 + }; + +- enum LabelMode ++ enum LabelMode : int + { + LABEL_MODE_PERCENTAGE = 0, + LABEL_MODE_VALUE = 1, + LABEL_MODE_MANUAL = 2 + }; + +- enum LabelPosMode ++ enum LabelPosMode : int + { + LABEL_POS_MODE_CENTER = 0, + LABEL_POS_MODE_LEFT = 1, +diff -u -r ./ScePaf-RE/include/paf/widget/w_progressbar_touch.h ./include/paf/widget/w_progressbar_touch.h +--- ./ScePaf-RE/include/paf/widget/w_progressbar_touch.h 2025-05-19 23:50:59.526341500 +0900 ++++ ./include/paf/widget/w_progressbar_touch.h 2025-05-19 23:51:01.796744000 +0900 +@@ -33,7 +33,7 @@ + CB_PROGRESSBAR_TOUCH_END = 0x10000004 + }; + +- enum SliderMode ++ enum SliderMode : int + { + SLIDER_MODE_NORMAL = 0, + SLIDER_MODE_LIMITED_BY_BACK = 1 +diff -u -r ./ScePaf-RE/include/paf/widget/w_scrollbar.h ./include/paf/widget/w_scrollbar.h +--- ./ScePaf-RE/include/paf/widget/w_scrollbar.h 2025-05-19 23:50:59.613615100 +0900 ++++ ./include/paf/widget/w_scrollbar.h 2025-05-19 23:51:01.913030100 +0900 +@@ -43,7 +43,7 @@ + OBJ_SCROLLBAR_END = 2 + }; + +- enum ScrollType ++ enum ScrollType : int + { + SCROLL_TYPE_VERTICAL = 0, + SCROLL_TYPE_HORIZONTAL = 1 +diff -u -r ./ScePaf-RE/include/paf/widget/w_scrollbar_touch.h ./include/paf/widget/w_scrollbar_touch.h +--- ./ScePaf-RE/include/paf/widget/w_scrollbar_touch.h 2025-05-19 23:50:59.634569800 +0900 ++++ ./include/paf/widget/w_scrollbar_touch.h 2025-05-19 23:51:01.953676000 +0900 +@@ -26,7 +26,7 @@ + CB_SCROLLBAR_TOUCH_END = 0x10000003 + }; + +- enum PageScrollMode ++ enum PageScrollMode : int + { + PAGE_SCROLL_MODE_OFF = 0, + PAGE_SCROLL_MODE_AUTO = 1, +diff -u -r ./ScePaf-RE/include/paf.h ./include/paf.h +--- ./ScePaf-RE/include/paf.h 2025-05-19 23:50:58.278648400 +0900 ++++ ./include/paf.h 2025-05-19 23:51:02.507131800 +0900 +@@ -28,7 +28,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -u -r ./ScePaf-RE/include/paf_web_map_view.h ./include/paf_web_map_view.h +--- ./ScePaf-RE/include/paf_web_map_view.h 2025-05-19 23:50:59.689015300 +0900 ++++ ./include/paf_web_map_view.h 2025-05-19 23:51:00.091019200 +0900 +@@ -5,8 +5,7 @@ + #ifndef _VDSUITE_USER_PAF_WEB_MAP_VIEW_H + #define _VDSUITE_USER_PAF_WEB_MAP_VIEW_H + +-#include +-#include ++#include + #include + #include + +diff -u -r ./ScePaf-RE/include/paf_web_ui.h ./include/paf_web_ui.h +--- ./ScePaf-RE/include/paf_web_ui.h 2025-05-19 23:50:59.693016200 +0900 ++++ ./include/paf_web_ui.h 2025-05-19 23:51:00.097530100 +0900 +@@ -5,7 +5,6 @@ + #ifndef _VDSUITE_USER_PAF_WEB_UI_H + #define _VDSUITE_USER_PAF_WEB_UI_H + +-#include + #include + + namespace paf { diff --git a/CONFIG_vita/ScePaf/emd2yml.py b/CONFIG_vita/ScePaf/emd2yml.py new file mode 100644 index 00000000..dd08748d --- /dev/null +++ b/CONFIG_vita/ScePaf/emd2yml.py @@ -0,0 +1,87 @@ +from collections import defaultdict +import hashlib, binascii, sys + +class EmdLibrary: + name: str + stubfile: str + nidsuffix: str + libnamenid: int + functions: list[str] + variables: list[str] + + def __init__(self): + self.name = "" + self.version = "" + self.stubfile = "" + self.nidsuffix = "" + self.libnamenid = "" + self.functions = [] + self.variables = [] + + +def loadEmd(filename: str): + with open(filename, "r") as f: + lines = f.read().splitlines() + libraries = defaultdict(EmdLibrary) + for line in lines: + if not line: + continue + sp = line.split(" ") + for i in range(0,len(sp), 2): + key = sp[i].replace(":", "") + value = sp[i+1] + if key == "//": + break + match key: + case "Library": + library = libraries[value] + library.name = value + case "function": + ent = [value, ""] + library.functions.append(ent) + case "variable": + ent = [value, ""] + library.variables.append(ent) + case "nidvalue": + ent[1] = value.replace("\"", "") + case "nidsuffix": + library.nidsuffix = value + case "version": + library.version = value + case "libnamenid": + library.libnamenid = value + case "emd" | "attr" | "stubfile": + pass + case _: + print("unk key", key, value) + return list(libraries.values()) + +def nid(name: str, suffix: str): + return "0x"+binascii.b2a_hex(bytes(reversed(hashlib.sha1((name+suffix).encode()).digest()[:4]))).decode() + +def main(): + outyml = sys.argv[1] + emd_filename = sys.argv[2] + emds = loadEmd(emd_filename) + + with open(outyml, "w") as f: + def out(*args): + print(*args, file=f) + out("version: 2") + out("firmware: 3.60") + out("modules:") + for library in emds: + out(f" {library.name}:") + out(f" libraries:") + out(f" {library.name}:") + out(f" kernel: false") + out(f" nid: {library.libnamenid}") + out(f" functions:") + for func, nidvalue in library.functions: + out(f" {func}: {nidvalue or nid(func, library.nidsuffix)}") + if library.variables: + out(f" variables:") + for var, nidvalue in library.variables: + out(f" {var}: {nidvalue or nid(var, library.nidsuffix)}") + +main() diff --git a/CONFIG_vita/ScePaf/include/declspec.h b/CONFIG_vita/ScePaf/include/declspec.h new file mode 100644 index 00000000..924e292e --- /dev/null +++ b/CONFIG_vita/ScePaf/include/declspec.h @@ -0,0 +1,3 @@ +#ifndef __declspec +#define __declspec(__v__) +#endif \ No newline at end of file diff --git a/CONFIG_vita/ScePaf/include/map b/CONFIG_vita/ScePaf/include/map new file mode 100644 index 00000000..e6875ef0 --- /dev/null +++ b/CONFIG_vita/ScePaf/include/map @@ -0,0 +1,166 @@ +#ifndef _VDSUITE_USER_PAF_STD_MAP_H +#define _VDSUITE_USER_PAF_STD_MAP_H + +// #include +// gcc map broke paf widget layout +// #include +#include +#include +#include +#include + +namespace paf { + + template>> + class _tree; + + template + class __tree_node; + + template + class __tree_node { + public: + __tree_node(){ + m_root = this; + m_lower = this; + m_upper = this; + m_unk_0x14 = 0; + m_is_end = 0; + } + + __tree_node(char is_end){ + m_root = this; + m_lower = this; + m_upper = this; + m_unk_0x14 = 0; + m_is_end = is_end; + } + + bool operator==(__tree_node& rhs){ + return m_pair.first == rhs.m_pair.first; + } + + bool operator!=(__tree_node& rhs){ + return !(m_pair.first == rhs.m_pair.first); + } + + __tree_node *m_root; + __tree_node *m_lower; + __tree_node *m_upper; + paf::pair<_Key, _Store> m_pair; + char m_unk_0x14; + char m_is_end; + char m_unk_0x16; + char m_unk_0x17; + }; + + template + class _tree { + public: + typedef _tree<_Key, _Store> _Myt; + + _tree(){ + head = new __tree_node<_Key, _Store>(1); + count = 0; + } + +/* + ~_tree(){ + } +*/ + + class iterator { + public: + iterator(){ + m_ref = NULL; + } + + iterator(__tree_node<_Key, _Store> *_ref){ + m_ref = _ref; + } + + ~iterator(){ + } + + iterator& operator=(iterator& rhs){ + m_ref = rhs.m_ref; + return *this; + } + + bool operator==(iterator rhs){ + return m_ref == rhs.m_ref; + } + + bool operator!=(iterator rhs){ + return !(m_ref == rhs.m_ref); + } + + iterator operator++(int){ + + __tree_node<_Key, _Store> *ref = m_ref; + + if(ref == ref->m_upper->m_upper){ // already end + + if(ref == ref->m_root->m_upper){ + ref = ref->m_upper; + } + + }else if(ref != ref->m_upper->m_root){ // current is haven't right + ref = ref->m_root; + }else{ + ref = ref->m_upper; + while(ref == ref->m_lower->m_root){ + ref = ref->m_lower; + } + } + + m_ref = ref; + + return *this; + } + + paf::pair<_Key, _Store>& operator*(){ + return m_ref->m_pair; + }; + + private: + __tree_node<_Key, _Store> *m_ref; + }; + + iterator begin(void){ + return iterator(head->m_lower); + } + + iterator end(void){ + return iterator(head); + } + + private: + __tree_node<_Key, _Store> *head; + size_t count; + _Alloc alloc; + }; + + template>> + class map; + + template + class map : public _tree<_Key, _Store, _Alloc> { + public: + typedef map<_Key, _Store> _Myt; + + map(){ + } + +/* + ~map(){ + } +*/ + + private: + }; + + typedef class map token_map_t; +} + +#endif \ No newline at end of file diff --git a/CONFIG_vita/ScePaf/include/math.h b/CONFIG_vita/ScePaf/include/math.h new file mode 100644 index 00000000..88ef2f03 --- /dev/null +++ b/CONFIG_vita/ScePaf/include/math.h @@ -0,0 +1,162 @@ +/* + Vita Development Suite Libraries +*/ + +#ifndef _VDSUITE_USER_PAF_MATH_MATH_H +#define _VDSUITE_USER_PAF_MATH_MATH_H + + +#include + +#include + +namespace paf { + namespace math { + class v1 { + private: + SceFPlane impl; + }; + + class v2 { + public: + bool operator!=(const v2& rh){ + if(this->_x != rh._x){ + return true; + } + if(this->_y != rh._y){ + return true; + } + + return false; + } + + bool operator==(const v2& rh){ + return !(*this != rh); + } + + float extract_x() const { + return _x; + } + + float extract_y() const { + return _y; + } + + private: + float _x; + float _y; + }; + + class v3 { + public: + bool operator!=(const v3& rh){ + if(this->_impl.x != rh._impl.x){ + return true; + } + if(this->_impl.y != rh._impl.y){ + return true; + } + if(this->_impl.z != rh._impl.z){ + return true; + } +/* + if(this->impl.d != rh.impl.d){ + return true; + } +*/ + + return false; + } + + bool operator==(const v3& rh){ + return !(*this != rh); + } + + float extract_x() const + { + return _impl.x; + } + + float extract_y() const + { + return _impl.y; + } + + float extract_z() const + { + return _impl.z; + } + + private: + SceFVector4 _impl; + }; + + class v4 { + public: + v4(){ + } + + v4(float a, float b, float c = 0.0f, float d = 0.0f){ + impl.a = a; + impl.b = b; + impl.c = c; + impl.d = d; + } + + static v4 _0000(){ + return v4(0.0f, 0.0f, 0.0f, 0.0f); + } + + bool operator!=(const v4& rh){ + if(this->impl.a != rh.impl.a){ + return true; + } + if(this->impl.b != rh.impl.b){ + return true; + } + if(this->impl.c != rh.impl.c){ + return true; + } + if(this->impl.d != rh.impl.d){ + return true; + } + + return false; + } + + bool operator==(const v4& rh){ + return !(*this != rh); + } + + private: + SceFPlane impl; + }; + class matrix { + private: + SceFMatrix4 impl; + }; + class quaternion { + private: + SceFQuaternion impl; + }; + } +} + +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + + +#endif /* _VDSUITE_USER_PAF_MATH_MATH_H */ \ No newline at end of file diff --git a/CONFIG_vita/exports.yml b/CONFIG_vita/exports.yml new file mode 100644 index 00000000..d20ef9e2 --- /dev/null +++ b/CONFIG_vita/exports.yml @@ -0,0 +1,8 @@ +isle-config: + attributes: 0 + process_image: true + version: + major: 1 + minor: 1 + main: + start: module_start \ No newline at end of file diff --git a/CONFIG_vita/src/app.cpp b/CONFIG_vita/src/app.cpp new file mode 100644 index 00000000..a5704745 --- /dev/null +++ b/CONFIG_vita/src/app.cpp @@ -0,0 +1,56 @@ + +#include +#include +#include +#include +#include + + +char sceUserMainThreadName[] = "paf_sample"; +int sceUserMainThreadPriority = 0x10000100; +int sceUserMainThreadCpuAffinityMask = 0x70000; +SceSize sceUserMainThreadStackSize = 0x4000; + +void operator delete(void *ptr, unsigned int n) { + return sce_paf_free(ptr); +} + +int paf_main(void); + +extern "C" { + typedef struct _ScePafInit { // size is 0x18 + SceSize global_heap_size; + int a2; + int a3; + int cdlg_mode; + int heap_opt_param1; + int heap_opt_param2; + } ScePafInit; + + int module_start(SceSize args, void *argp){ + int load_res; + ScePafInit init_param; + SceSysmoduleOpt sysmodule_opt; + + init_param.global_heap_size = 0x1000000; + init_param.a2 = 0xEA60; + init_param.a3 = 0x40000; + init_param.cdlg_mode = 0; + init_param.heap_opt_param1 = 0; + init_param.heap_opt_param2 = 0; + + load_res = 0xDEADBEEF; + sysmodule_opt.flags = 0; + sysmodule_opt.result = &load_res; + + int res = sceSysmoduleLoadModuleInternalWithArg(SCE_SYSMODULE_INTERNAL_PAF, sizeof(init_param), &init_param, &sysmodule_opt); + if((res | load_res) != 0){ + sceClibPrintf("[PAF PRX Loader] Failed to load the PAF prx. (return value 0x%x, result code 0x%x )\n", res, load_res); + } + + paf_main(); + + return SCE_KERNEL_START_SUCCESS; + } + +} \ No newline at end of file diff --git a/CONFIG_vita/src/main.cpp b/CONFIG_vita/src/main.cpp new file mode 100644 index 00000000..d0321a64 --- /dev/null +++ b/CONFIG_vita/src/main.cpp @@ -0,0 +1,66 @@ +#include + +#include + + +paf::Framework *g_fw; +void *g_rootPage; + + +void loadPluginCB(paf::Plugin *plugin){ + + { + paf::Plugin::PageOpenParam pageOpenParam; + pageOpenParam.option = paf::Plugin::PageOption_None; + + paf::ui::Scene *pScene = plugin->PageOpen("page_main", pageOpenParam); + + g_rootPage = pScene; + + paf::ui::Widget *pPlane = pScene->FindChild("plane_sample_black"); + paf::ui::ProgressBar *pProgressbar = (paf::ui::ProgressBar *)pPlane->FindChild("progressbar"); + + pProgressbar->SetMinValue(0); + pProgressbar->SetMaxValue(100); + + pProgressbar->SetValue(24, true); + + wchar_t *msg_progressbar_text = plugin->GetString("msg_progressbar_text"); + + paf::ui::Text *pText = (paf::ui::Text *)pPlane->FindChild("progressbar_text"); + pText->SetString(paf::wstring(msg_progressbar_text)); + } +} + +int paf_main(void){ + + { + paf::Framework::InitParam fwParam; + fwParam.mode = paf::Framework::Mode_Normal; + + paf::Framework *paf_fw = new paf::Framework(fwParam); + if(paf_fw != NULL){ + g_fw = paf_fw; + + paf_fw->LoadCommonResourceSync(); + + paf::Plugin::InitParam pluginParam; + + pluginParam.name = "sample_plugin"; + pluginParam.caller_name = "__main__"; + pluginParam.resource_file = "app0:/sample_plugin.rco"; + pluginParam.init_func = NULL; + pluginParam.start_func = loadPluginCB; + pluginParam.stop_func = NULL; + pluginParam.exit_func = NULL; + + paf::Plugin::LoadSync(pluginParam); + paf_fw->Run(); + } + } + + sceClibPrintf("[SAMPLE] Failed to run PAF instance\n"); + + exit(0); + return 0; +} \ No newline at end of file