-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5eb2452
Showing
17 changed files
with
1,710 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
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(vivid) | ||
include("${VITASDK}/share/vita.cmake" REQUIRED) | ||
|
||
find_package(SDL2 CONFIG REQUIRED) | ||
|
||
set(VITA_APP_NAME "ViViD") | ||
set(VITA_TITLEID "VVID00001") | ||
set(VITA_VERSION "01.00") | ||
|
||
add_subdirectory(module) | ||
|
||
include_directories( | ||
module/include | ||
) | ||
|
||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/module) | ||
|
||
add_executable(${PROJECT_NAME} | ||
src/main.c | ||
) | ||
|
||
#add_dependencies(${PROJECT_NAME} "vividk.skprx-self") | ||
add_dependencies(${PROJECT_NAME} "vividk_all") | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
SDL2::SDL2-static | ||
vividk_stub_weak | ||
-Wl,--whole-archive pthread -Wl,--no-whole-archive | ||
taihen_stub | ||
SceVshBridge_stub | ||
SceAppMgr_stub | ||
SceShellSvc_stub | ||
) | ||
|
||
vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME} UNSAFE) | ||
vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self | ||
VERSION ${VITA_VERSION} | ||
NAME ${VITA_APP_NAME} | ||
FILE sce_sys sce_sys | ||
FILE data data | ||
FILE ${CMAKE_CURRENT_BINARY_DIR}/module/vividk.skprx module/vividk.skprx | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2022 Cat (Epifanov Ivan) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# ViViD | ||
**Vi**ta **Vi**rtual **D**ualshock | ||
|
||
PSVita app to turn your vita into DualShock™ 3, compatible with PS3, PSTV, PC. | ||
|
||
## Installing | ||
* Install `vivid.vpk` | ||
* Run app, press X and connect your vita with usb cable to PS3, PSTV or PC. | ||
|
||
## FAQ | ||
* **Does it support wireless (bluetooth) connection?** | ||
Not yet. Only wired for now. | ||
* **How do i use L2/R2/L3/R3?** | ||
L2 and R2 are mapped to upper "rectangles" of back touch, L3 and R3 to the lower. L2 and R2 are "analog", e.g. the lower you touch - the higher pressure value (e.g. swiping from top to bottom is like pressing them on real ds3) | ||
* **Can i set up touch points/use front touch?** | ||
No. Maybe in very distant future (read: probably never) | ||
|
||
## License | ||
|
||
MIT, see LICENSE.md | ||
|
||
## Credits | ||
|
||
* [xerpi](https://github.com/xerpi) - for vitapad and udcd work |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
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(vividk) | ||
include("${VITASDK}/share/vita.cmake" REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} | ||
src/main.c | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
SceDebugForDriver_stub | ||
SceCtrlForDriver_stub | ||
SceCpuForDriver_stub | ||
SceKernelSuspendForDriver_stub | ||
SceModulemgrForDriver_stub | ||
SceSysclibForDriver_stub | ||
SceSysmemForDriver_stub | ||
SceSysconForDriver_stub | ||
SceThreadmgrForDriver_stub | ||
SceUdcdForDriver_stub | ||
SceBtForDriver_stub | ||
SceOledForDriver_stub_weak | ||
SceLcdForDriver_stub_weak | ||
taihenForKernel_stub | ||
) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES LINK_FLAGS "-nostdlib" | ||
) | ||
|
||
vita_create_self(${PROJECT_NAME}.skprx ${PROJECT_NAME} | ||
CONFIG vividk.yml | ||
UNSAFE | ||
) | ||
|
||
vita_create_stubs(stubs vividk ${CMAKE_CURRENT_SOURCE_DIR}/vividk.yml KERNEL) | ||
|
||
add_custom_target(vividk_all | ||
ALL | ||
DEPENDS vividk.skprx-self | ||
DEPENDS libvividk_stub.a | ||
DEPENDS libvividk_stub_weak.a | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
#ifndef __DESCRIPTORS_H__ | ||
#define __DESCRIPTORS_H__ | ||
|
||
#include <psp2kern/udcd.h> | ||
static unsigned char hid_report_descriptor[] __attribute__((aligned(64))) = { | ||
0x05, 0x01, // Usage Page (Generic Desktop Ctrls) | ||
0x09, 0x04, // Usage (Joystick) | ||
0xA1, 0x01, // Collection (Application) | ||
0xA1, 0x02, // Collection (Logical) | ||
0x85, 0x01, // Report ID (1) | ||
0x75, 0x08, // Report Size (8) | ||
0x95, 0x01, // Report Count (1) | ||
0x15, 0x00, // Logical Minimum (0) | ||
0x26, 0xFF, // Logical Maximum (255) | ||
0x00, 0x81, 0x03, // Input (Constant, Variable), | ||
0x75, 0x01, // Report Size (1) | ||
0x95, 0x13, // Report Count (19) | ||
0x15, 0x00, // Logical Minimum (0) | ||
0x25, 0x01, // Logical Maximum (1) | ||
0x35, 0x00, // Physical Minimum (0) | ||
0x45, 0x01, // Physical Maximum (1) | ||
0x05, 0x09, // Usage Page (Button) | ||
0x19, 0x01, // Usage Minimum (0x01) | ||
0x29, 0x13, // Usage Maximum (0x13) | ||
0x81, 0x02, // Input (Variable) | ||
0x75, 0x01, // Report Size (1) | ||
0x95, 0x0D, // Report Count (19) | ||
0x06, 0x00, 0xFF, // Usage Page (FF00h), ; FF00h, vendor-defined | ||
0x81, 0x03, // Input (Constant, Variable) | ||
0x15, 0x00, // Logical Minimum (0) | ||
0x26, 0xFF, // Logical Maximum (255) | ||
0x00, 0x05, 0x01, // Usage Page (Desktop), ; Generic desktop controls (01h) | ||
0x09, 0x01, // Usage (Pointer), ; Pointer (01h, physical collection) | ||
0xA1, 0x00, // Collection (Physical), | ||
0x75, 0x08, // Report Size (8) | ||
0x95, 0x04, // Report Count (4) | ||
0x35, 0x00, // Physical Minimum (0) | ||
0x46, 0xFF, // Physical Maximum (255) | ||
0x00, 0x09, 0x30, // Usage (X) | ||
0x09, 0x31, // Usage (Y) | ||
0x09, 0x32, // Usage (Z) | ||
0x09, 0x35, // Usage (Rz) | ||
0x81, 0x02, // Input (Variable) | ||
0xC0, // End Collection | ||
|
||
0x05, 0x01, // Usage Page (Generic Desktop Ctrls) | ||
0x75, 0x08, // Report Size (8) | ||
0x95, 0x27, // Report Count (39) | ||
0x09, 0x01, // Usage (Pointer) | ||
0x81, 0x02, // Input (Variable) | ||
|
||
0x75, 0x08, // Report Size (8) | ||
0x95, 0x30, // Report Count (48) | ||
0x09, 0x01, // Usage (Pointer) | ||
0x91, 0x02, // Output (Variable) | ||
|
||
0x75, 0x08, // Report Size (8) | ||
0x95, 0x30, // Report Count (48) | ||
0x09, 0x01, // Usage (Pointer) | ||
0xB1, 0x02, // Feature (Variable) | ||
0xC0, // End Collection | ||
|
||
0xA1, 0x02, // Collection (Logical) | ||
0x85, 0x02, // Report ID (2) | ||
0x75, 0x08, // Report Size (8), | ||
0x95, 0x30, // Report Count (48), | ||
0x09, 0x01, // Usage (Pointer) | ||
0xB1, 0x02, // Feature (Variable) | ||
0xC0, // End Collection | ||
|
||
0xA1, 0x02, // Collection (Logical) | ||
0x85, 0xEE, // Report ID (238) | ||
0x75, 0x08, // Report Size (8), | ||
0x95, 0x30, // Report Count (48), | ||
0x09, 0x01, // Usage (Pointer) | ||
0xB1, 0x02, // Feature (Variable) | ||
0xC0, // End Collection | ||
|
||
0xA1, 0x02, // Collection (Logical) | ||
0x85, 0xEF, // Report ID (239) | ||
0x75, 0x08, // Report Size (8), | ||
0x95, 30, // Report Count (48), | ||
0x09, 0x01, // Usage (Pointer) | ||
0xB1, 0x02, // Feature (Variable) | ||
0xC0, // End Collection | ||
|
||
0xC0, // End Collection | ||
}; | ||
|
||
/* HID descriptor */ | ||
static unsigned char hiddesc[] = { | ||
0x09, /* bLength */ | ||
HID_DESCRIPTOR_HID, /* bDescriptorType */ | ||
0x11, | ||
0x01, /* bcdHID */ | ||
0x00, /* bCountryCode */ | ||
0x01, /* bNumDescriptors */ | ||
HID_DESCRIPTOR_REPORT, /* bDescriptorType */ | ||
sizeof(hid_report_descriptor), | ||
0x00 /* wDescriptorLength */ | ||
}; | ||
|
||
/* Endpoint blocks */ | ||
static struct SceUdcdEndpoint endpoints[2] = {{0x00, 0, 0, 0}, {0x80, 1, 0, 0}}; | ||
|
||
/* Interfaces */ | ||
static struct SceUdcdInterface interfaces[1] = {{-1, 0, 1}}; | ||
|
||
/* String descriptor */ | ||
static struct SceUdcdStringDescriptor string_descriptors[2] | ||
= {{12, USB_DT_STRING, {'V', 'i', 'V', 'i', 'D'}}, {0, USB_DT_STRING}}; | ||
|
||
/* HI-Speed device descriptor */ | ||
static struct SceUdcdDeviceDescriptor devdesc_hi = { | ||
USB_DT_DEVICE_SIZE, | ||
USB_DT_DEVICE, | ||
0x200, /* bcdUSB */ | ||
USB_CLASS_PER_INTERFACE, /* bDeviceClass */ | ||
0, /* bDeviceSubClass */ | ||
0, /* bDeviceProtocol */ | ||
64, /* bMaxPacketSize0 */ | ||
0x0268, /* idProduct */ | ||
0x054c, /* idVendor */ | ||
0x200, /* bcdDevice */ | ||
0, /* iManufacturer */ | ||
0, /* iProduct */ | ||
0, /* iSerialNumber */ | ||
1 /* bNumConfigurations */ | ||
}; | ||
|
||
/* Hi-Speed endpoint descriptors */ | ||
static struct SceUdcdEndpointDescriptor endpdesc_hi[2] | ||
= {{ | ||
USB_DT_ENDPOINT_SIZE, USB_DT_ENDPOINT, 0x81, /* bEndpointAddress */ | ||
0x03, /* bmAttributes */ | ||
0x40, /* wMaxPacketSize */ | ||
0x01 /* bInterval */ | ||
}, | ||
{ | ||
0, | ||
}}; | ||
|
||
/* Hi-Speed interface descriptor */ | ||
static struct SceUdcdInterfaceDescriptor interdesc_hi[2] | ||
= {{USB_DT_INTERFACE_SIZE, USB_DT_INTERFACE, 0, /* bInterfaceNumber */ | ||
0, /* bAlternateSetting */ | ||
1, /* bNumEndpoints */ | ||
USB_CLASS_HID, /* bInterfaceClass */ | ||
0x00, /* bInterfaceSubClass */ | ||
0x00, /* bInterfaceProtocol */ | ||
1, /* iInterface */ | ||
&endpdesc_hi[0], /* endpoints */ | ||
hiddesc, sizeof(hiddesc)}, | ||
{0}}; | ||
|
||
/* Hi-Speed settings */ | ||
static struct SceUdcdInterfaceSettings settings_hi[1] = {{&interdesc_hi[0], 0, 1}}; | ||
|
||
/* Hi-Speed configuration descriptor */ | ||
static struct SceUdcdConfigDescriptor confdesc_hi | ||
= {USB_DT_CONFIG_SIZE, | ||
USB_DT_CONFIG, | ||
(USB_DT_INTERFACE_SIZE + USB_DT_CONFIG_SIZE + USB_DT_ENDPOINT_SIZE + sizeof(hiddesc)), /* wTotalLength */ | ||
1, /* bNumInterfaces */ | ||
1, /* bConfigurationValue */ | ||
0, /* iConfiguration */ | ||
0xC0, /* bmAttributes */ | ||
0, /* bMaxPower */ | ||
&settings_hi[0]}; | ||
|
||
/* Hi-Speed configuration */ | ||
static struct SceUdcdConfiguration config_hi = {&confdesc_hi, &settings_hi[0], &interdesc_hi[0], &endpdesc_hi[0]}; | ||
|
||
/* Full-Speed device descriptor */ | ||
static struct SceUdcdDeviceDescriptor devdesc_full = { | ||
USB_DT_DEVICE_SIZE, | ||
USB_DT_DEVICE, | ||
0x200, /* bcdUSB (should be 0x110 but the PSVita freezes otherwise) */ | ||
USB_CLASS_PER_INTERFACE, /* bDeviceClass */ | ||
0, /* bDeviceSubClass */ | ||
0, /* bDeviceProtocol */ | ||
64, /* bMaxPacketSize0 */ | ||
0x0268, /* idProduct */ | ||
0x054c, /* idVendor */ | ||
0x200, /* bcdDevice */ | ||
0, /* iManufacturer */ | ||
0, /* iProduct */ | ||
0, /* iSerialNumber */ | ||
1 /* bNumConfigurations */ | ||
}; | ||
|
||
/* Full-Speed endpoint descriptors */ | ||
static struct SceUdcdEndpointDescriptor endpdesc_full[2] | ||
= {{ | ||
USB_DT_ENDPOINT_SIZE, USB_DT_ENDPOINT, 0x81, /* bEndpointAddress */ | ||
0x03, /* bmAttributes */ | ||
0x40, /* wMaxPacketSize */ | ||
0x01 /* bInterval */ | ||
}, | ||
{0}}; | ||
|
||
/* Full-Speed interface descriptor */ | ||
static struct SceUdcdInterfaceDescriptor interdesc_full[2] | ||
= {{USB_DT_INTERFACE_SIZE, USB_DT_INTERFACE, 0, /* bInterfaceNumber */ | ||
0, /* bAlternateSetting */ | ||
1, /* bNumEndpoints */ | ||
USB_CLASS_HID, /* bInterfaceClass */ | ||
0x00, /* bInterfaceSubClass */ | ||
0x00, /* bInterfaceProtocol */ | ||
1, /* iInterface */ | ||
&endpdesc_full[0], /* endpoints */ | ||
hiddesc, sizeof(hiddesc)}, | ||
{0}}; | ||
|
||
/* Full-Speed settings */ | ||
static struct SceUdcdInterfaceSettings settings_full[1] = {{&interdesc_full[0], 0, 1}}; | ||
|
||
/* Full-Speed configuration descriptor */ | ||
static struct SceUdcdConfigDescriptor confdesc_full | ||
= {USB_DT_CONFIG_SIZE, | ||
USB_DT_CONFIG, | ||
(USB_DT_INTERFACE_SIZE + USB_DT_CONFIG_SIZE + USB_DT_ENDPOINT_SIZE + sizeof(hiddesc)), /* wTotalLength */ | ||
1, /* bNumInterfaces */ | ||
1, /* bConfigurationValue */ | ||
0, /* iConfiguration */ | ||
0xC0, /* bmAttributes */ | ||
0, /* bMaxPower */ | ||
&settings_full[0]}; | ||
|
||
/* Full-Speed configuration */ | ||
static struct SceUdcdConfiguration config_full | ||
= {&confdesc_full, &settings_full[0], &interdesc_full[0], &endpdesc_full[0]}; | ||
|
||
#endif // __DESCRIPTORS_H__ |
Oops, something went wrong.