diff --git a/src/gameinput.js b/src/gameinput.js index 4746014..15944e5 100755 --- a/src/gameinput.js +++ b/src/gameinput.js @@ -64,6 +64,15 @@ class GameInput { GameInputSchema.Hedgehog, 'xboxone', '045e-0000-Microsoft Device' + ), + // Sony PlayStation devices (vendor ID 054c) get 'Ragdoll' theme + // Product ID 0000 is a placeholder - only the vendor ID is used for matching + // Note: Using Ragdoll (newer) instead of RagdollOld. DualShock 4 and DualSense use Ragdoll + // while DualShock 3 uses RagdollOld, but the newer schema is more appropriate as default + new GameInputModel( + GameInputSchema.Ragdoll, + 'generic', + '054c-0000-Sony Device' ) ], diff --git a/src/vendor-theme-matching.test.js b/src/vendor-theme-matching.test.js index d0e31df..5d54872 100644 --- a/src/vendor-theme-matching.test.js +++ b/src/vendor-theme-matching.test.js @@ -25,6 +25,18 @@ test('VendorThemes should match Microsoft devices to Hedgehog theme', () => { expect(microsoftModel.matchesVendor('Xbox One Controller (Vendor: 045e Product: 0b13)')).toBeTruthy() }) +test('VendorThemes should match Sony devices to Ragdoll theme', () => { + const sonyModel = GameInput.Models.VendorThemes.find(m => m.VendorId === '054c') + expect(sonyModel).toBeDefined() + expect(sonyModel.schema.name).toBe('Ragdoll') + + // Test different Sony device formats + expect(sonyModel.matchesVendor('054c-0ce6-DualSense Wireless Controller')).toBeTruthy() + expect(sonyModel.matchesVendor('054c-05c4-Wireless Controller')).toBeTruthy() + expect(sonyModel.matchesVendor('DualSense Wireless Controller (Vendor: 054c Product: 0ce6)')).toBeTruthy() + expect(sonyModel.matchesVendor('DualSense Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 0ce6)')).toBeTruthy() +}) + test('VendorThemes should not match devices from different vendors', () => { const nintendoModel = GameInput.Models.VendorThemes.find(m => m.VendorId === '057e')