mirror of
https://github.com/CoronaSend/ps4-usb-guitar-plugin.git
synced 2026-10-17 17:00:38 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2387b8615a |
No files matched your search
@@ -68,8 +68,9 @@ Delete the `OrbisInstrumentalizer.prx` line from `plugins.ini`, and delete the `
|
||||
| Green, Red, Yellow, Blue, Orange | Same color fret |
|
||||
| Strum up / down | Strum up / down |
|
||||
| Whammy bar | Whammy |
|
||||
| Start or Select | Options / Start (both do the same thing) |
|
||||
| Tilt | Not mapped |
|
||||
| Start | Options / Start |
|
||||
| Select | Back, which activates **star power** in a song (tested) |
|
||||
| Tilt | Not working: the adapter reports a tilt bit, but the game ignored it in tests. Use Select for star power. |
|
||||
|
||||
## Remapping
|
||||
|
||||
@@ -114,15 +115,6 @@ if ((raw[0] & 0x02) != 0) parsed_report.buttons |= BIT(0); // red
|
||||
if ((raw[0] & 0x04) != 0) parsed_report.buttons |= BIT(2); // blue
|
||||
```
|
||||
|
||||
### Example: make Select act as Back instead of Options
|
||||
|
||||
Replace the Start/Select line with:
|
||||
|
||||
```c
|
||||
if ((raw[1] & 0x01) != 0) parsed_report.buttons |= BIT(8); // select -> back
|
||||
if ((raw[1] & 0x02) != 0) parsed_report.buttons |= BIT(9); // start -> options
|
||||
```
|
||||
|
||||
After any change, rebuild, copy the new `.prx` to the PS4, and **fully restart the game** (plugins only load at game launch).
|
||||
|
||||
## Different guitar or adapter: the mapping tool (no coding)
|
||||
@@ -136,7 +128,7 @@ If the game detects your guitar but buttons do nothing, or you use another adapt
|
||||
|
||||
The klog shows `Mapping file loaded (id VVVV:PPPP)` when it is used. With no map file, the built-in layout for the verified 2563:0575 adapter and guitar is used. Map file format is one `key=byte,mask,value` per line (hex); a button is pressed when `(report[byte] & mask) == value`. Keys: `green red yellow blue orange start select strum_up strum_down`, plus `whammy=byte,rest,full` and `id=VID,PID`.
|
||||
|
||||
Tested: the generated layout for the 2563:0575 adapter and our guitar loads and works on a real PS4. Other adapters and guitars are untested. Tilt is not mapped, and the plugin still only supports Rock Band 4 version 02.21.
|
||||
Tested: the generated layout for the 2563:0575 adapter and our guitar loads and works on a real PS4, including Select as star power. Other adapters and guitars are untested. Tilt does not work (see above), and the plugin still only supports Rock Band 4 version 02.21.
|
||||
|
||||
## Using a different adapter (manual)
|
||||
|
||||
@@ -175,7 +167,7 @@ The result is `bin\OrbisInstrumentalizer.prx`.
|
||||
- **RB4DX stopped loading:** a new `plugins.ini` replaces GoldHEN's defaults. List every plugin you use under the heading, including `RB4DX-Plugin.prx`.
|
||||
- **Guitar not detected:** unplug the adapter, plug it into the PS4 **before** starting the game, and restart the game.
|
||||
- **A fret is the wrong color or a button does nothing:** see "Remapping".
|
||||
- **Menus can't be navigated with the guitar:** use a normal controller for menus. Start/Select work for Options only.
|
||||
- **Menus can't be navigated with the guitar:** use a normal controller for menus. Start works for Options only, and Select is Back.
|
||||
|
||||
## Credits and license
|
||||
|
||||
|
||||
+1
-1
@@ -48,5 +48,5 @@ PROBLEMS
|
||||
HONEST NOTES
|
||||
- Verified on one adapter and guitar (USB ID 2563:0575). Other adapters and
|
||||
guitars are untested; step 2 is how you teach it yours.
|
||||
- Tilt (star power by tilting) is not supported. Use the Select button.
|
||||
- Tilt (star power by tilting) does not work. Press the Select button on the guitar to activate star power instead.
|
||||
- Windows may show a SmartScreen warning for an unsigned program: More info > Run anyway.
|
||||
+10
-6
@@ -55,7 +55,7 @@ static struct {
|
||||
bool loaded;
|
||||
bool has_id;
|
||||
uint16_t vid, pid;
|
||||
MapEntry green, red, yellow, blue, orange, start, select, up, down;
|
||||
MapEntry green, red, yellow, blue, orange, start, select, up, down, tilt;
|
||||
bool whammy_set;
|
||||
uint8_t wbyte, wrest, wfull;
|
||||
int max_byte;
|
||||
@@ -131,6 +131,7 @@ static void LoadMapFile(void) {
|
||||
else if (strcmp(key, "select") == 0) SetEntry(&g_map.select, val);
|
||||
else if (strcmp(key, "strum_up") == 0) SetEntry(&g_map.up, val);
|
||||
else if (strcmp(key, "strum_down") == 0) SetEntry(&g_map.down, val);
|
||||
else if (strcmp(key, "tilt") == 0) SetEntry(&g_map.tilt, val);
|
||||
else if (strcmp(key, "whammy") == 0) {
|
||||
// "whammy=byte,rest,full"
|
||||
if (ParseHexList(val, v, 3) == 3 && v[0] < 32 && v[1] != v[2]) {
|
||||
@@ -270,6 +271,8 @@ static OIRB4DeviceType IdentifyDevice(libusb_device *device) {
|
||||
}
|
||||
|
||||
#define BIT(i) (1 << i)
|
||||
// accel_x value sent while the guitar is tilted up (0x00 is level; matches the original plugin tilt mapping)
|
||||
#define TILT_UP 0x7F
|
||||
// TODO: this seems bad i dont even know if it do drum
|
||||
typedef struct _ps3_rb_guitar_report {
|
||||
uint16_t buttons;
|
||||
@@ -341,7 +344,8 @@ static void ParseMappedPS2(struct libusb_transfer *transfer) {
|
||||
if (MapPressed(&g_map.yellow, raw)) parsed_report.buttons |= BIT(4);
|
||||
if (MapPressed(&g_map.blue, raw)) parsed_report.buttons |= BIT(2);
|
||||
if (MapPressed(&g_map.orange, raw)) parsed_report.buttons |= BIT(3);
|
||||
if (MapPressed(&g_map.start, raw) || MapPressed(&g_map.select, raw)) parsed_report.buttons |= BIT(9);
|
||||
if (MapPressed(&g_map.start, raw)) parsed_report.buttons |= BIT(9);
|
||||
if (MapPressed(&g_map.select, raw)) parsed_report.buttons |= BIT(8); // back / star power
|
||||
|
||||
parsed_report.hat = 0x08;
|
||||
if (MapPressed(&g_map.up, raw)) parsed_report.hat = 0x00;
|
||||
@@ -352,7 +356,7 @@ static void ParseMappedPS2(struct libusb_transfer *transfer) {
|
||||
int v = ((int)raw[g_map.wbyte] - (int)g_map.wrest) * 255 / span;
|
||||
parsed_report.whammy = (uint8_t)(v < 0 ? 0 : (v > 255 ? 255 : v));
|
||||
}
|
||||
parsed_report.accel_x = 0x80;
|
||||
parsed_report.accel_x = MapPressed(&g_map.tilt, raw) ? TILT_UP : 0x00;
|
||||
|
||||
size_t len = transfer->length < sizeof(parsed_report) ? transfer->length : sizeof(parsed_report);
|
||||
memcpy(transfer->buffer, &parsed_report, len);
|
||||
@@ -372,15 +376,15 @@ void ParsePS2Callback(struct libusb_transfer *transfer) {
|
||||
if ((raw[0] & 0x01) != 0) parsed_report.buttons |= BIT(4); // yellow
|
||||
if ((raw[0] & 0x04) != 0) parsed_report.buttons |= BIT(2); // blue
|
||||
if ((raw[0] & 0x08) != 0) parsed_report.buttons |= BIT(3); // orange
|
||||
if ((raw[1] & 0x03) != 0) parsed_report.buttons |= BIT(9); // start and select both act as start/options
|
||||
if ((raw[1] & 0x02) != 0) parsed_report.buttons |= BIT(9); // start
|
||||
if ((raw[1] & 0x01) != 0) parsed_report.buttons |= BIT(8); // select = back / star power
|
||||
parsed_report.accel_x = (raw[0] & 0x40) ? TILT_UP : 0x00; // tilt switch
|
||||
|
||||
parsed_report.hat = 0x08;
|
||||
if (raw[2] == 7) parsed_report.hat = 0x00; // strum up
|
||||
if (raw[2] == 5) parsed_report.hat = 0x04; // strum down
|
||||
|
||||
parsed_report.whammy = (raw[4] >= 0x7F) ? 0x00 : (uint8_t)((0x7F - raw[4]) * 2);
|
||||
parsed_report.accel_x = 0x80;
|
||||
|
||||
size_t len = transfer->length < sizeof(parsed_report) ? transfer->length : sizeof(parsed_report);
|
||||
memcpy(transfer->buffer, &parsed_report, len);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user