├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md └── main.c /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | build 55 | .vscode 56 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.19) 2 | 3 | set(CMAKE_TOOLCHAIN_FILE "$ENV{SCE_PSP2_SDK_DIR}/host_tools/build/cmake/psp2-snc-toolchain.cmake") 4 | 5 | project(reAvPlayer LANGUAGES C) 6 | 7 | include(VitaDevelopmentSuite) 8 | set(CMAKE_C_STANDARD 99) 9 | 10 | add_compile_options( 11 | -Xdiag=0 -Xquit=2 -O3 12 | ) 13 | 14 | add_link_options( 15 | -s 16 | ) 17 | 18 | include_directories( 19 | ${VDSUITE_USER_INCLUDE_DIRECTORIES} 20 | ${VDSUITE_STANDARD_INCLUDE_DIRECTORIES} 21 | ) 22 | 23 | link_directories( 24 | ${VDSUITE_LIBRARY_DIRECTORIES} 25 | ${CMAKE_CURRENT_BINARY_DIR} 26 | ) 27 | 28 | add_library(${PROJECT_NAME}.suprx MODULE 29 | main.c 30 | ) 31 | 32 | target_link_libraries(${PROJECT_NAME}.suprx 33 | taihen_stub_weak 34 | SceVideodecUser_stub_weak 35 | SceSysmodule_stub_weak 36 | SceDbg_stub 37 | ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jaylon Gowie 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReAvPlayer 2 | Plugin to Enable 1080p Video Playback on the PSVita with SceAvPlayer 3 | 4 | ### Main Credit goes to GrapheneCT for the reverse engineering possible to get this to work 5 | 6 | ## Disclaimer 7 | #### This is NOT for normal user use. This is a developer tool. 8 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifndef NDEBUG 10 | #define printf sceClibPrintf 11 | #else 12 | #define printf 13 | #endif 14 | 15 | #define HOOK_NUM 5 16 | tai_module_info_t info; 17 | SceUID hook[HOOK_NUM]; 18 | tai_hook_ref_t hook_ref[HOOK_NUM]; 19 | 20 | int pictureInt = 0; 21 | int buffering_skip = 0; 22 | 23 | static SceInt32 _sceVideodecQueryMemSize_patch(int a, void *b, int c) 24 | { 25 | sceVideodecSetConfigInternal(0x1001, 2); 26 | 27 | sceAvcdecSetDecodeMode(0x1001, 0x80); 28 | 29 | printf("Ran sceVideodecQueryMemSize_patch\n"); 30 | return sceVideodecQueryMemSizeInternal(a, b, c); 31 | } 32 | 33 | static SceInt32 _sceAvcdecQueryDecoderMemSize_patch(int a, void *b, int c) 34 | { 35 | printf("Ran sceAvcdecQueryDecoderMemSize_patch\n"); 36 | return sceAvcdecQueryDecoderMemSizeInternal(a, b, c); 37 | } 38 | 39 | static SceInt32 _sceVideodecInitLibraryWithUnmapMem_patch(int a, void *b, void *c) 40 | { 41 | printf("Ran _sceVideodecInitLibraryWithUnmapMem_patch\n"); 42 | return sceVideodecInitLibraryWithUnmapMemInternal(a, b, c); 43 | } 44 | 45 | static SceInt32 _sceAvcdecCreateDecoder_patch(int a, SceAvcdecCtrl *b, void *c) 46 | { 47 | printf("Ran sceAvcdecCreateDecoder_patch\n"); 48 | return sceAvcdecCreateDecoderInternal(a, b, c); 49 | } 50 | 51 | static SceInt32 _sceAvcdecDecode_patch(SceAvcdecCtrl *a, const SceAvcdecAu *b, SceAvcdecArrayPicture *c) 52 | { 53 | SceAvcdecArrayPicture wap; 54 | printf("Ran sceAvcdecDecode_patch\n"); 55 | printf("SceAvcdecCtrl frameBuf.size %d\n", a->frameBuf.size); 56 | int ret = sceAvcdecDecodeAuInternal(a,b,&pictureInt); 57 | printf("sceAvcdecDecodeAuInternal() 0x%08x\n", ret); 58 | ret = sceAvcdecDecodeGetPictureWithWorkPictureInternal(a, c, &wap, &pictureInt); 59 | printf("sceAvcdecDecodeGetPictureWithWorkPictureInternal() 0x%08x\npicture array: numOfOutput %d\n numOfElm %d\n", ret, c->numOfOutput, c->numOfElm); 60 | return ret; 61 | } 62 | 63 | int module_start(SceSize argc, void *args) 64 | { 65 | int ret = sceSysmoduleLoadModule(SCE_SYSMODULE_AVPLAYER); 66 | printf("## Start AV Player Module: %d\n", ret); 67 | hook[0] = taiHookFunctionImport(&hook_ref[0], "SceAvcodecUser", 0xA166C96E, 0xAF9BDDA7, _sceVideodecQueryMemSize_patch); 68 | hook[1] = taiHookFunctionImport(&hook_ref[1], "SceAvcodecUser", 0xA166C96E, 0x0B47EBC1, _sceAvcdecQueryDecoderMemSize_patch); 69 | hook[2] = taiHookFunctionImport(&hook_ref[2], "SceAvcodecUser", 0xA166C96E, 0x3A8F0E2B, _sceVideodecInitLibraryWithUnmapMem_patch); 70 | hook[3] = taiHookFunctionImport(&hook_ref[3], "SceAvcodecUser", 0xA166C96E, 0x95EF1A0C, _sceAvcdecCreateDecoder_patch); 71 | hook[4] = taiHookFunctionImport(&hook_ref[4], "SceAvcodecUser", 0xA166C96E, 0xCDB74E5D, _sceAvcdecDecode_patch); 72 | printf("Hook 0: 0x%08x\n", hook[0]); 73 | printf("Hook 1: 0x%08x\n", hook[1]); 74 | printf("Hook 2: 0x%08x\n", hook[2]); 75 | printf("Hook 3: 0x%08x\n", hook[3]); 76 | printf("Hook 4: 0x%08x\n", hook[4]); 77 | 78 | info.size = sizeof(info); 79 | taiGetModuleInfo("SceAvPlayer", &info); 80 | taiInjectData(info.modid, 0x00, 0xC2A6, "\xBE\xF5\x80\x5F", 0x04); 81 | 82 | return SCE_KERNEL_START_SUCCESS; 83 | } 84 | 85 | int module_stop() 86 | { 87 | sceSysmoduleUnloadModule(SCE_SYSMODULE_AVPLAYER); 88 | printf("## MODULE STOP ##\n\n"); 89 | int i = 0; 90 | while (i < HOOK_NUM){ 91 | taiHookRelease(hook[i], hook_ref[i]); 92 | i++; 93 | } 94 | return SCE_KERNEL_STOP_SUCCESS; 95 | } 96 | --------------------------------------------------------------------------------