{"action":"created","comment":{"url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments/79320812","id":79320812,"diff_hunk":"@@ -11,167 +11,209 @@ extern \"C\" {\n \t}\n }\n \n-SDLJoystick::SDLJoystick(bool init_SDL ): thread(NULL), running(true) {\n+SDLJoystick::SDLJoystick(bool init_SDL ): thread(NULL), running(true), player1Controller(NULL), player1JoyInstanceID(-1) {\n \tif (init_SDL)\n \t{\n-\t\tSDL_setenv(\"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS\", \"1\", 0);\n-\t\tSDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);\n+\t\tSDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, \"1\");\n+\t\tSDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);\n \t}\n+\t\n+\tif (SDL_GameControllerAddMappingsFromFile(\"assets/gamecontrollerdb.txt\") == -1)\n+\t{\n+\t\t\tprintf(\"Failed to load control pad mappings, please place gamecontrollerdb.txt in your assets directory\\n\");\n+\t}\n+\telse {\n+\t\tprintf(\"Loaded game controller mappings for SDL2\\n\");\n+\t\tsetUpPlayer1();\n+\t}\n+}\n \n+void SDLJoystick::setUpPlayer1()\n+{\n \tint numjoys = SDL_NumJoysticks();\n-\tSDL_JoystickEventState(SDL_ENABLE);\n+\tint joyIndex = -1;\n \tfor (int i = 0; i < numjoys; i++) {\n-\t\tjoys.push_back(SDL_JoystickOpen(i));\n-//\t\tprintf(\"Initialized joystick %d: %s\",i,SDL_JoystickNameForIndex(i));\n-\t\tif(strstr(SDL_JoystickNameForIndex(i),\"PLAYSTATION(R)3 Controller\"))\n-\t\t\tg_Config.bPS3Controller = true;\n+\t\tif (joyIndex == -1 && SDL_IsGameController(i))\n+\t\t{\n+\t\t\tjoyIndex = i;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (joyIndex != -1)\n+\t{\n+\t\tprintf(\"Player 1 will be using joystick %d, %s\\n\", joyIndex, SDL_JoystickNameForIndex(joyIndex));","path":"SDL/SDLJoystick.cpp","position":42,"original_position":42,"commit_id":"db2cc49e0dd1b04d8b20ca4ccc52648e72f6b738","original_commit_id":"db2cc49e0dd1b04d8b20ca4ccc52648e72f6b738","user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"body":"Since the PSP only supports one player, this might be confusing.  Maybe something like `Using joystick %d, %s\\n` or maybe `Pad 1 will be SDL joystick %d, %s\\n` (all multiple pads do is let you configure if you have multiple attached)?  Sorry to be pedantic.\r\n\r\n-[Unknown]","created_at":"2016-09-19T01:33:04Z","updated_at":"2016-09-19T01:46:16Z","html_url":"https://github.com/hrydgard/ppsspp/pull/8993#discussion_r79320812","pull_request_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993","_links":{"self":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments/79320812"},"html":{"href":"https://github.com/hrydgard/ppsspp/pull/8993#discussion_r79320812"},"pull_request":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993"}}},"pull_request":{"url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993","id":85725373,"html_url":"https://github.com/hrydgard/ppsspp/pull/8993","diff_url":"https://github.com/hrydgard/ppsspp/pull/8993.diff","patch_url":"https://github.com/hrydgard/ppsspp/pull/8993.patch","issue_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/8993","number":8993,"state":"open","locked":false,"title":"Updated SDL2 to use the game controller API","user":{"login":"neilmunday","id":8867300,"avatar_url":"https://avatars.githubusercontent.com/u/8867300?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmunday","html_url":"https://github.com/neilmunday","followers_url":"https://api.github.com/users/neilmunday/followers","following_url":"https://api.github.com/users/neilmunday/following{/other_user}","gists_url":"https://api.github.com/users/neilmunday/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmunday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmunday/subscriptions","organizations_url":"https://api.github.com/users/neilmunday/orgs","repos_url":"https://api.github.com/users/neilmunday/repos","events_url":"https://api.github.com/users/neilmunday/events{/privacy}","received_events_url":"https://api.github.com/users/neilmunday/received_events","type":"User","site_admin":false},"body":"Replaced existing SDL2 joystick code and with SDL2's game controller API. This removes the need for any hard coded mappings in the code and instead means SDL2's game controller database can be used instead.\r\n\r\nThe game controller API is much easier to user and also much cleaner than using the joystick API.\r\n\r\nPressing the Home/Guide button on a control pad will also now bring up the PPSSPP in game menu also.\r\n\r\nAt least SDL 2.0.4 is required.\r\n\r\nTested under Fedora 23 (x86_64) with GCC and SDL 2.0.4 using PS3 and XBOX 360 control pads.\r\n\r\nHopefully this pull request should address issue: #8986","created_at":"2016-09-18T22:29:20Z","updated_at":"2016-09-19T01:46:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf67600d8de27f2879d1a71a1f02a60a03f5d5c2","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/hrydgard/ppsspp/milestones/6","html_url":"https://github.com/hrydgard/ppsspp/milestones/v1.3.1","labels_url":"https://api.github.com/repos/hrydgard/ppsspp/milestones/6/labels","id":1997001,"number":6,"title":"v1.3.1","description":"Tracking regressions we plan to resolve for v1.3.1 (if necessary.)","creator":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2016-09-11T22:25:06Z","updated_at":"2016-09-18T22:51:26Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993/commits","review_comments_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993/comments","review_comment_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/8993/comments","statuses_url":"https://api.github.com/repos/hrydgard/ppsspp/statuses/db2cc49e0dd1b04d8b20ca4ccc52648e72f6b738","head":{"label":"neilmunday:master","ref":"master","sha":"db2cc49e0dd1b04d8b20ca4ccc52648e72f6b738","user":{"login":"neilmunday","id":8867300,"avatar_url":"https://avatars.githubusercontent.com/u/8867300?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmunday","html_url":"https://github.com/neilmunday","followers_url":"https://api.github.com/users/neilmunday/followers","following_url":"https://api.github.com/users/neilmunday/following{/other_user}","gists_url":"https://api.github.com/users/neilmunday/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmunday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmunday/subscriptions","organizations_url":"https://api.github.com/users/neilmunday/orgs","repos_url":"https://api.github.com/users/neilmunday/repos","events_url":"https://api.github.com/users/neilmunday/events{/privacy}","received_events_url":"https://api.github.com/users/neilmunday/received_events","type":"User","site_admin":false},"repo":{"id":68482776,"name":"ppsspp","full_name":"neilmunday/ppsspp","owner":{"login":"neilmunday","id":8867300,"avatar_url":"https://avatars.githubusercontent.com/u/8867300?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmunday","html_url":"https://github.com/neilmunday","followers_url":"https://api.github.com/users/neilmunday/followers","following_url":"https://api.github.com/users/neilmunday/following{/other_user}","gists_url":"https://api.github.com/users/neilmunday/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmunday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmunday/subscriptions","organizations_url":"https://api.github.com/users/neilmunday/orgs","repos_url":"https://api.github.com/users/neilmunday/repos","events_url":"https://api.github.com/users/neilmunday/events{/privacy}","received_events_url":"https://api.github.com/users/neilmunday/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neilmunday/ppsspp","description":"A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++. Want to contribute? Join us in #ppsspp on freenode (IRC) or just send pull requests / issues.","fork":true,"url":"https://api.github.com/repos/neilmunday/ppsspp","forks_url":"https://api.github.com/repos/neilmunday/ppsspp/forks","keys_url":"https://api.github.com/repos/neilmunday/ppsspp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neilmunday/ppsspp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neilmunday/ppsspp/teams","hooks_url":"https://api.github.com/repos/neilmunday/ppsspp/hooks","issue_events_url":"https://api.github.com/repos/neilmunday/ppsspp/issues/events{/number}","events_url":"https://api.github.com/repos/neilmunday/ppsspp/events","assignees_url":"https://api.github.com/repos/neilmunday/ppsspp/assignees{/user}","branches_url":"https://api.github.com/repos/neilmunday/ppsspp/branches{/branch}","tags_url":"https://api.github.com/repos/neilmunday/ppsspp/tags","blobs_url":"https://api.github.com/repos/neilmunday/ppsspp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neilmunday/ppsspp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neilmunday/ppsspp/git/refs{/sha}","trees_url":"https://api.github.com/repos/neilmunday/ppsspp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neilmunday/ppsspp/statuses/{sha}","languages_url":"https://api.github.com/repos/neilmunday/ppsspp/languages","stargazers_url":"https://api.github.com/repos/neilmunday/ppsspp/stargazers","contributors_url":"https://api.github.com/repos/neilmunday/ppsspp/contributors","subscribers_url":"https://api.github.com/repos/neilmunday/ppsspp/subscribers","subscription_url":"https://api.github.com/repos/neilmunday/ppsspp/subscription","commits_url":"https://api.github.com/repos/neilmunday/ppsspp/commits{/sha}","git_commits_url":"https://api.github.com/repos/neilmunday/ppsspp/git/commits{/sha}","comments_url":"https://api.github.com/repos/neilmunday/ppsspp/comments{/number}","issue_comment_url":"https://api.github.com/repos/neilmunday/ppsspp/issues/comments{/number}","contents_url":"https://api.github.com/repos/neilmunday/ppsspp/contents/{+path}","compare_url":"https://api.github.com/repos/neilmunday/ppsspp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neilmunday/ppsspp/merges","archive_url":"https://api.github.com/repos/neilmunday/ppsspp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neilmunday/ppsspp/downloads","issues_url":"https://api.github.com/repos/neilmunday/ppsspp/issues{/number}","pulls_url":"https://api.github.com/repos/neilmunday/ppsspp/pulls{/number}","milestones_url":"https://api.github.com/repos/neilmunday/ppsspp/milestones{/number}","notifications_url":"https://api.github.com/repos/neilmunday/ppsspp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neilmunday/ppsspp/labels{/name}","releases_url":"https://api.github.com/repos/neilmunday/ppsspp/releases{/id}","deployments_url":"https://api.github.com/repos/neilmunday/ppsspp/deployments","created_at":"2016-09-17T23:08:03Z","updated_at":"2016-09-17T23:08:09Z","pushed_at":"2016-09-18T22:24:12Z","git_url":"git://github.com/neilmunday/ppsspp.git","ssh_url":"git@github.com:neilmunday/ppsspp.git","clone_url":"https://github.com/neilmunday/ppsspp.git","svn_url":"https://github.com/neilmunday/ppsspp","homepage":"http://www.ppsspp.org","size":95003,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hrydgard:master","ref":"master","sha":"175f3316e0c7131d050c7dda765cbfe7f42544ac","user":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"repo":{"id":6486826,"name":"ppsspp","full_name":"hrydgard/ppsspp","owner":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hrydgard/ppsspp","description":"A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++. Want to contribute? Join us in #ppsspp on freenode (IRC) or just send pull requests / issues.","fork":false,"url":"https://api.github.com/repos/hrydgard/ppsspp","forks_url":"https://api.github.com/repos/hrydgard/ppsspp/forks","keys_url":"https://api.github.com/repos/hrydgard/ppsspp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hrydgard/ppsspp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hrydgard/ppsspp/teams","hooks_url":"https://api.github.com/repos/hrydgard/ppsspp/hooks","issue_events_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/events{/number}","events_url":"https://api.github.com/repos/hrydgard/ppsspp/events","assignees_url":"https://api.github.com/repos/hrydgard/ppsspp/assignees{/user}","branches_url":"https://api.github.com/repos/hrydgard/ppsspp/branches{/branch}","tags_url":"https://api.github.com/repos/hrydgard/ppsspp/tags","blobs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hrydgard/ppsspp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/refs{/sha}","trees_url":"https://api.github.com/repos/hrydgard/ppsspp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hrydgard/ppsspp/statuses/{sha}","languages_url":"https://api.github.com/repos/hrydgard/ppsspp/languages","stargazers_url":"https://api.github.com/repos/hrydgard/ppsspp/stargazers","contributors_url":"https://api.github.com/repos/hrydgard/ppsspp/contributors","subscribers_url":"https://api.github.com/repos/hrydgard/ppsspp/subscribers","subscription_url":"https://api.github.com/repos/hrydgard/ppsspp/subscription","commits_url":"https://api.github.com/repos/hrydgard/ppsspp/commits{/sha}","git_commits_url":"https://api.github.com/repos/hrydgard/ppsspp/git/commits{/sha}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/comments{/number}","issue_comment_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/comments{/number}","contents_url":"https://api.github.com/repos/hrydgard/ppsspp/contents/{+path}","compare_url":"https://api.github.com/repos/hrydgard/ppsspp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hrydgard/ppsspp/merges","archive_url":"https://api.github.com/repos/hrydgard/ppsspp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hrydgard/ppsspp/downloads","issues_url":"https://api.github.com/repos/hrydgard/ppsspp/issues{/number}","pulls_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls{/number}","milestones_url":"https://api.github.com/repos/hrydgard/ppsspp/milestones{/number}","notifications_url":"https://api.github.com/repos/hrydgard/ppsspp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hrydgard/ppsspp/labels{/name}","releases_url":"https://api.github.com/repos/hrydgard/ppsspp/releases{/id}","deployments_url":"https://api.github.com/repos/hrydgard/ppsspp/deployments","created_at":"2012-11-01T08:41:48Z","updated_at":"2016-09-19T01:04:45Z","pushed_at":"2016-09-18T22:29:20Z","git_url":"git://github.com/hrydgard/ppsspp.git","ssh_url":"git@github.com:hrydgard/ppsspp.git","clone_url":"https://github.com/hrydgard/ppsspp.git","svn_url":"https://github.com/hrydgard/ppsspp","homepage":"http://www.ppsspp.org","size":426853,"stargazers_count":2479,"watchers_count":2479,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":948,"mirror_url":null,"open_issues_count":608,"forks":948,"open_issues":608,"watchers":2479,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993"},"html":{"href":"https://github.com/hrydgard/ppsspp/pull/8993"},"issue":{"href":"https://api.github.com/repos/hrydgard/ppsspp/issues/8993"},"comments":{"href":"https://api.github.com/repos/hrydgard/ppsspp/issues/8993/comments"},"review_comments":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993/comments"},"review_comment":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/8993/commits"},"statuses":{"href":"https://api.github.com/repos/hrydgard/ppsspp/statuses/db2cc49e0dd1b04d8b20ca4ccc52648e72f6b738"}}}}
{"actor":{"display_login":"unknownbrackets"}}