Compare commits

...
266 Commits
Author SHA1 Message Date
twinaphex b2ceb50897 Update to 1.7.3 2018-05-04 05:45:22 +02:00
Twinaphex 6c95cbb6b4 Merge pull request #6716 from cubtekki/cubtekki-patch-0
Updated readme file
2018-05-04 05:07:02 +02:00
cubtekki cbd8f83288 Update README.md
Corrected some spelling errors.
2018-05-03 20:02:22 -07:00
cubtekki bcb7a7a6c8 Update README.md
Corrected some spelling errors.
2018-05-03 19:55:30 -07:00
Brad Parker 19f6798947 Qt: make sure we are inited before calling into the driver 2018-05-03 21:47:21 -04:00
Twinaphex 756320755b Update CHANGES.md 2018-05-04 03:31:45 +02:00
Twinaphex ed9ce033d8 Update CHANGES.md 2018-05-04 03:30:43 +02:00
Twinaphex 5c59e7f523 Update CHANGES.md 2018-05-04 03:23:01 +02:00
Twinaphex ad7ccf6d7b Update CHANGES.md 2018-05-04 03:21:51 +02:00
Twinaphex 66dfae2234 Merge pull request #6713 from orbea/make
Makefile: Try to fix logic.
2018-05-04 01:16:35 +02:00
orbea 14bb035026 Makefile: Try to fix logic. 2018-05-03 15:50:11 -07:00
twinaphex 6c09195f5e (D3D8/D3D9) Updates 2018-05-03 22:08:14 +02:00
twinaphex 6d019284f8 Get rid of some of the casts 2018-05-03 22:06:04 +02:00
twinaphex 82ebb9576f Create d3d9_video_t and d3d8_video_t 2018-05-03 22:03:12 +02:00
twinaphex c4a03b6b45 (xdk360_fonts.cpp) Cleanups 2018-05-03 21:39:25 +02:00
twinaphex 9f80092bbb Updates 2018-05-03 21:29:58 +02:00
Twinaphex 4a1fc9b598 Merge pull request #6701 from orbea/cxx
qb: Fix checking the CXX compiler
2018-05-03 21:28:47 +02:00
orbea 8f861d438b qb: Fix checking the CXX compiler
This does the following.

1. Fixes checking if the CXX compiler works on platforms other than windows.
2. Turns the error when the CXX compiler is missing or doesn't work into a warning.
3. Adds HAVE_CC and HAVE_CXX.
4. Only adds CC and CXX to config.mk when HAVE_CC or HAVE_CXX are true.
5. Disables Qt companion, Vulkan, CXX_BUILD and NEED_CXX_LINKER if HAVE_CXX is false.
6. Explicitly errors when the CXX compiler is broken or missing and Qt or vulkan support is enabled.
7. No longer explicitly links with the CXX compiler on windows since this should no longer be needed.

This also adds the function `check_enabled` to `qb/qb.lib.sh` which
can be used to dynamically disable any libraries that require C++
support.
2018-05-03 12:24:32 -07:00
Twinaphex de1bf58997 Buildfix 2018-05-03 20:39:03 +02:00
twinaphex 3796e52018 (OSX) Go back to old code - connect handler was broken 2018-05-03 20:31:28 +02:00
Twinaphex 356cd47ce8 Silence some unused variable warnings 2018-05-03 19:35:27 +02:00
twinaphex dd8a2df253 Cleanup 2018-05-03 19:17:13 +02:00
Brad Parker 05404f9104 fix buffer overflow in url encoding (affecting msvc2010/2013) 2018-05-03 12:57:23 -04:00
Twinaphex 803373bb09 Merge pull request #6712 from Dwedit/msvc_qt_project
Add QT builds to MSVC2017 project
2018-05-03 17:47:10 +02:00
Dwedit 00c116051f Add QT builds to MSVC2017 project
Fix missing line in griffin_cpp.cpp, and normalize end of line to LF
2018-05-03 10:32:32 -05:00
Twinaphex 909ffd4de4 Update input_driver.c 2018-05-03 15:28:26 +02:00
twinaphex 7bc66ae710 Buildfixes for MSVC 2015 2018-05-03 15:20:06 +02:00
twinaphex 268baca939 (MSVC 2013) Add /bigobj for griffin_glslang.cpp 2018-05-03 14:52:37 +02:00
Twinaphex 171bf76100 Merge pull request #6711 from Tatsuya79/patch-4
QT restore preferences if they exist
2018-05-03 14:07:11 +02:00
Tatsuya79 49177bdd93 QT restore preferences if they exist 2018-05-03 13:42:25 +02:00
twinaphex 4fac2b339c Remove unused variable 2018-05-03 13:20:05 +02:00
twinaphex 28025802da Try to fix build failure 2018-05-03 13:11:38 +02:00
Twinaphex c9744c5ba4 Merge pull request #6704 from Dwedit/fix-win32-bug
Fix __stdcall calling convention for Win32 32-bit builds
2018-05-03 12:20:08 +02:00
Twinaphex 78d571239c Merge pull request #6710 from alphanu1/patch-2
Fix screen position for CRT user
2018-05-03 12:19:40 +02:00
Twinaphex 9feb9ec37c Merge pull request #6709 from alphanu1/patch-1
Fix incorrect menu sizing for CRT
2018-05-03 12:19:27 +02:00
Twinaphex d877bccde5 Merge pull request #6706 from fr500/fixes
fix #6700
2018-05-03 12:19:12 +02:00
alphanu1 7dab5b9ae3 Fix screen position for CRT user 2018-05-03 09:42:53 +01:00
alphanu1 c3beeb3ca9 Fix incorrect menu sizing for CRT 2018-05-03 09:36:37 +01:00
radius 7bdbd005a8 fix #6700 2018-05-02 23:32:40 -05:00
Dwedit 81457d74d3 Use WINAPI instead of __stdcall, not sure what keywords I can use or not, so I'll just use the macro instead of the keyword 2018-05-02 22:09:20 -05:00
Dwedit 0d2f9b9b11 Fix __stdcall calling convention for Win32 32-bit builds 2018-05-02 21:59:07 -05:00
twinaphex 896ac3c89f Add sublabel 2018-05-03 03:42:22 +02:00
twinaphex 27b399521f (MaterialUI) Fix icon label for Mixer Settings 2018-05-03 02:14:12 +02:00
twinaphex d45002779d Fix one label 2018-05-03 02:12:16 +02:00
twinaphex 4c212d460f Make Mixer Stream values translatable 2018-05-03 02:08:21 +02:00
twinaphex 1ab1d12398 Add sublabels to 'Add To Mixer' 2018-05-03 02:02:28 +02:00
twinaphex 965149d425 Add sublabels for mixer actions 2018-05-03 01:47:52 +02:00
twinaphex 7b1d61da3d (QuickMenu) Added Configuration Override submenu 2018-05-03 00:04:19 +02:00
twinaphex ea77fbbd38 Increase max streams from 8 to 16 2018-05-02 23:42:39 +02:00
twinaphex cdc60481cf Fix label 2018-05-02 21:56:45 +02:00
twinaphex ab360ae3ac (Audio mixer) Add Sequential playback mode 2018-05-02 21:43:16 +02:00
twinaphex b480cdbe26 Add 'Add To Mixer And Play' 2018-05-02 21:09:53 +02:00
twinaphex 0d36993ceb Remove name when sound is done 2018-05-02 21:02:45 +02:00
twinaphex 68a2f18bfb Cleanups 2018-05-02 20:52:06 +02:00
Twinaphex 44e935c64d Merge pull request #6702 from orbea/cxx_linker
Makefile.common: Fix vulkan builds on 32-bit linux.
2018-05-02 20:49:54 +02:00
twinaphex 5e32f7ab40 Add To Mixer and Add To Mixer And Play actions 2018-05-02 20:39:55 +02:00
twinaphex 90c1ce8fcc Add Add To Mixer And Play labels 2018-05-02 20:27:01 +02:00
twinaphex 51374fd2d1 Add better title for stream 2018-05-02 20:21:20 +02:00
twinaphex 9fbfd503af Add value descriptions for audio mixer streams 2018-05-02 20:13:13 +02:00
orbea 2fce9127d0 Makefile.common: Fix vulkan builds on 32-bit linux. 2018-05-02 10:44:45 -07:00
twinaphex eff75a3bcd Move nbio_buf_t to task_audio_mixer.c 2018-05-02 19:30:06 +02:00
Twinaphex 468b41f7bc Merge pull request #6695 from orbea/cxx
qb: Always print CC and CXX variables if set.
2018-05-02 16:57:26 +02:00
Twinaphex 3bdbe22e27 Merge pull request #6697 from altiereslima/master
Update Portuguese Brazilian translation
2018-05-02 14:53:43 +02:00
altiereslima 212e857656 Update Portuguese Brazilian translation 2018-05-02 09:38:24 -03:00
twinaphex eac899f573 Try to fix build for targets that don't have HAvE_OVERLAY defined 2018-05-02 13:52:27 +02:00
Brad Parker 4785893847 Qt: select the first visible item, which may not be row 0 2018-05-02 01:16:17 -04:00
Brad Parker 0ed2a5307d Qt: always free string list 2018-05-02 01:16:17 -04:00
orbea 237a705a82 qb: Always print CC and CXX variables if set. 2018-05-01 17:47:14 -07:00
Twinaphex 6588969bb4 Merge pull request #6690 from fr500/fixes
fix #6631
2018-05-02 02:36:37 +02:00
Twinaphex d68266d92e Merge pull request #6688 from altiereslima/master
Update Portuguese Brazilian translation
2018-05-02 01:46:43 +02:00
Brad Parker 99e4271f29 fix null dereference when there is no runahead save state list 2018-05-01 19:19:35 -04:00
radius 3304dad729 fix #6631 2018-05-01 18:09:04 -05:00
twinaphex 95278d39f7 Buildfix for MSVC 2003 2018-05-02 01:03:40 +02:00
Brad Parker 17524d5681 add loglevel tag back 2018-05-01 18:45:43 -04:00
altiereslima d5e62b731b update 2018-05-01 19:25:17 -03:00
altiereslima eba3a1b72d Update Portuguese Brazilian translation 2018-05-01 19:21:14 -03:00
Brad Parker eb549fdc17 Qt: can't get core info if there isn't any 2018-05-01 18:17:28 -04:00
Twinaphex b247962115 Merge pull request #6686 from bparker06/qt_defer_init
Qt: only init new UI the first time it is about to be shown
2018-05-01 23:49:09 +02:00
Brad Parker e3712182bd Qt: only init new UI the first time it is about to be shown 2018-05-01 17:47:12 -04:00
Twinaphex f0d25d2fd9 Merge pull request #6685 from alphanu1/master
Fix for exit error on Linux when CRT mode inactive
2018-05-01 23:01:20 +02:00
alphanu1 92e3e6c337 Merge pull request #61 from alphanu1/alphanu1-patch-59
Fix for Linux users exit error when CRT disabled
2018-05-01 21:43:23 +01:00
alphanu1 d1b834a301 Fix for Linux users exit error when CRT disabled 2018-05-01 21:42:29 +01:00
Twinaphex 511039330e Merge pull request #6684 from alphanu1/master
Fix for native low res in Linux
2018-05-01 22:13:13 +02:00
alphanu1 87a45160f0 Merge pull request #60 from alphanu1/alphanu1-patch-58
Removed static from function to share aspect changing
2018-05-01 21:08:26 +01:00
alphanu1 82a2fb955e Removed static from function to share aspect changing 2018-05-01 21:07:52 +01:00
alphanu1 53ee0a2cb3 Merge pull request #59 from alphanu1/alphanu1-patch-57
Fix for native low res in Linux
2018-05-01 20:56:48 +01:00
alphanu1 97630d7fb1 Fix for native low res in Linux 2018-05-01 20:56:30 +01:00
alphanu1 cf1d9274d2 Merge pull request #58 from alphanu1/alphanu1-patch-56
Fix for native low res in Linux
2018-05-01 20:56:03 +01:00
alphanu1 c9d89e234a Fix for native low res in Linux 2018-05-01 20:55:24 +01:00
Twinaphex cd8ae4d7d3 Merge pull request #6678 from altiereslima/master
Update Portuguese Brazilian translation
2018-05-01 21:46:07 +02:00
twinaphex 33c1d55801 GetDisplayConfigBufferSizes and QueryDisplayConfig now go
through function pointers for backwards compatibility
2018-05-01 21:44:10 +02:00
alphanu1 65a0427471 Merge pull request #55 from alphanu1/alphanu1-patch-53
res fix
2018-05-01 20:32:49 +01:00
alphanu1 8584e27a81 res fix 2018-05-01 20:32:34 +01:00
alphanu1 11374ddf12 Merge pull request #54 from alphanu1/alphanu1-patch-52
Linux resolution improvements for CRT
2018-05-01 20:28:22 +01:00
alphanu1 11b0fe2a97 Linux resolution improvements for CRT 2018-05-01 20:28:01 +01:00
alphanu1 ab6acd1115 Merge pull request #53 from libretro/master
update
2018-05-01 20:26:09 +01:00
Twinaphex 402b1432ee Merge pull request #6681 from orbea/indent
Silence -Wmisleading-indentation warning
2018-05-01 20:13:26 +02:00
orbea b2f508d72e qb: Improve moc detection (#6680) 2018-05-01 13:40:42 -04:00
alphanu1 533f762e52 Merge pull request #52 from libretro/master
update
2018-05-01 18:39:20 +01:00
orbea e33a12c18f Silence -Wmisleading-indentation warning
gfx/video_crt_switch.c: In function ‘crt_screen_setup_aspect’:
gfx/video_crt_switch.c:95:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if (width < 1920)
       ^~
gfx/video_crt_switch.c:97:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
          height = 480;
          ^~~~~~
2018-05-01 10:17:19 -07:00
Brad Parker 20cb92c185 qb: allow building without Qt 2018-05-01 16:24:19 +00:00
Brad Parker 6639d0ed89 qb: don't fail if moc is missing 2018-05-01 08:51:57 -07:00
altiereslima 974a04e692 Update Portuguese Brazilian translation 2018-05-01 12:30:49 -03:00
Twinaphex eb498f56a6 Merge pull request #6674 from Brunnis/fix-incorrect-dialog-label
Fix incorrect labels on dialogs due to incorrect macro
2018-05-01 13:31:23 +02:00
Twinaphex 12d72e26cc Merge pull request #6673 from alphanu1/master
Tweaks to modeline genorator
2018-05-01 13:24:40 +02:00
alphanu1 dcb7dd12c8 Merge pull request #51 from alphanu1/alphanu1-patch-51
Better startup resolution for CRT
2018-05-01 12:14:53 +01:00
alphanu1 4b8fbf8682 Better startup resolution for CRT 2018-05-01 12:14:25 +01:00
alphanu1 2279870235 Merge pull request #50 from alphanu1/master-4
modeline tweaks, better porches
2018-05-01 12:10:58 +01:00
alphanu1 cc1024ddd0 modeline tweaks, better porches 2018-05-01 12:10:32 +01:00
alphanu1 50751e3f43 Merge pull request #49 from libretro/master
update
2018-05-01 12:08:27 +01:00
Mikael Brunnhede b2187d4b10 Fix incorrect labels on dialogs due to incorrect macro. 2018-05-01 12:17:36 +02:00
Brad Parker 791aaa00e1 qb: detect Qt automatically 2018-04-30 22:11:55 -07:00
Twinaphex 9ba9f9e8bd Merge pull request #6671 from altiereslima/master
Update Brazilian Portuguese translation
2018-05-01 04:55:49 +02:00
altiereslima 0058d734a2 Update Brazilian Portuguese translation
based in english file: msg_hash_us.h
2018-04-30 23:48:21 -03:00
twinaphex b650d484f4 (Qt) Change label to Clear 2018-05-01 04:35:02 +02:00
Brad Parker cc94cafa8f update Japanese translation 2018-04-30 22:06:32 -04:00
Brad Parker 4df26353dd Qt: add option (off by default) to suggest the currently loaded core first 2018-04-30 20:33:28 -04:00
Brad Parker f2f37a3309 Qt: refocus UI when unloading core/content 2018-04-30 19:52:21 -04:00
twinaphex bf084da088 (ui_companion_driver) cleanups 2018-05-01 01:29:17 +02:00
Brad Parker 71257adb8e Qt: add setting in User Interface to enable use of the desktop menu in general (disabling it may improve startup time if desktop menu is not being used) 2018-04-30 19:11:38 -04:00
Twinaphex fc28edd821 Merge pull request #6670 from Tatsuya79/patch-3
small text style change
2018-04-30 23:09:56 +02:00
Tatsuya79 dbdef08a90 small text style change 2018-04-30 23:02:18 +02:00
twinaphex b7ceedd891 Qt GUI won't work for C89 2018-04-30 21:03:47 +02:00
Twinaphex 62256b77c3 Merge pull request #6668 from bparker06/qt_wimp_squash
Qt WIMP GUI
2018-04-30 20:51:30 +02:00
Brad Parker a1aefc901c Qt WIMP GUI 2018-04-30 14:33:05 -04:00
Twinaphex 4e057edb1e Merge pull request #6666 from alphanu1/master
Fixed incorrect variable assignment.
2018-04-30 19:47:07 +02:00
alphanu1 93bdb5c4f4 Merge pull request #48 from alphanu1/alphanu1-patch-48
Fix incorrect variable
2018-04-30 18:41:40 +01:00
alphanu1 2226dec436 Fix incorrect variable 2018-04-30 18:41:20 +01:00
Twinaphex 97ccfdf020 Merge pull request #6665 from alphanu1/master
Windows hz bug fix
2018-04-30 19:27:49 +02:00
alphanu1 34ecc81484 Merge pull request #47 from alphanu1/alphanu1-patch-47
Moved variable back to the top
2018-04-30 17:54:20 +01:00
alphanu1 675da4692e Moved variable back to the top 2018-04-30 17:54:00 +01:00
alphanu1 3e17cbd2e1 Merge pull request #46 from alphanu1/alphanu1-patch-46
Variable rename
2018-04-30 17:51:51 +01:00
alphanu1 9400754a2b Variable rename 2018-04-30 17:51:28 +01:00
alphanu1 fdddbb713d Merge pull request #45 from alphanu1/alphanu1-patch-45
Variable rename
2018-04-30 17:50:36 +01:00
alphanu1 db751b4241 Variable rename 2018-04-30 17:50:13 +01:00
alphanu1 73b5aff2e1 Merge pull request #44 from alphanu1/alphanu1-patch-44
bug fix with hz switching
2018-04-30 17:15:38 +01:00
alphanu1 11b7f76526 bug fix with hz switching 2018-04-30 17:14:19 +01:00
Twinaphex 54f54fce28 Merge pull request #6664 from meleu/patch-21
don't allow slow motion if cheevos enabled
2018-04-30 18:13:28 +02:00
twinaphex 6ba2e72a3b Add title for mixer stream settings 2018-04-30 18:12:22 +02:00
twinaphex 1f2a543232 Change logging back to 0 2018-04-30 17:53:07 +02:00
twinaphex 5aeab54ab7 (Audio mixer) Ability to individually set volume per stream 2018-04-30 17:51:01 +02:00
alphanu1 9474b4be74 Merge pull request #43 from alphanu1/master-3
Linux / Windows hz bug fix and Linux low res modeline generator fix
2018-04-30 16:50:58 +01:00
alphanu1 f672c7dc5c Linux / Windows hz bug fix and Linux low res modeline generator fix
when merging Linux CRT refresh rate hz was dealt with in floats for Linux but ints for windows.
2018-04-30 16:49:22 +01:00
alphanu1 3edd7a6ac8 Merge pull request #42 from alphanu1/alphanu1-patch-41
Linux / windows hz bug fix
2018-04-30 16:41:04 +01:00
alphanu1 af3eb9e851 Linux / windows hz bug fix
when merging Linux CRT refresh rate hz was dealt with in floats for Linux but ints for windows.
2018-04-30 16:40:27 +01:00
alphanu1 e6dd809c8a Merge pull request #41 from libretro/master
RA update
2018-04-30 16:30:57 +01:00
meleu e57d0049f3 disable slow motion if cheevos enabled 2018-04-30 12:27:35 -03:00
twinaphex 01e85b321b Improve audio_driver_menu_sample 2018-04-30 15:44:12 +02:00
twinaphex 0cea2cf158 Remove two Coverity warnings 2018-04-30 15:32:28 +02:00
twinaphex 1c90866070 Refactor this a bit and document it 2018-04-30 15:24:40 +02:00
twinaphex 25a7cb0f66 (Menu) Rename hack_shader_pass to scratchpad.unsigned_var 2018-04-30 15:19:54 +02:00
twinaphex 49341bac26 Add Play/Play (Looped) actions 2018-04-30 15:04:29 +02:00
twinaphex eb4ee2d57c Merge branch 'master' of https://github.com/libretro/RetroArch 2018-04-30 14:34:48 +02:00
twinaphex 965859ddcb Start adding mixer controls - ability to stop and remove loaded tracks 2018-04-30 14:34:25 +02:00
Twinaphex 22e55e61de Merge pull request #6656 from gblues/master
WIIU: Disable screen-dimming while core is running
2018-04-30 02:25:05 +02:00
gblues 162d1fbfb5 WIIU: Disable screen-dimming while core is running
== DETAILS
In my extended testing, I found that the HID device inputs don't get factored
into resetting things like the burn-in protection and automatic power down.

The automatic power-down can't be changed in software, but the screen dimming
can!

This patch disables the screen dimming while the core is running, but turns
it back on while the menu is displayed. This way, users who want the screen
dimming functionality to kick in need to simply enter the RA menu.
2018-04-29 16:26:14 -07:00
Twinaphex 05ea2cff96 Update CHANGES.md 2018-04-29 18:49:51 +02:00
Twinaphex e19b6faa7e Update CHANGES.md 2018-04-29 18:49:23 +02:00
Twinaphex bf64c1cf23 Merge pull request #6655 from alphanu1/master
Linux switching for CRT
2018-04-29 18:41:54 +02:00
Twinaphex 2285d19b90 Merge pull request #6653 from RobLoach/wbfs
Add Wii Backup File WBFS scanning
2018-04-29 17:21:37 +02:00
Twinaphex 29b8c47577 Merge pull request #6654 from theheroGAC/patch-30
Update msg_hash_it.h with the translations of the new strings
2018-04-29 16:54:18 +02:00
alphanu1 896041f468 Add files via upload 2018-04-29 15:47:32 +01:00
alphanu1 db2eaf97e4 Merge pull request #40 from alphanu1/alphanu1-patch-40
Linux switching CRT
2018-04-29 15:44:29 +01:00
alphanu1 16ccbbc75a Linux switching CRT 2018-04-29 15:44:08 +01:00
alphanu1 ec3ab4031b Merge pull request #39 from alphanu1/alphanu1-patch-39
Code clean up and Linux switching
2018-04-29 15:39:52 +01:00
alphanu1 a0b46d9a38 Code clean up and Linux switching 2018-04-29 15:38:16 +01:00
theheroGAC 51d1baa646 Update msg_hash_it.h 2018-04-29 15:54:19 +02:00
Rob Loach 00092eb5ea feat: Add Wii Backup File WBFS scanning 2018-04-29 09:51:38 -04:00
alphanu1 ff928ddb7c Merge pull request #38 from alphanu1/alphanu1-patch-38
Linux switching incorporation
2018-04-29 13:51:44 +01:00
alphanu1 7d53e6a16f Linux switching incorporation 2018-04-29 13:51:18 +01:00
alphanu1 d17ce844d5 Merge pull request #37 from alphanu1/alphanu1-patch-37
Linux switching incorporation
2018-04-29 13:50:08 +01:00
alphanu1 0498ab6b86 Linux switching incorporation 2018-04-29 13:49:32 +01:00
alphanu1 8aa4d52367 Merge pull request #36 from alphanu1/alphanu1-patch-36
Linux switching incorporation
2018-04-29 13:48:56 +01:00
alphanu1 a930afce31 Linux switching incorporation 2018-04-29 13:48:08 +01:00
twinaphex 4380bc52bd (MSVC) Buildfixes 2018-04-29 14:47:57 +02:00
alphanu1 2d36a32bcd Merge pull request #35 from alphanu1/alphanu1-patch-35
Linux switching incorporation
2018-04-29 13:47:26 +01:00
alphanu1 1eedb0406b Linux switching incorporation 2018-04-29 13:46:43 +01:00
Twinaphex 6cd046a42a Merge pull request #6650 from alphanu1/master
Restore resolution fix
2018-04-29 13:49:14 +02:00
alphanu1 c73b4b26ba Merge pull request #34 from alphanu1/alphanu1-patch-34
Changes to stop unwanted resolution change for non CRT users
2018-04-29 01:42:50 +01:00
alphanu1 1f8540ca9d Changes to stop unwanted resolution change for non CRT users 2018-04-29 01:41:38 +01:00
twinaphex d36026575e Remove obsolete diff 2018-04-29 01:12:54 +02:00
twinaphex 91fcb49270 (Menu audio) Fix situation where a libretro core is running
in the background and menu audio is playing - we don't want
audio_driver_menu_sample called then
2018-04-29 01:05:04 +02:00
twinaphex b0ef193117 Add 'Enable menu audio' setting 2018-04-29 00:41:53 +02:00
twinaphex 773fc1ebad Create audio_driver_menu_sample 2018-04-29 00:06:54 +02:00
alphanu1 90d62fd0cc Restore resolution fix 2018-04-28 20:53:39 +01:00
alphanu1 b51c8d62e7 Restore resolution fix 2018-04-28 20:52:58 +01:00
alphanu1 6aa072b6cf Restore resolution fix 2018-04-28 20:52:24 +01:00
alphanu1 46afabee6a Merge pull request #33 from libretro/master
MME Update 172
2018-04-28 20:51:51 +01:00
twinaphex 686faa2407 Add experimental-audio.diff 2018-04-28 21:40:36 +02:00
twinaphex b6df41d808 (audio_driver.c) Cleanups 2018-04-28 20:06:07 +02:00
twinaphex 5a80a6046f (Android) Remove no longer needed machine/cpu-features.h 2018-04-28 19:29:30 +02:00
Twinaphex 80b480e855 Merge pull request #6648 from fr500/master
fix #6644
2018-04-28 19:07:54 +02:00
radius 7b82c8a9bc fix #6644 2018-04-28 11:56:21 -05:00
radius 5e1a698fa2 fix #6644 2018-04-28 11:42:48 -05:00
twinaphex f14735961a (libFLAC) turn into relative path header includes 2018-04-28 15:14:53 +02:00
twinaphex 238091f182 (OSX/Android) Add Dr. Flac/Dr. Mp3 support to Android/OSX 2018-04-28 14:33:48 +02:00
twinaphex e3ce768ad0 (dr_mp3.h) Fix C89_BUILD issues 2018-04-28 14:32:10 +02:00
twinaphex 3583e1e501 Update 2018-04-28 14:22:42 +02:00
twinaphex e7272ddefa (Audio mixer) Add MP3 support as well 2018-04-28 14:18:04 +02:00
twinaphex 64f31f1ddd Update libretro-common 2018-04-28 13:52:54 +02:00
Twinaphex 2439673dcf Merge pull request #6646 from RobLoach/gfx-context
Fix missing division in mali fbdev
2018-04-28 13:26:20 +02:00
twinaphex 381f14fa9a (dr_flac.h) Silence warnings 2018-04-28 13:13:22 +02:00
twinaphex 9a6e069d6f (dr_flac.h) Assume stdint.h presence 2018-04-28 12:44:52 +02:00
twinaphex 89d765d6c7 Define DR_FLAC_NO_STDIO 2018-04-28 12:44:25 +02:00
twinaphex 437c4fbc0a (dr_flac.h) C89_BUILD fixes 2018-04-28 12:37:50 +02:00
twinaphex 3f7c318e3f (Audio mixer) Add FLAC support to audio mixer 2018-04-28 11:17:37 +02:00
Rob Loach 71c031099b Fix missing division in mali fbdev 2018-04-27 22:44:53 -04:00
twinaphex faa99bd323 Start adding FLAC hooks 2018-04-27 23:45:06 +02:00
twinaphex 714f7b7b13 Cleanups 2018-04-27 23:21:44 +02:00
twinaphex 958602d328 HAVE_BUILTINFLAC no longer needs to be excluded for C89 2018-04-27 23:17:28 +02:00
twinaphex 1f2ef858ab Update libretro-common 2018-04-27 23:12:24 +02:00
Twinaphex b693d76ebb Merge pull request #6638 from bearoso/fixmali
Fix typo in mali fbdev driver.
2018-04-27 19:57:56 +02:00
Twinaphex 6ad624f5bd Merge pull request #6639 from bearoso/travis
Adjust travis build to only use libraries the build-server supports.
2018-04-27 19:57:45 +02:00
Brandon Wright c7f04102c7 Adjust travis build to only use libraries the build-server supports. 2018-04-27 12:48:58 -05:00
Brandon Wright 0e013ced75 Fix typo in mali fbdev driver. 2018-04-27 12:42:46 -05:00
Twinaphex e52bb69b35 Merge pull request #6637 from orbea/flac
Makefile.common: Fix segfaults with --disable-builtinflac.
2018-04-27 19:02:09 +02:00
orbea 76b4b426af Makefile.common: Fix segfaults with --disable-builtinflac. 2018-04-27 09:54:05 -07:00
twinaphex 80025692c1 (Android) Bump up version code 2018-04-26 21:25:38 +02:00
Twinaphex 97215d5c8a Merge pull request #6625 from gblues/master
Fix WaveBird support for the Wii U GCA
2018-04-26 20:46:23 +02:00
twinaphex f1d707a043 Running gl_check_capability from gl_get_flags resulted in a crash
on some Android systems, so unfortunately we cannot selectively hide
away GPU Hard Sync for now
2018-04-26 20:45:01 +02:00
twinaphex 37b1c9e8e9 Add NULL entry 2018-04-26 16:05:57 +02:00
Twinaphex a097d5f6ac Merge pull request #6630 from gingerbeardman/patch-1
changed APP_UNIQUE_ID to next free & valid HEX number
2018-04-26 14:55:32 +02:00
Matt Sephton c6d6bb26c3 changed APP_UNIQUE_ID to next free & valid HEX number
was 0xBAC1G
2018-04-26 13:54:23 +01:00
twinaphex c482aff8b2 No idea where this character came from 2018-04-26 13:38:45 +02:00
Twinaphex 68a93e67e9 Merge pull request #6624 from fr500/master
prevent crashing in cores that don't range check retro_set_controller…
2018-04-26 13:33:21 +02:00
gblues f378e2bfcf Fix WaveBird support for the Wii U GCA
== DETAILS
Thanks to JacobM at GBAtemp for helping me test this.

The WaveBird wasn't being properly picked up due to the port status byte
being different from normal GC controllers. (Why? who knows. Probably
so games could detect the WB and show WB-specific OSDs).

This implementation should be more future-proof, to handle any other
unexpected status bytes.
2018-04-25 21:28:33 -07:00
radius 0964444e06 prevent crashing in cores that don't range check retro_set_controller_port 2018-04-25 19:51:55 -05:00
Twinaphex f0e057c8d0 Merge pull request #6623 from leiradel/master
Remove logging from cheevos
2018-04-25 23:52:40 +02:00
Twinaphex 6ac4032735 Merge pull request #6580 from gblues/gblues/hid
Working HID driver for Wii U [TESTING NEEDED]
2018-04-25 23:10:39 +02:00
twinaphex 9663f5199e (Switch) Enable HAVE_RUNAHEAD for Switch 2018-04-25 22:20:48 +02:00
Twinaphex 09394198b2 Update CHANGES.md 2018-04-25 22:10:04 +02:00
Andre Leiradella f04548a95d Fixed warning about unused STUB_LOG; removed unused debug functions 2018-04-25 18:02:31 +01:00
Andre Leiradella 029ba3d2f6 Mute cheevos logging, define CHEEVOS_VERBOSE in cheevos.h to enable 2018-04-25 17:56:15 +01:00
gblues 07864aebb4 Add fault-tolerance to kpad driver
== DETAILS

So, the KPadRead function will sometimes return 0, but this doesn't mean
the wiimote is actually disconnected. It's usually something transient, like
the BT chip has nothing to send or whatever. I don't know.

So, I added a buffer so that it won't disconnect the pad without 5
consecutive 0-reads.

This is a temporary hack; a proper solution will use the Wii U's callback
mechanisms to do wiimote detection. But that's a separate project. This at
least prevents OSD spam.

== TESTING

Tested locally. Verified that connecting/disconnecting nunchuk during play
still works properly.
2018-04-24 21:46:42 -07:00
gblues f33fa3d566 Fix pad leak in kpad (wiimote) driver
== DETAILS

This is the wiimote version of the same bug I previously fixed in the HID
driver, where disconnected pads didn't actually invoke the unregister task.

This has an extra wrinkle, in that we *also* need to invoke the unregister
task when the wiimote device changes (e.g. user plugs in a nunchuk or
classic controller).

Now, there's still the problem of the "disconnect" detection being broken; so
a consequence of this commit is OSD spam. However, the actual wiimote input
is processed successfully and there's no noticeable issues in the pad
handling.

== TESTING

Using Mario 3, I played a level in which I started as bare wiimote, then
hot-plugged the nunchuk, and the input switched automatically. At  the
end of the level, I hot-unplugged the nunchuk and it automatically reverted
to horizontal layout; and the pad remained 100% responsive the entire time.
2018-04-24 21:20:08 -07:00
gblues f6b33b1d30 missing file 2018-04-24 06:37:02 -07:00
gblues 1d84c0eca1 Fix analog for DS3, plus some cleanups
== DETAILS

- DS3 analog wasn't working mainly because I forgot to actually declare the
  axes in input/input_autoconfig.c when declaring the pad. Whoops.
- I also moved the axis decoding logic to a more central place, because it
  clearly is not Wii U specific.
- Removed some dead commented-out code

== TESTING

Can use analog inputs on both GCA and DS3. Tested in Mario 3 on Nestopia core.

Haven't tested with any actual analog games, but I did confirm via logging
that the correct ranges are produced.
2018-04-23 23:22:27 -07:00
gblues f7135bcee6 Fix analog reading on GCA
== DETAILS
After a little trial and error, I got analog input working for the
Wii U GC adapter.

DS3 might work, but it's untested.
2018-04-22 23:47:07 -07:00
gblues ed742c48e0 Fix hotplugging
== DETAILS
So, it turns out that there *is* a autoconfig disconnect handler. Took digging
through tasks/task_autodetect.c to find it!

So, I added a call to the handler when the pad gets disconnected.

This seems to solve the problem of the pad not disappearing from the menu.

(At the very least, the user's pad index reverts to "none" which is still
an improvement)

== TESTING
Tested manually, made sure it didn't crash or leak slots.
2018-04-22 17:34:20 -07:00
gblues ef36744859 Start implementing fall-back to async read
== DETAILS

The Wii U GC adapter doesn't seem to like doing async reads if it is connected
via a USB hub. It seems to be device-specific, though, because my DS3 works
just fine through the same hub.

I tried creating a fallback to synchronous reads, but it resulted in a hard
lock of the system. So, for the time being, it's going to be a known
limitation. Might be solved by using a powered USB hub.

Learned that the cache alignment is 64, not 32, so the alignment math has
been updated. Thanks, @aliaspider for that info.
2018-04-20 21:58:45 -07:00
gblues 0c92fab0b9 Fix GameCube button detection
This should fix the issue where R/L buttons didn't register when doing
input detection.

This also brings the GC pad in line with the rest of the gamepads in
input_autodetect_builtin.c.

Also fixed a really stupid bug that was part of why analog inputs aren't
being read. Analog still isn't working, mind, but it's a lot closer to
working now that it's actually getting down into the pad driver level!
2018-04-20 00:00:33 -07:00
gblues 53738e4a0d Allow Wii U GCA to work without 2nd cable attached
=== DETAILS

So, the GCA has 2 USB connections; one is the data connection, and the
second is used to drive rumble.

Due to a driver bug, if the second cable wasn't attached, the pads wouldn't
get detected.

I fixed that bug.
2018-04-18 23:12:45 -07:00
gblues 6eebbe4213 Build fix for PC
== DETAILS
Hooray for conditional compile directives.

Moving things around broke things in unexpected ways on non-WiiU builds.

Well, not *completely* unexpected. But still.

Changes:

- Move some typedefs around to avoid circular include dependencies
- Include the file where the HID driver definition got moved to

== TESTING
- verified build for Wii U still runs successfully
- did a local build without any errors (some weird warnings, but since they
  happen in code I didn't change, I'm assuming they're pre-existing?)
2018-04-15 00:04:49 -07:00
gblues 4cd301bd92 Add pad unregistration
== DETAILS

I think this will fix the problem with duplicate pads--pads weren't properly
de-initializing and registering as disconnected. When a pad is disconnected,
the slot should properly release now.
2018-04-14 21:30:44 -07:00
gblues 6ab91a422e Small cleanup to adapt to upstream code changes
retro_bits_t turned into input_bits_t and there were parts of my
code that needed to update.

== TESTING
No idea if upstream changes broke anything, but it compiles cleanly
now.
2018-04-14 14:34:13 -07:00
gblues fb5b31faf3 Merge branch 'master' into gblues/hid 2018-04-14 14:18:03 -07:00
gblues 97e09d179f Fix deadlocks when device is unplugged
== DETAILS
TIL that it's bad to call synchronization code from callbacks.

To avoid that, I made the following changes:

- Implemented an atomic swap (see previous commit) to avoid explicit
  locking when working with the event list
- ensure locks are only acquired in either the main thread or the
  I/O polling thread
- use an explicit polling loop; we still use async reads, but the
  read doesn't immediately re-invoke itself.
- remove the sleep in the polling thread.
- remove unnecessary locking in the thread cleanup call--verified that
  the list can't be modified while it is being executed.

== TESTING
I tested locally, and was able to disconnect/reconnect USB devices several times without the worker thread getting deadlocked.
2018-04-14 13:30:34 -07:00
gblues dca36ebaf8 Add small snippet for atomic value swapping
Fortunately, the gcc port implements the builtins and, from basic
testing, they seem to work.

This is only really useful on Wii U--other platforms have more
robust atomic operations, or aren't using gcc to build.
2018-04-14 01:26:26 -07:00
gblues 4433cbebc6 Get digital inputs for Sony DualShock 3 working
== DETAILS

- fix the bitshift math
- read the right bytes out of the ds3 data packet
- remove verbose logging in critical path
- stop caring about errors in the hid read loop -- seems to just
  be benign "device not ready" -- or at least, that's what I'm assuming
  given that the read eventually succeeds.

== TESTING
Played Mario 3 with the DS3 with no issues.
2018-04-05 23:03:38 -07:00
gblues 46dad14d5f Merge branch 'master' into gblues/hid 2018-04-03 20:30:06 -07:00
gblues af08e5015a More work on Dual Shock 3 driver
== DETAILS

- update to not try starting the read loop until after the device
  is successfully initialized
- add new HID wrapper macros needed by ds3 driver
- add some debug logging to help with troubleshooting
- add button map for DS3

== TESTING
Tested with local build. DS3 init is not working.
2018-04-02 23:16:49 -07:00
gblues 9bc5a15c2d Enable pads to register in any order
== DETAILS

Whereas the last commit had a hack (that disabled the wiimote
driver in the process), this has.. well, a *different* hack that
allows pads to register in any order.

Note that due to the initialization routines, the gamepad will still
likely always get slot 0. Not sure if this can be overridden via config
or not.

== TESTING

Tested locally with GC adapter
2018-04-01 18:52:26 -07:00
gblues 2cf89feb86 Code clean-up
== DETAILS

Now that I have a working implementation, it's time to tidy up a bit:

- there was no need for the HID subsystem's object data to have a reference
  to the global hid state (since it's global), so removed it.
- refactored the users of that member to use the global state, defining
  reusable macros.
- reorganized the information in *.h files
- removing the hid state also made the constructor changes to the hid driver
  unneeded, so I reverted those changes.

== TESTING
Confirmed clean build. Haven't tested the build yet to make sure everything
still works, though.
2018-03-31 22:25:30 -07:00
gblues 39e4167df6 Start work on DualShock 3 driver
== DETAILS

The WiiU GC adapter is working!

Next up: DualShock 3

I have the skeleton of the driver started, need to work out the
activation packet.

== TESTING

The DS3 driver is broke as hell right now.
2018-03-30 23:00:14 -07:00
gblues d65bd90e67 Fix GC pad button mapping 2018-03-30 18:57:34 -07:00
gblues 5060c2aac4 More fixes, GC pad kinda sorta works
== DETAILS

- Added a new method to the joypad_connection_t interface for
  getting a single button
- wired everything into the hidpad driver
- for testing purposes, hacking the top-level joypad driver
  so that kpad isn't used
- add a new RARCH_LOG_BUFFER method to verbosity for logging the
  contents of a binary buffer (useful for writing/debugging pad drivers)
- fix a few bugs in the wiiu GC pad driver

The button mapping isn't quite right, and I'm not sure what's
going wrong.
2018-03-29 23:37:11 -07:00
gblues 89c1ba7929 Keep HID pads from clobbering gamepad/wiimotes
== DETAILS

Trying to do weird pad math just wasn't working so I bit the bullet and just
let it allocate all 16 pads in the slot list, then just mark 0-4 as
connected so that the slot allocator would start at 5.

I can see it detect the pad, but no idea if it works. Out of time for
today.
2018-03-29 23:37:11 -07:00
gblues 1eea48d0c8 Fix crash on exit bug
== DETAILS

Turns out freeing memory that's already been freed is.. bad.

Fix two double-free instances; one due to over-freeing and the other
due to wrong order-of-operations causing a double free.

Also updated logging a little.

== TESTING

The GC adapter still clobbers slot 0, but the "emergency exit" sequence
works to quit RA cleanly.
2018-03-29 23:37:11 -07:00
gblues 6b43defc98 Less verbose logging 2018-03-29 23:37:11 -07:00
gblues 8a4c5086fb Finish HID implementation for WiiU GCA adapter
== DETAILS

(I think)

- Uncomment the call in the read loop to start feeding packets to the
  driver
- implement the GCA packet driver
- implement the pad interface
- fix indentations in GCA driver

== TESTING
Compiles. Haven't tested yet.
2018-03-29 23:37:11 -07:00
gblues 180d6a28bf Fix up HID device driver initialization
== DETAILS
Turns out the cause of the crash was a bad cast, resulting in a
function call to nowhere.

Also, I think the DSI exception handler only works on the primary core;
when this was happening in the background thread, I got a black
screen error instead.

Next up: finishing up the GCA driver.
2018-03-29 23:37:11 -07:00
gblues dc6f4c23ed Rename hid_driver_instance members for clarity 2018-03-29 23:37:11 -07:00
gblues 4b9d5c0ab7 Start implementing "detach" code path
== DETAILS
We're at a point where we need to do more than just
clean up a local data structure, so I've started
implementing the "detach" part of the code so that
everything gets cleaned up properly.

Also, added error handling inside the polling
thread.

== TESTING

Have not tested yet.
2018-03-29 23:37:11 -07:00
gblues 0100d58ffb WIP: evolve driver implementation
== DETAILS

I've created the concept of a hid_driver_instance_t which is basically
a central place to store the hid pad driver, hid subsystem driver,
the pad list, and the instance data for the above in a central location.

The HID pad device drivers can use it to perform HID operations in a
generic manner.

This is more-or-less a pause point so I can catch up with upstream.

== TESTING

Haven't tested this yet. Compiles without warnings though!
2018-03-29 23:37:11 -07:00
gblues 41ce8853d7 Add name for hid device; implement detect
== DETAILS

- detect() methods in device_* files now check for VID/PID
  instead of just returning false
- add "name" field on hid device, mainly for logging purposes

== TESTING
Verified my WiiU GC adapter detected properly
2018-03-29 23:37:11 -07:00
gblues ae19eed00f implement hid device search 2018-03-29 23:37:11 -07:00
231 changed files with 22970 additions and 6092 deletions

No files matched your search

+2 -2
View File
@@ -10,7 +10,7 @@ matrix:
- g++-mingw-w64-i686
- mingw-w64-i686-dev
script:
- CROSS_COMPILE=i686-w64-mingw32- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: mingw-x64
addons:
apt:
@@ -18,7 +18,7 @@ matrix:
- g++-mingw-w64-x86-64
- mingw-w64-x86-64-dev
script:
- CROSS_COMPILE=x86_64-w64-mingw32- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: gcc
- compiler: clang
addons:
+24 -1
View File
@@ -1,4 +1,20 @@
# 1.7.3 (future)
# 1.7.4 (future)
# 1.7.3
- AUDIO: Audio mixer supports FLAC/MP3 file types now!
- COMMON: Fixed bug 'crashing in cores that don't range check retro_set_controller_type'. Some people were having crashes when device is set to RETRO_DEVICE_NONE and the cores don't check the number of ports, in VBAM's case it was overflowing and crashing. QuickNES was crashing too.
- COMMON: Fixed buffer overflow in url encoding (affecting MSVC2010/2013).
- COMMON: (QuickMenu) Added Configuration Override submenu.
- HID: Merge new HID subsystem.
- HID: Fix WaveBird support for the Wii U GCA.
- HID/OSX: Fix regression with IODHIDManager - gamepads which are connected later would not be autoconfigured.
- LOCALIZATION: Update Italian translation.
- LOCALIZATION: Update Japanese translation.
- LOCALIZATION: Update Portuguese translation.
- MENU: Audio mixer now works in the menu without any cores loaded. You have to enable the setting 'Enable menu audio' for this to work.
- REMAPPING/OVERLAYS: Fix regression - overlays could no longer be remapped.
- SCANNER: Add Wii Backup File WBFS support.
- X11: CRT SwitchRes support for X11/Linux.
# 1.7.2
- ANDROID/OPENSL: Prevent crashes when setting audio latency too low (buffer count can never be lower than 2 now).
@@ -45,6 +61,13 @@ that support it (so far this includes - D3D8/D3D9, OpenGL, Vulkan)
- IOS: Fixed crash when opening downloaded roms from Safari or using the "Open in.." functionality. Added the compiler flag to support keyboard remapping to controls.
- IOS: Fixed buffer overlap that caused a crash while trying to download GLSL shaders from the buildbot.
- PS3: fix URLS
- REMAPS: Mapping keyboard keys from more than one gamepad (works with dosbox)
- REMAPS: Mapping more than one button to the same action
- REMAPS: Unmapping buttons
- REMAPS: Unmapping analogs
- REMAPS: Mapping a button to trigger an analog response (tested with mupen, can run on SM64 with the d-pad now, triggers a full analog tilt)
- REMAPS: Mapping an analog to another analog (having more than one analog mapped to the same output causes issues)
- REMAPS: Mapping an analog to produce a button response
- SCANNER: Should be able to scan dual-layer Wii disc images now, filestream code now supports files larger than 4GB.
- SHADERS/SLANG: Slang shaders should work again on Android version and MSVC versions (basically all the Griffin-based versions).
- SHADERS: If GL context is GLES2/3/Core context, Cg shaders are unavailable. Applies to shader list too.
+36 -11
View File
@@ -92,21 +92,22 @@ APPEND_CFLAGS := $(CFLAGS)
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
ifeq ($(CXX_BUILD), 1)
LINK = $(CXX)
CFLAGS := $(CXXFLAGS) -xc++
CFLAGS += -DCXX_BUILD
CXXFLAGS += -DCXX_BUILD
else
ifeq ($(NEED_CXX_LINKER),1)
ifeq ($(HAVE_CXX), 1)
ifeq ($(CXX_BUILD), 1)
LINK = $(CXX)
CFLAGS := $(CXXFLAGS) -xc++
CFLAGS += -DCXX_BUILD
CXXFLAGS += -DCXX_BUILD
else ifeq ($(NEED_CXX_LINKER),1)
LINK = $(CXX)
else ifeq ($(findstring Win32,$(OS)),)
LINK = $(CC)
else
# directx-related code is c++
LINK = $(CXX)
LINK = $(CC)
endif
else
LINK = $(CC)
endif
ifneq ($(CXX_BUILD), 1)
ifneq ($(GNU90_BUILD), 1)
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
@@ -150,8 +151,29 @@ ifneq ($(findstring $(GPERFTOOLS),tcmalloc),)
LIBS += -ltcmalloc
endif
# Qt MOC generation, required for QObject-derived classes
ifneq ($(MOC_HEADERS),)
# prefix moc_ to base filename of paths and change extension from h to cpp, so a/b/foo.h becomes a/b/moc_foo.cpp
MOC_SRC := $(join $(addsuffix moc_,$(addprefix $(OBJDIR)/,$(dir $(MOC_HEADERS)))), $(notdir $(MOC_HEADERS:.h=.cpp)))
MOC_OBJ := $(patsubst %.cpp,%.o,$(MOC_SRC))
RARCH_OBJ += $(MOC_OBJ)
endif
all: $(TARGET) config.mk
$(MOC_SRC):
@$(if $(Q), $(shell echo echo MOC $<),)
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
$(Q)$(MOC) -o $(MOC_TMP) $<
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
$(MOC_OBJ):
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
$(foreach x,$(join $(addsuffix :,$(MOC_OBJ)),$(MOC_SRC)),$(eval $x))
ifeq ($(MAKECMDGOALS),clean)
config.mk:
else
@@ -250,3 +272,6 @@ clean:
rm -f *.d
.PHONY: all install uninstall clean
print-%:
@echo '$*=$($*)'
+20 -10
View File
@@ -147,6 +147,8 @@ ifneq ($(GIT_VERSION),)
endif
# General object files
DEFINES += -DHAVE_DR_MP3
CFLAGS += -DHAVE_DR_MP3
OBJ += frontend/frontend.o \
frontend/frontend_driver.o \
@@ -198,6 +200,7 @@ OBJ += frontend/frontend.o \
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
audio/audio_driver.o \
$(LIBRETRO_COMM_DIR)/audio/audio_mixer.o \
input/common/input_common.o \
input/input_driver.o \
input/input_mapper.o \
led/led_driver.o \
@@ -321,23 +324,27 @@ DEFINES += -DHAVE_IMAGEVIEWER
OBJ += cores/libretro-imageviewer/image_core.o
endif
# Qt
ifeq ($(HAVE_QT_WRAPPER), 1)
OBJ += ui/drivers/ui_qt.o
LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -L./ui/drivers/qt/build/release/
LIBS += -lwrapper
endif
# Qt WIMP GUI
ifeq ($(HAVE_QT), 1)
OBJ += ui/drivers/ui_qt.o \
ui/drivers/qt/ui_qt_application.o \
ui/drivers/qt/ui_qt_window.o \
ui/drivers/qt/ui_qt_browser_window.o \
ui/drivers/qt/ui_qt_load_core_window.o \
ui/drivers/qt/ui_qt_msg_window.o
MOC_HEADERS += ui/drivers/ui_qt.h \
ui/drivers/qt/ui_qt_load_core_window.h
DEFINES += $(QT5CORE_CFLAGS) $(QT5GUI_CFLAGS) $(QT5WIDGETS_CFLAGS) -DHAVE_MAIN
#DEFINES += $(QT5WEBENGINE_CFLAGS)
LIBS += $(QT5CORE_LIBS) $(QT5GUI_LIBS) $(QT5WIDGETS_LIBS)
#LIBS += $(QT5WEBENGINE_LIBS)
NEED_CXX_LINKER = 1
ifneq ($(findstring Linux,$(OS)),)
DEFINES += -I/usr/include/qt -fPIC
DEFINES += -fPIC
endif
endif
@@ -1182,7 +1189,7 @@ ifeq ($(HAVE_VULKAN), 1)
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_vulkan.o
endif
LIBS += -lstdc++
NEED_CXX_LINKER = 1
DEFINES += -DHAVE_VULKAN
INCLUDE_DIRS += -Igfx/include
@@ -1436,6 +1443,8 @@ endif
ifeq ($(HAVE_BUILTINFLAC),1)
HAVE_FLAC = 1
DEFINES += -DHAVE_DR_FLAC -I$(DEPS_DIR)
CFLAGS += -DHAVE_DR_FLAC
CFLAGS += -DHAVE_FLAC -I$(DEPS_DIR)/libFLAC/include
DEFINES += -DHAVE_STDINT_H -DHAVE_LROUND -DFLAC__HAS_OGG=0 \
-DFLAC_PACKAGE_VERSION="\"retroarch\""
@@ -1462,7 +1471,8 @@ ifeq ($(HAVE_BUILTINFLAC),1)
endif
OBJ += $(FLACOBJ)
else ifeq ($(HAVE_FLAC),1)
LIBS += $(FLAC_LIBS)
DEFINES += -DHAVE_FLAC
LIBS += $(FLAC_LIBS)
endif
ifeq ($(HAVE_ZLIB), 1)
+2
View File
@@ -12,6 +12,7 @@ ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_NEON -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_RUNAHEAD
else
HAVE_CC_RESAMPLER = 1
HAVE_MENU_COMMON = 1
@@ -29,6 +30,7 @@ else
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_MENU = 1
HAVE_RUNAHEAD = 1
include Makefile.common
BLACKLIST :=
+7 -10
View File
@@ -6,8 +6,8 @@ DEBUG = 0
GRIFFIN_BUILD = 0
SALAMANDER_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
WIIU_HID = 1
HAVE_RUNAHEAD = 1
WIIU_HID = 0
WIIU_LOG_RPX = 0
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_IP_ADDRESS ?=
@@ -33,6 +33,7 @@ OBJ += wiiu/input/wpad_driver.o
OBJ += wiiu/input/kpad_driver.o
OBJ += wiiu/input/pad_functions.o
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/atomic.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
@@ -49,15 +50,11 @@ ifeq ($(WIIU_HID),1)
OBJ += wiiu/input/hidpad_driver.o
OBJ += wiiu/input/wiiu_hid.o
OBJ += input/connect/joypad_connection.o \
input/connect/connect_ps2adapter.o \
input/connect/connect_psxadapter.o \
input/connect/connect_ps3.o \
input/connect/connect_ps4.o \
input/connect/connect_wii.o \
input/connect/connect_nesusb.o \
input/connect/connect_snesusb.o \
input/connect/connect_wiiupro.o \
input/connect/connect_wiiugca.o
input/common/hid/hid_device_driver.o \
input/common/hid/device_wiiu_gca.o \
input/common/hid/device_ds3.o \
input/common/hid/device_ds4.o \
input/common/hid/device_null.o
endif
ifeq ($(SALAMANDER_BUILD),1)
+10 -10
View File
@@ -4,7 +4,7 @@
# RetroArch
RetroArch is the reference frontend for the libretro API.
Popular examples of implementations for this API includes videogame system emulators and game engines as well as
Popular examples of implementations for this API includes video game system emulators and game engines as well as
more generalized 3D programs.
These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".
@@ -79,7 +79,7 @@ RetroArch has been ported to the following platforms:
- Original Microsoft Xbox
- Microsoft Xbox 360 (Libxenon/XeXDK)
- Nintendo Wii, GameCube (Libogc)
- Nintendo WiiU
- Nintendo Wii U
- Nintendo 3DS
- Nintendo Switch
- Raspberry Pi
@@ -149,7 +149,7 @@ Instructions for compiling and installing RetroArch can be found in the [Libretr
CRT Switch res will turn on, on the fly. However, you will need to restart retroarch to disable it. With CRT SwitchRes enable Retroarch will start in 2560 x 480 @ 60.
If you are running windows, before enabling the CRT SwitchRes options pleasae make sure you have installed CRTEmudriver and installed some modelines. The minimum modelins for all games to switch correctly are:
If you are running windows, before enabling the CRT SwitchRes options please make sure you have installed CRTEmudriver and installed some modelines. The minimum modelins for all games to switch correctly are:
- 2560 x 192 @ 60.000000
- 2560 x 200 @ 60.000000
@@ -161,7 +161,7 @@ If you are running windows, before enabling the CRT SwitchRes options pleasae ma
- 2560 x 448 @ 60.000000
- 2560 x 480 @ 60.000000
Install these modelines replacing 2560 with your desired super resuloution. The above resolutions are NTSC only so if you would be playing any PAL content please add pal modelines:
Install these modelines replacing 2560 with your desired super resolution. The above resolutions are NTSC only so if you would be playing any PAL content please add pal modelines:
- 2560 x 192 @ 50.000000
- 2560 x 200 @ 50.000000
@@ -173,7 +173,7 @@ Install these modelines replacing 2560 with your desired super resuloution. The
- 2560 x 448 @ 50.000000
- 2560 x 480 @ 50.000000
Some games will require heigher PAL resolutions which should also be installed:
Some games will require higher PAL resolutions which should also be installed:
- 2560 x 512 @ 50.000000
- 2560 x 576 @ 50.000000
@@ -182,11 +182,11 @@ Ideally install all these modelines and everything will work great.
## Super Resolutions
The default super resolution is 2560. It is displayed just under the CRT switch option, which can be found in video settings. This can be changed within the retroarch.cfg. The only compatible resolutions are 1920, 2560 and 3840. Any other resolutions will be ignored and native swithing will be activated.
The default super resolution is 2560. It is displayed just under the CRT switch option, which can be found in video settings. This can be changed within the retroarch.cfg. The only compatible resolutions are 1920, 2560 and 3840. Any other resolutions will be ignored and native switching will be activated.
## Native Resolutions
If native reolutions are activeted you will need a whole new set of modelines:
If native resolutions are activated you will need a whole new set of modelines:
- 512 x 240 @ 50.006977 SNESpal
- 512 x 224 @ 50.006977 SNESpal
@@ -249,10 +249,10 @@ If native reolutions are activeted you will need a whole new set of modelines:
- 400 x 254 @ 54.706841 MK
- 384 x 224 @ 59.637405 CPS1
These modelines are more acurate giving exact hz. However, some games may have unwanted results. This is due to mid-scanline resolution chages on the orgiginal hardware. For the best results super resolutions are the way to go.
These modelines are more accurate giving exact hz. However, some games may have unwanted results. This is due to mid-scanline resolution changes on the original hardware. For the best results super resolutions are the way to go.
## CRT resolution switching & Mame
Some arecade resolutions can be alot different. There is resolution detection to ensure mame games will be diplayed in the closest available resolution but drawn at their native resolution within this resolution. Meaning that the mame game will look just like the original hardware.
Some arcade resolutions can be a lot different. There is resolution detection to ensure mame games will be displayed in the closest available resolution but drawn at their native resolution within this resolution. Meaning that the mame game will look just like the original hardware.
Mame roms that run in a vertical aspect like DoDonPachi need to be roted within mame before rolution swithing and aspect correction will work. Do this before enableing CRT switchRes so that Retroarch will run in your desktop resolution. Once you have roted any games that may need it switch CRT SwitchRes on.
Mame roms that run in a vertical aspect like DoDonPachi need to be rotated within mame before resolution switching and aspect correction will work. Do this before enabling CRT switchRes so that Retroarch will run in your desktop resolution. Once you have roted any games that may need it switch CRT SwitchRes on.
+309 -90
View File
@@ -45,7 +45,15 @@
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
#define AUDIO_MIXER_MAX_STREAMS 8
/**
* db_to_gain:
* @db : Decibels.
*
* Converts decibels to voltage gain.
*
* Returns: voltage gain value.
**/
#define db_to_gain(db) (powf(10.0f, (db) / 20.0f))
static const audio_driver_t *audio_drivers[] = {
#ifdef HAVE_ALSA
@@ -122,18 +130,6 @@ static const audio_driver_t *audio_drivers[] = {
NULL,
};
struct audio_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_state state;
float volume;
void *buf;
size_t bufsize;
};
static unsigned audio_mixer_current_max_idx = 0;
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_STREAMS] = {{0}};
static size_t audio_driver_chunk_size = 0;
@@ -183,6 +179,11 @@ static void *audio_driver_context_audio_data = NULL;
static bool audio_suspended = false;
static void audio_mixer_play_stop_sequential_cb(
audio_mixer_sound_t *sound, unsigned reason);
static void audio_mixer_play_stop_cb(
audio_mixer_sound_t *sound, unsigned reason);
enum resampler_quality audio_driver_get_resampler_quality(void)
{
settings_t *settings = config_get_ptr();
@@ -193,6 +194,22 @@ enum resampler_quality audio_driver_get_resampler_quality(void)
return (enum resampler_quality)settings->uints.audio_resampler_quality;
}
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i)
{
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
return NULL;
return &audio_mixer_streams[i];
}
const char *audio_driver_mixer_get_stream_name(unsigned i)
{
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
return "N/A";
if (!string_is_empty(audio_mixer_streams[i].name))
return audio_mixer_streams[i].name;
return "N/A";
}
/**
* compute_audio_buffer_statistics:
*
@@ -368,6 +385,12 @@ static bool audio_driver_deinit_internal(void)
return true;
}
static void audio_driver_mixer_init(unsigned out_rate)
{
audio_mixer_init(out_rate);
}
static bool audio_driver_init_internal(bool audio_cb_inited)
{
unsigned new_rate = 0;
@@ -524,7 +547,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
{
audio_driver_buffer_size =
current_audio->buffer_size(audio_driver_context_audio_data);
audio_driver_control = true;
audio_driver_control = true;
}
else
RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
@@ -534,7 +557,7 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
audio_driver_free_samples_count = 0;
audio_mixer_init(settings->uints.audio_out_rate);
audio_driver_mixer_init(settings->uints.audio_out_rate);
/* Threaded driver is initially stopped. */
if (
@@ -576,20 +599,17 @@ void audio_driver_set_nonblocking_state(bool enable)
static void audio_driver_flush(const int16_t *data, size_t samples)
{
struct resampler_data src_data;
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
const void *output_data = NULL;
unsigned output_frames = 0;
float audio_volume_gain = !audio_driver_mute_enable ?
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
const void *output_data = NULL;
unsigned output_frames = 0;
float audio_volume_gain = !audio_driver_mute_enable ?
audio_driver_volume_gain : 0.0f;
src_data.data_in = NULL;
src_data.data_out = NULL;
src_data.input_frames = 0;
src_data.output_frames = 0;
src_data.ratio = 0.0f;
src_data.data_out = NULL;
src_data.output_frames = 0;
if (recording_data)
recording_push_audio(data, samples);
@@ -606,8 +626,8 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
convert_s16_to_float(audio_driver_input_data, data, samples,
audio_volume_gain);
src_data.data_in = audio_driver_input_data;
src_data.input_frames = samples >> 1;
src_data.data_in = audio_driver_input_data;
src_data.input_frames = samples >> 1;
if (audio_driver_dsp)
@@ -662,7 +682,7 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
#endif
}
src_data.ratio = audio_source_ratio_current;
src_data.ratio = audio_source_ratio_current;
if (is_slowmotion)
{
@@ -675,7 +695,7 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
if (audio_mixer_active)
{
bool override = audio_driver_mixer_mute_enable ? true :
(audio_driver_mixer_volume_gain != 0.0f) ? true : false;
(audio_driver_mixer_volume_gain != 1.0f) ? true : false;
float mixer_gain = !audio_driver_mixer_mute_enable ?
audio_driver_mixer_volume_gain : 0.0f;
audio_mixer_mix(audio_driver_output_samples_buf,
@@ -725,6 +745,22 @@ void audio_driver_sample(int16_t left, int16_t right)
audio_driver_data_ptr = 0;
}
void audio_driver_menu_sample(void)
{
static int16_t samples_buf[1024] = {0};
struct retro_system_av_info
*av_info = video_viewport_get_system_av_info();
const struct retro_system_timing *info =
(const struct retro_system_timing*)&av_info->timing;
unsigned sample_count = (info->sample_rate / info->fps) * 2;
while (sample_count > 1024)
{
audio_driver_flush(samples_buf, 1024);
sample_count -= 1024;
}
audio_driver_flush(samples_buf, sample_count);
}
/**
* audio_driver_sample_batch:
* @data : pointer to audio buffer.
@@ -840,13 +876,13 @@ void audio_driver_monitor_adjust_system_rates(void)
{
float timing_skew;
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
float video_refresh_rate = settings->floats.video_refresh_rate;
float max_timing_skew = settings->floats.audio_max_timing_skew;
const struct retro_system_timing *info = av_info ?
(const struct retro_system_timing*)&av_info->timing : NULL;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
const struct retro_system_timing *info =
(const struct retro_system_timing*)&av_info->timing;
if (!info || info->sample_rate <= 0.0)
if (info->sample_rate <= 0.0)
return;
timing_skew = fabs(1.0f - info->fps / video_refresh_rate);
@@ -976,6 +1012,12 @@ bool audio_driver_mixer_extension_supported(const char *ext)
string_list_append(str_list, "mod", attr);
string_list_append(str_list, "s3m", attr);
string_list_append(str_list, "xm", attr);
#endif
#ifdef HAVE_DR_FLAC
string_list_append(str_list, "flac", attr);
#endif
#ifdef HAVE_DR_MP3
string_list_append(str_list, "mp3", attr);
#endif
string_list_append(str_list, "wav", attr);
@@ -1021,18 +1063,16 @@ static void audio_mixer_play_stop_cb(
{
unsigned i = (unsigned)idx;
#if 0
if (audio_mixer_streams[i].buf != NULL)
free(audio_mixer_streams[i].buf);
#endif
if (!string_is_empty(audio_mixer_streams[i].name))
free(audio_mixer_streams[i].name);
audio_mixer_streams[i].name = NULL;
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].buf = NULL;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
audio_mixer_current_max_idx--;
}
break;
case AUDIO_MIXER_SOUND_STOPPED:
@@ -1042,15 +1082,75 @@ static void audio_mixer_play_stop_cb(
}
}
static void audio_mixer_play_stop_sequential_cb(
audio_mixer_sound_t *sound, unsigned reason)
{
int idx = audio_mixer_find_index(sound);
switch (reason)
{
case AUDIO_MIXER_SOUND_FINISHED:
audio_mixer_destroy(sound);
if (idx >= 0)
{
unsigned i = (unsigned)idx;
if (!string_is_empty(audio_mixer_streams[i].name))
free(audio_mixer_streams[i].name);
audio_mixer_streams[i].name = NULL;
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].buf = NULL;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
i++;
for (; i < AUDIO_MIXER_MAX_STREAMS; i++)
{
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_STOPPED)
{
audio_driver_mixer_play_stream_sequential(i);
break;
}
}
}
break;
case AUDIO_MIXER_SOUND_STOPPED:
break;
case AUDIO_MIXER_SOUND_REPEATED:
break;
}
}
bool audio_driver_mixer_get_free_stream_slot(unsigned *id)
{
unsigned i;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
{
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_NONE)
{
*id = i;
return true;
}
}
return false;
}
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
{
unsigned free_slot = 0;
audio_mixer_voice_t *voice = NULL;
audio_mixer_sound_t *handle = NULL;
audio_mixer_stop_cb_t stop_cb = audio_mixer_play_stop_cb;
bool looped = false;
void *buf = NULL;
if (audio_mixer_current_max_idx >= AUDIO_MIXER_MAX_STREAMS)
if (!audio_driver_mixer_get_free_stream_slot(&free_slot))
return false;
if (params->state == AUDIO_STREAM_STATE_NONE)
@@ -1074,9 +1174,18 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
case AUDIO_MIXER_TYPE_MOD:
handle = audio_mixer_load_mod(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_FLAC:
#ifdef HAVE_DR_FLAC
handle = audio_mixer_load_flac(buf, (int32_t)params->bufsize);
#endif
break;
case AUDIO_MIXER_TYPE_MP3:
#ifdef HAVE_DR_MP3
handle = audio_mixer_load_mp3(buf, (int32_t)params->bufsize);
#endif
break;
case AUDIO_MIXER_TYPE_NONE:
free(buf);
return false;
break;
}
if (!handle)
@@ -1085,74 +1194,193 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
return false;
}
if (params->state == AUDIO_STREAM_STATE_PLAYING)
switch (params->state)
{
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
}
else if (params->state == AUDIO_STREAM_STATE_PLAYING_LOOPED)
{
looped = true;
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
looped = true;
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
break;
case AUDIO_STREAM_STATE_PLAYING:
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
break;
case AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL:
stop_cb = audio_mixer_play_stop_sequential_cb;
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
break;
default:
break;
}
audio_mixer_streams[audio_mixer_current_max_idx].buf = buf;
audio_mixer_streams[audio_mixer_current_max_idx].handle = handle;
audio_mixer_streams[audio_mixer_current_max_idx].voice = voice;
audio_mixer_streams[audio_mixer_current_max_idx].state = params->state;
audio_mixer_streams[audio_mixer_current_max_idx].volume = params->volume;
audio_mixer_streams[audio_mixer_current_max_idx].stop_cb = stop_cb;
audio_mixer_active = true;
audio_mixer_current_max_idx++;
audio_mixer_streams[free_slot].name = !string_is_empty(params->basename) ? strdup(params->basename) : NULL;
audio_mixer_streams[free_slot].buf = buf;
audio_mixer_streams[free_slot].handle = handle;
audio_mixer_streams[free_slot].voice = voice;
audio_mixer_streams[free_slot].state = params->state;
audio_mixer_streams[free_slot].volume = params->volume;
audio_mixer_streams[free_slot].stop_cb = stop_cb;
return true;
}
static void audio_driver_mixer_remove_stream(unsigned i)
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
audio_mixer_voice_t *voice = audio_mixer_streams[i].voice;
if (i >= AUDIO_MIXER_MAX_STREAMS)
return AUDIO_STREAM_STATE_NONE;
return audio_mixer_streams[i].state;
}
static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
{
bool set_state = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
return;
switch (audio_mixer_streams[i].state)
{
case AUDIO_STREAM_STATE_STOPPED:
audio_mixer_streams[i].voice = audio_mixer_play(audio_mixer_streams[i].handle,
(type == AUDIO_STREAM_STATE_PLAYING_LOOPED) ? true : false,
1.0f, audio_mixer_streams[i].stop_cb);
set_state = true;
break;
case AUDIO_STREAM_STATE_PLAYING:
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
case AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL:
case AUDIO_STREAM_STATE_NONE:
break;
}
if (set_state)
audio_mixer_streams[i].state = (enum audio_mixer_state)type;
}
void audio_driver_mixer_play_stream(unsigned i)
{
audio_mixer_streams[i].stop_cb = audio_mixer_play_stop_cb;
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING);
}
void audio_driver_mixer_play_stream_looped(unsigned i)
{
audio_mixer_streams[i].stop_cb = audio_mixer_play_stop_cb;
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING_LOOPED);
}
void audio_driver_mixer_play_stream_sequential(unsigned i)
{
audio_mixer_streams[i].stop_cb = audio_mixer_play_stop_sequential_cb;
audio_driver_mixer_play_stream_internal(i, AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL);
}
float audio_driver_mixer_get_stream_volume(unsigned i)
{
if (i >= AUDIO_MIXER_MAX_STREAMS)
return 0.0f;
return audio_mixer_streams[i].volume;
}
void audio_driver_mixer_set_stream_volume(unsigned i, float vol)
{
audio_mixer_voice_t *voice = NULL;
if (i >= AUDIO_MIXER_MAX_STREAMS)
return;
audio_mixer_streams[i].volume = vol;
voice = audio_mixer_streams[i].voice;
if (voice)
audio_mixer_voice_set_volume(voice, db_to_gain(vol));
}
void audio_driver_mixer_stop_stream(unsigned i)
{
bool set_state = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
return;
switch (audio_mixer_streams[i].state)
{
case AUDIO_STREAM_STATE_PLAYING:
if (voice)
audio_mixer_stop(voice);
if (handle)
audio_mixer_destroy(handle);
break;
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
if (voice)
audio_mixer_stop(voice);
if (handle)
audio_mixer_destroy(handle);
case AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL:
set_state = true;
break;
case AUDIO_STREAM_STATE_STOPPED:
if (handle)
audio_mixer_destroy(handle);
case AUDIO_STREAM_STATE_NONE:
break;
}
if (set_state)
{
audio_mixer_voice_t *voice = audio_mixer_streams[i].voice;
if (voice)
audio_mixer_stop(voice);
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_STOPPED;
audio_mixer_streams[i].volume = 1.0f;
}
}
void audio_driver_mixer_remove_stream(unsigned i)
{
bool destroy = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
return;
switch (audio_mixer_streams[i].state)
{
case AUDIO_STREAM_STATE_PLAYING:
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
case AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL:
audio_driver_mixer_stop_stream(i);
destroy = true;
break;
case AUDIO_STREAM_STATE_STOPPED:
destroy = true;
break;
case AUDIO_STREAM_STATE_NONE:
break;
}
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
if (destroy)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
if (handle)
audio_mixer_destroy(handle);
if (!string_is_empty(audio_mixer_streams[i].name))
free(audio_mixer_streams[i].name);
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
audio_mixer_streams[i].name = NULL;
}
}
static void audio_driver_mixer_deinit(void)
{
unsigned i;
audio_set_bool(AUDIO_ACTION_MIXER, false);
audio_mixer_active = false;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
{
audio_driver_mixer_stop_stream(i);
audio_driver_mixer_remove_stream(i);
}
audio_mixer_current_max_idx = 0;
audio_mixer_done();
}
@@ -1351,15 +1579,6 @@ void audio_set_bool(enum audio_action action, bool val)
}
}
/**
* db_to_gain:
* @db : Decibels.
*
* Converts decibels to voltage gain.
*
* Returns: voltage gain value.
**/
#define db_to_gain(db) (powf(10.0f, (db) / 20.0f))
void audio_set_float(enum audio_action action, float val)
{
+46 -8
View File
@@ -35,6 +35,8 @@ RETRO_BEGIN_DECLS
#define AUDIO_MAX_RATIO 16
#define AUDIO_MIXER_MAX_STREAMS 16
enum audio_action
{
AUDIO_ACTION_NONE = 0,
@@ -46,6 +48,27 @@ enum audio_action
AUDIO_ACTION_MIXER
};
enum audio_mixer_state
{
AUDIO_STREAM_STATE_NONE = 0,
AUDIO_STREAM_STATE_STOPPED,
AUDIO_STREAM_STATE_PLAYING,
AUDIO_STREAM_STATE_PLAYING_LOOPED,
AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL
};
typedef struct audio_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_state state;
float volume;
void *buf;
char *name;
size_t bufsize;
} audio_mixer_stream_t;
typedef struct audio_statistics
{
float average_buffer_saturation;
@@ -137,20 +160,13 @@ typedef struct audio_driver
size_t (*buffer_size)(void *data);
} audio_driver_t;
enum audio_mixer_state
{
AUDIO_STREAM_STATE_NONE = 0,
AUDIO_STREAM_STATE_STOPPED,
AUDIO_STREAM_STATE_PLAYING,
AUDIO_STREAM_STATE_PLAYING_LOOPED
};
typedef struct audio_mixer_stream_params
{
float volume;
enum audio_mixer_type type;
enum audio_mixer_state state;
void *buf;
char *basename;
size_t bufsize;
audio_mixer_stop_cb_t cb;
} audio_mixer_stream_params_t;
@@ -271,10 +287,32 @@ bool audio_driver_deinit(void);
bool audio_driver_init(void);
void audio_driver_menu_sample(void);
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i);
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
void audio_driver_mixer_play_stream(unsigned i);
void audio_driver_mixer_play_stream_sequential(unsigned i);
void audio_driver_mixer_play_stream_looped(unsigned i);
void audio_driver_mixer_stop_stream(unsigned i);
float audio_driver_mixer_get_stream_volume(unsigned i);
void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
void audio_driver_mixer_remove_stream(unsigned i);
enum resampler_quality audio_driver_get_resampler_quality(void);
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
const char *audio_driver_mixer_get_stream_name(unsigned i);
bool compute_audio_buffer_statistics(audio_statistics_t *stats);
extern audio_driver_t audio_rsound;
+66 -406
View File
@@ -301,6 +301,15 @@ int cheats_were_enabled = 0;
Supporting functions.
*****************************************************************************/
#ifndef CHEEVOS_VERBOSE
void cheevos_log(const char *fmt, ...)
{
(void)fmt;
}
#endif
static unsigned size_in_megabytes(unsigned val)
{
return (val * 1024 * 1024);
@@ -310,7 +319,7 @@ static unsigned size_in_megabytes(unsigned val)
static void cheevos_log_url(const char* format, const char* url)
{
#ifdef CHEEVOS_LOG_PASSWORD
RARCH_LOG(format, url);
CHEEVOS_LOG(format, url);
#else
char copy[256];
char* aux = NULL;
@@ -361,340 +370,11 @@ static void cheevos_log_url(const char* format, const char* url)
*aux = 0;
}
RARCH_LOG(format, copy);
CHEEVOS_LOG(format, copy);
#endif
}
#endif
#ifdef CHEEVOS_VERBOSE
static void cheevos_add_char(char** aux, size_t* left, char k)
{
if (*left >= 1)
{
**aux = k;
(*aux)++;
(*left)--;
}
}
static void cheevos_add_string(char** aux, size_t* left, const char* s)
{
size_t len = strlen(s);
if (*left >= len)
{
strcpy(*aux, s);
*aux += len;
*left -= len;
}
}
static void cheevos_add_hex(char** aux, size_t* left, unsigned v)
{
char buffer[32];
snprintf(buffer, sizeof(buffer), "%06x", v);
buffer[sizeof(buffer) - 1] = 0;
cheevos_add_string(aux, left, buffer);
}
static void cheevos_add_uint(char** aux, size_t* left, unsigned v)
{
char buffer[32];
snprintf(buffer, sizeof(buffer), "%u", v);
buffer[sizeof(buffer) - 1] = 0;
cheevos_add_string(aux, left, buffer);
}
static void cheevos_add_int(char** aux, size_t* left, int v)
{
char buffer[32];
snprintf(buffer, sizeof(buffer), "%d", v);
buffer[sizeof(buffer) - 1] = 0;
cheevos_add_string(aux, left, buffer);
}
static void cheevos_log_var(const cheevos_var_t* var)
{
if (!var)
return;
RARCH_LOG("[CHEEVOS]: size: %s\n",
var->size == CHEEVOS_VAR_SIZE_BIT_0 ? "bit 0" :
var->size == CHEEVOS_VAR_SIZE_BIT_1 ? "bit 1" :
var->size == CHEEVOS_VAR_SIZE_BIT_2 ? "bit 2" :
var->size == CHEEVOS_VAR_SIZE_BIT_3 ? "bit 3" :
var->size == CHEEVOS_VAR_SIZE_BIT_4 ? "bit 4" :
var->size == CHEEVOS_VAR_SIZE_BIT_5 ? "bit 5" :
var->size == CHEEVOS_VAR_SIZE_BIT_6 ? "bit 6" :
var->size == CHEEVOS_VAR_SIZE_BIT_7 ? "bit 7" :
var->size == CHEEVOS_VAR_SIZE_NIBBLE_LOWER ? "low nibble" :
var->size == CHEEVOS_VAR_SIZE_NIBBLE_UPPER ? "high nibble" :
var->size == CHEEVOS_VAR_SIZE_EIGHT_BITS ? "byte" :
var->size == CHEEVOS_VAR_SIZE_SIXTEEN_BITS ? "word" :
var->size == CHEEVOS_VAR_SIZE_THIRTYTWO_BITS ? "dword" :
"?"
);
RARCH_LOG("[CHEEVOS]: type: %s\n",
var->type == CHEEVOS_VAR_TYPE_ADDRESS ? "address" :
var->type == CHEEVOS_VAR_TYPE_VALUE_COMP ? "value" :
var->type == CHEEVOS_VAR_TYPE_DELTA_MEM ? "delta" :
var->type == CHEEVOS_VAR_TYPE_DYNAMIC_VAR ? "dynamic" :
"?"
);
RARCH_LOG("[CHEEVOS]: value: %u\n", var->value);
}
static void cheevos_log_cond(const cheevos_cond_t* cond)
{
if (!cond)
return;
RARCH_LOG("[CHEEVOS]: condition %p\n", cond);
RARCH_LOG("[CHEEVOS]: type: %s\n",
cond->type == CHEEVOS_COND_TYPE_STANDARD ? "standard" :
cond->type == CHEEVOS_COND_TYPE_PAUSE_IF ? "pause" :
cond->type == CHEEVOS_COND_TYPE_RESET_IF ? "reset" :
cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE ? "add source" :
cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE ? "sub source" :
cond->type == CHEEVOS_COND_TYPE_ADD_HITS ? "add hits" :
"?"
);
RARCH_LOG("[CHEEVOS]: req_hits: %u\n", cond->req_hits);
RARCH_LOG("[CHEEVOS]: source:\n");
cheevos_log_var(&cond->source);
RARCH_LOG("[CHEEVOS]: op: %s\n",
cond->op == CHEEVOS_COND_OP_EQUALS ? "==" :
cond->op == CHEEVOS_COND_OP_LESS_THAN ? "<" :
cond->op == CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL ? "<=" :
cond->op == CHEEVOS_COND_OP_GREATER_THAN ? ">" :
cond->op == CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL ? ">=" :
cond->op == CHEEVOS_COND_OP_NOT_EQUAL_TO ? "!=" :
"?"
);
RARCH_LOG("[CHEEVOS]: target:\n");
cheevos_log_var(&cond->target);
}
static void cheevos_log_cheevo(const cheevo_t* cheevo,
const cheevos_field_t* memaddr_ud)
{
if (!cheevo || !memaddr_ud)
return;
RARCH_LOG("[CHEEVOS]: cheevo %p\n", cheevo);
RARCH_LOG("[CHEEVOS]: id: %u\n", cheevo->id);
RARCH_LOG("[CHEEVOS]: title: %s\n", cheevo->title);
RARCH_LOG("[CHEEVOS]: desc: %s\n", cheevo->description);
RARCH_LOG("[CHEEVOS]: author: %s\n", cheevo->author);
RARCH_LOG("[CHEEVOS]: badge: %s\n", cheevo->badge);
RARCH_LOG("[CHEEVOS]: points: %u\n", cheevo->points);
RARCH_LOG("[CHEEVOS]: sets: TBD\n");
RARCH_LOG("[CHEEVOS]: memaddr: %.*s\n",
(int)memaddr_ud->length, memaddr_ud->string);
}
static void cheevos_add_var_size(char** aux, size_t* left,
const cheevos_var_t* var)
{
if (!var)
return;
switch( var->size )
{
case CHEEVOS_VAR_SIZE_BIT_0:
cheevos_add_char(aux, left, 'M');
break;
case CHEEVOS_VAR_SIZE_BIT_1:
cheevos_add_char(aux, left, 'N');
break;
case CHEEVOS_VAR_SIZE_BIT_2:
cheevos_add_char(aux, left, 'O');
break;
case CHEEVOS_VAR_SIZE_BIT_3:
cheevos_add_char(aux, left, 'P');
break;
case CHEEVOS_VAR_SIZE_BIT_4:
cheevos_add_char(aux, left, 'Q');
break;
case CHEEVOS_VAR_SIZE_BIT_5:
cheevos_add_char(aux, left, 'R');
break;
case CHEEVOS_VAR_SIZE_BIT_6:
cheevos_add_char(aux, left, 'S');
break;
case CHEEVOS_VAR_SIZE_BIT_7:
cheevos_add_char(aux, left, 'T');
break;
case CHEEVOS_VAR_SIZE_NIBBLE_LOWER:
cheevos_add_char(aux, left, 'L');
break;
case CHEEVOS_VAR_SIZE_NIBBLE_UPPER:
cheevos_add_char(aux, left, 'U');
break;
case CHEEVOS_VAR_SIZE_EIGHT_BITS:
cheevos_add_char(aux, left, 'H');
break;
case CHEEVOS_VAR_SIZE_THIRTYTWO_BITS:
cheevos_add_char(aux, left, 'X');
break;
case CHEEVOS_VAR_SIZE_SIXTEEN_BITS:
default:
cheevos_add_char(aux, left, ' ');
break;
}
}
static void cheevos_add_var(const cheevos_var_t* var, char** memaddr,
size_t *left)
{
if (!var)
return;
if ( var->type == CHEEVOS_VAR_TYPE_ADDRESS
|| var->type == CHEEVOS_VAR_TYPE_DELTA_MEM)
{
if (var->type == CHEEVOS_VAR_TYPE_DELTA_MEM)
cheevos_add_char(memaddr, left, 'd');
else if (var->is_bcd)
cheevos_add_char(memaddr, left, 'b');
cheevos_add_string(memaddr, left, "0x");
cheevos_add_var_size(memaddr, left, var);
cheevos_add_hex(memaddr, left, var->value);
}
else if (var->type == CHEEVOS_VAR_TYPE_VALUE_COMP)
{
cheevos_add_uint(memaddr, left, var->value);
}
}
static void cheevos_build_memaddr(const cheevos_condition_t* condition,
char* memaddr, size_t left)
{
size_t i, j;
const cheevos_cond_t* cond;
const cheevos_condset_t *condset;
char *aux = memaddr;
left--; /* reserve one char for the null terminator */
for (i = 0, condset = condition->condsets;
i < condition->count; i++, condset++)
{
if (i != 0)
cheevos_add_char(&aux, &left, 'S');
for (j = 0, cond = condset->conds;
j < condset->count; j++, cond++)
{
if (j != 0)
cheevos_add_char(&aux, &left, '_');
if (cond->type == CHEEVOS_COND_TYPE_RESET_IF)
cheevos_add_string(&aux, &left, "R:");
else if (cond->type == CHEEVOS_COND_TYPE_PAUSE_IF)
cheevos_add_string(&aux, &left, "P:");
else if (cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE)
cheevos_add_string(&aux, &left, "A:");
else if (cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE)
cheevos_add_string(&aux, &left, "B:");
else if (cond->type == CHEEVOS_COND_TYPE_ADD_HITS)
cheevos_add_string(&aux, &left, "C:");
cheevos_add_var(&cond->source, &aux, &left);
switch (cond->op)
{
case CHEEVOS_COND_OP_EQUALS:
cheevos_add_char(&aux, &left, '=');
break;
case CHEEVOS_COND_OP_GREATER_THAN:
cheevos_add_char(&aux, &left, '>');
break;
case CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL:
cheevos_add_string(&aux, &left, ">=");
break;
case CHEEVOS_COND_OP_LESS_THAN:
cheevos_add_char(&aux, &left, '<');
break;
case CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL:
cheevos_add_string(&aux, &left, "<=");
break;
case CHEEVOS_COND_OP_NOT_EQUAL_TO:
cheevos_add_string(&aux, &left, "!=");
break;
}
cheevos_add_var(&cond->target, &aux, &left);
if (cond->req_hits > 0)
{
cheevos_add_char(&aux, &left, '.');
cheevos_add_uint(&aux, &left, cond->req_hits);
cheevos_add_char(&aux, &left, '.');
}
}
}
*aux = 0;
}
static void cheevos_post_log_cheevo(const cheevo_t* cheevo)
{
char memaddr[256];
if (!cheevo)
return;
cheevos_build_memaddr(&cheevo->condition, memaddr, sizeof(memaddr));
RARCH_LOG("[CHEEVOS]: memaddr (computed): %s\n", memaddr);
}
static void cheevos_log_lboard(const cheevos_leaderboard_t* lb)
{
unsigned i;
char mem[256];
char* aux = NULL;
size_t left = 0;
if (!lb)
return;
RARCH_LOG("[CHEEVOS]: leaderboard %p\n", lb);
RARCH_LOG("[CHEEVOS]: id: %u\n", lb->id);
RARCH_LOG("[CHEEVOS]: title: %s\n", lb->title);
RARCH_LOG("[CHEEVOS]: desc: %s\n", lb->description);
cheevos_build_memaddr(&lb->start, mem, sizeof(mem));
RARCH_LOG("[CHEEVOS]: start: %s\n", mem);
cheevos_build_memaddr(&lb->cancel, mem, sizeof(mem));
RARCH_LOG("[CHEEVOS]: cancel: %s\n", mem);
cheevos_build_memaddr(&lb->submit, mem, sizeof(mem));
RARCH_LOG("[CHEEVOS]: submit: %s\n", mem);
left = sizeof(mem);
aux = mem;
for (i = 0; i < lb->value.count; i++)
{
if (i != 0)
cheevos_add_char(&aux, &left, '_');
cheevos_add_var(&lb->value.terms[i].var, &aux, &left);
cheevos_add_char(&aux, &left, '*');
cheevos_add_int(&aux, &left, lb->value.terms[i].multiplier);
}
RARCH_LOG("[CHEEVOS]: value: %s\n", mem);
}
#endif
static uint32_t cheevos_djb2(const char* str, size_t length)
{
const unsigned char *aux = (const unsigned char*)str;
@@ -964,10 +644,8 @@ static int cheevos_parse_condition(
cheevos_cond_count_in_set(memaddr, set);
condset->conds = NULL;
#ifdef CHEEVOS_VERBOSE
RARCH_LOG("[CHEEVOS]: set %p (index=%u)\n", condset, set);
RARCH_LOG("[CHEEVOS]: conds: %u\n", condset->count);
#endif
CHEEVOS_LOG("[CHEEVOS]: set %p (index=%u)\n", condset, set);
CHEEVOS_LOG("[CHEEVOS]: conds: %u\n", condset->count);
if (condset->count)
{
@@ -1218,17 +896,9 @@ static int cheevos_new_cheevo(cheevos_readud_t *ud)
!cheevo->badge)
goto error;
#ifdef CHEEVOS_VERBOSE
cheevos_log_cheevo(cheevo, &ud->memaddr);
#endif
if (cheevos_parse_condition(&cheevo->condition, ud->memaddr.string))
goto error;
#ifdef CHEEVOS_VERBOSE
cheevos_post_log_cheevo(cheevo);
#endif
return 0;
error:
@@ -1350,10 +1020,6 @@ static int cheevos_new_lboard(cheevos_readud_t *ud)
if (cheevos_parse_mem(lboard, ud->memaddr.string))
goto error;
#ifdef CHEEVOS_VERBOSE
cheevos_log_lboard(lboard);
#endif
return 0;
error:
@@ -1896,14 +1562,14 @@ static void cheevos_unlocked(void *task_data, void *user_data,
if (!error)
{
RARCH_LOG("[CHEEVOS]: awarded achievement %u.\n", cheevo->id);
CHEEVOS_LOG("[CHEEVOS]: awarded achievement %u.\n", cheevo->id);
}
else
{
char url[256];
url[0] = '\0';
RARCH_ERR("[CHEEVOS]: error awarding achievement %u, retrying...\n", cheevo->id);
CHEEVOS_ERR("[CHEEVOS]: error awarding achievement %u, retrying...\n", cheevo->id);
cheevos_make_unlock_url(cheevo, url, sizeof(url));
task_push_http_transfer(url, true, NULL, cheevos_unlocked, cheevo);
@@ -1951,7 +1617,7 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
if (mode == CHEEVOS_ACTIVE_HARDCORE)
cheevo->active &= ~CHEEVOS_ACTIVE_SOFTCORE;
RARCH_LOG("[CHEEVOS]: awarding cheevo %u: %s (%s).\n",
CHEEVOS_LOG("[CHEEVOS]: awarding cheevo %u: %s (%s).\n",
cheevo->id, cheevo->title, cheevo->description);
snprintf(msg, sizeof(msg), "Achievement Unlocked: %s",
@@ -1976,9 +1642,9 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
if (take_screenshot(shotname, true,
video_driver_cached_frame_has_valid_framebuffer()))
RARCH_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id);
CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id);
else
RARCH_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id);
CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id);
}
}
@@ -2044,7 +1710,7 @@ static int cheevos_expr_value(cheevos_expr_t* expr)
if (expr->compare_count >= ARRAY_SIZE(values))
{
RARCH_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", expr->compare_count);
CHEEVOS_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", expr->compare_count);
return 0;
}
@@ -2054,7 +1720,7 @@ static int cheevos_expr_value(cheevos_expr_t* expr)
{
if (current_value >= ARRAY_SIZE(values))
{
RARCH_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", current_value);
CHEEVOS_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", current_value);
return 0;
}
@@ -2128,11 +1794,11 @@ static void cheevos_lboard_submit(void *task_data, void *user_data,
if (!error)
{
RARCH_ERR("[CHEEVOS]: error submitting leaderboard %u\n", lboard->id);
CHEEVOS_ERR("[CHEEVOS]: error submitting leaderboard %u\n", lboard->id);
return;
}
RARCH_LOG("[CHEEVOS]: submitted leaderboard %u.\n", lboard->id);
CHEEVOS_LOG("[CHEEVOS]: submitted leaderboard %u.\n", lboard->id);
}
static void cheevos_test_leaderboards(void)
@@ -2151,10 +1817,8 @@ static void cheevos_test_leaderboards(void)
if (value != lboard->last_value)
{
#ifdef CHEEVOS_VERBOSE
RARCH_LOG("[CHEEVOS]: value lboard %s %u\n",
CHEEVOS_LOG("[CHEEVOS]: value lboard %s %u\n",
lboard->title, value);
#endif
lboard->last_value = value;
}
@@ -2165,7 +1829,7 @@ static void cheevos_test_leaderboards(void)
/* failsafe for improper LBs */
if (value == 0)
{
RARCH_LOG("[CHEEVOS]: error: lboard %s tried to submit 0\n",
CHEEVOS_LOG("[CHEEVOS]: error: lboard %s tried to submit 0\n",
lboard->title);
runloop_msg_queue_push("Leaderboard attempt cancelled!",
0, 2 * 60, false);
@@ -2179,7 +1843,7 @@ static void cheevos_test_leaderboards(void)
cheevos_make_lboard_url(lboard, url, sizeof(url));
task_push_http_transfer(url, true, NULL,
cheevos_lboard_submit, lboard);
RARCH_LOG("[CHEEVOS]: submit lboard %s\n", lboard->title);
CHEEVOS_LOG("[CHEEVOS]: submit lboard %s\n", lboard->title);
cheevos_format_value(value, lboard->format,
formatted_value, sizeof(formatted_value));
@@ -2192,7 +1856,7 @@ static void cheevos_test_leaderboards(void)
if (cheevos_test_lboard_condition(&lboard->cancel))
{
RARCH_LOG("[CHEEVOS]: cancel lboard %s\n", lboard->title);
CHEEVOS_LOG("[CHEEVOS]: cancel lboard %s\n", lboard->title);
lboard->active = 0;
runloop_msg_queue_push("Leaderboard attempt cancelled!",
0, 2 * 60, false);
@@ -2204,7 +1868,7 @@ static void cheevos_test_leaderboards(void)
{
char msg[256];
RARCH_LOG("[CHEEVOS]: start lboard %s\n", lboard->title);
CHEEVOS_LOG("[CHEEVOS]: start lboard %s\n", lboard->title);
lboard->active = 1;
lboard->last_value = -1;
@@ -2317,10 +1981,10 @@ static int cheevos_deactivate__json_number(void *userdata,
}
if (found)
RARCH_LOG("[CHEEVOS]: deactivated unlocked cheevo %u (%s).\n",
CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked cheevo %u (%s).\n",
cheevo->id, cheevo->title);
else
RARCH_ERR("[CHEEVOS]: unknown cheevo to deactivate: %u.\n", id);
CHEEVOS_ERR("[CHEEVOS]: unknown cheevo to deactivate: %u.\n", id);
}
return 0;
@@ -2516,9 +2180,7 @@ bool cheevos_unload(void)
if (running)
{
#ifdef CHEEVOS_VERBOSE
RARCH_LOG("[CHEEVOS]: Asked the load thread to terminate\n");
#endif
CHEEVOS_LOG("[CHEEVOS]: Asked the load thread to terminate\n");
task_queue_cancel_task(cheevos_locals.task);
#ifdef HAVE_THREADS
@@ -2568,7 +2230,7 @@ bool cheevos_toggle_hardcore_mode(void)
if (settings->bools.rewind_enable)
command_event(CMD_EVENT_REWIND_DEINIT, NULL);
RARCH_LOG("%s\n", msg);
CHEEVOS_LOG("%s\n", msg);
runloop_msg_queue_push(msg, 0, 3 * 60, true);
}
else
@@ -2612,7 +2274,7 @@ static void cheevos_patch_addresses(cheevoset_t* set)
cheevos_var_patch_addr(&cond->source,
cheevos_locals.console_id);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("[CHEEVOS]: s-var %03d:%08X\n",
CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n",
cond->source.bank_id + 1, cond->source.value);
#endif
break;
@@ -2628,7 +2290,7 @@ static void cheevos_patch_addresses(cheevoset_t* set)
cheevos_var_patch_addr(&cond->target,
cheevos_locals.console_id);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("[CHEEVOS]: t-var %03d:%08X\n",
CHEEVOS_LOG("[CHEEVOS]: t-var %03d:%08X\n",
cond->target.bank_id + 1, cond->target.value);
#endif
break;
@@ -2665,7 +2327,7 @@ static void cheevos_patch_lb_conditions(cheevos_condition_t* condition)
cheevos_var_patch_addr(&cond->source,
cheevos_locals.console_id);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("[CHEEVOS]: s-var %03d:%08X\n",
CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n",
cond->source.bank_id + 1, cond->source.value);
#endif
break;
@@ -2679,7 +2341,7 @@ static void cheevos_patch_lb_conditions(cheevos_condition_t* condition)
cheevos_var_patch_addr(&cond->target,
cheevos_locals.console_id);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("[CHEEVOS]: t-var %03d:%08X\n",
CHEEVOS_LOG("[CHEEVOS]: t-var %03d:%08X\n",
cond->target.bank_id + 1, cond->target.value);
#endif
break;
@@ -2708,7 +2370,7 @@ static void cheevos_patch_lb_expressions(cheevos_expr_t* expression)
case CHEEVOS_VAR_TYPE_DELTA_MEM:
cheevos_var_patch_addr(&term->var, cheevos_locals.console_id);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("[CHEEVOS]: s-var %03d:%08X\n",
CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n",
term->var.bank_id + 1, term->var.value);
#endif
break;
@@ -2927,16 +2589,16 @@ static int cheevos_iterate(coro_t *coro)
cheevos_locals.meminfo[3].id = RETRO_MEMORY_RTC;
core_get_memory(&cheevos_locals.meminfo[3]);
RARCH_LOG("[CHEEVOS]: system RAM: %p %u\n",
CHEEVOS_LOG("[CHEEVOS]: system RAM: %p %u\n",
cheevos_locals.meminfo[0].data,
cheevos_locals.meminfo[0].size);
RARCH_LOG("[CHEEVOS]: save RAM: %p %u\n",
CHEEVOS_LOG("[CHEEVOS]: save RAM: %p %u\n",
cheevos_locals.meminfo[1].data,
cheevos_locals.meminfo[1].size);
RARCH_LOG("[CHEEVOS]: video RAM: %p %u\n",
CHEEVOS_LOG("[CHEEVOS]: video RAM: %p %u\n",
cheevos_locals.meminfo[2].data,
cheevos_locals.meminfo[2].size);
RARCH_LOG("[CHEEVOS]: RTC: %p %u\n",
CHEEVOS_LOG("[CHEEVOS]: RTC: %p %u\n",
cheevos_locals.meminfo[3].data,
cheevos_locals.meminfo[3].size);
@@ -3034,7 +2696,7 @@ static int cheevos_iterate(coro_t *coro)
{
if (finders[coro->i].ext_hashes[coro->j] == hash)
{
RARCH_LOG("[CHEEVOS]: testing %s.\n",
CHEEVOS_LOG("[CHEEVOS]: testing %s.\n",
finders[coro->i].name);
/*
@@ -3059,7 +2721,7 @@ static int cheevos_iterate(coro_t *coro)
if (finders[coro->i].ext_hashes)
continue;
RARCH_LOG("[CHEEVOS]: testing %s.\n",
CHEEVOS_LOG("[CHEEVOS]: testing %s.\n",
finders[coro->i].name);
/*
@@ -3072,7 +2734,7 @@ static int cheevos_iterate(coro_t *coro)
goto found;
}
RARCH_LOG("[CHEEVOS]: this game doesn't feature achievements.\n");
CHEEVOS_LOG("[CHEEVOS]: this game doesn't feature achievements.\n");
CORO_STOP();
found:
@@ -3098,7 +2760,7 @@ found:
if (!coro->json)
{
runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false);
RARCH_ERR("[CHEEVOS]: error loading achievements.\n");
CHEEVOS_ERR("[CHEEVOS]: error loading achievements.\n");
CORO_STOP();
}
#endif
@@ -3428,7 +3090,7 @@ found:
{
char gameid[16];
RARCH_LOG(
CHEEVOS_LOG(
"[CHEEVOS]: getting game id for hash %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
coro->hash[ 0], coro->hash[ 1], coro->hash[ 2], coro->hash[ 3],
coro->hash[ 4], coro->hash[ 5], coro->hash[ 6], coro->hash[ 7],
@@ -3461,13 +3123,13 @@ found:
{
if ((void*)coro->json)
free((void*)coro->json);
RARCH_ERR("[CHEEVOS]: error getting game_id.\n");
CHEEVOS_ERR("[CHEEVOS]: error getting game_id.\n");
CORO_RET();
}
if ((void*)coro->json)
free((void*)coro->json);
RARCH_LOG("[CHEEVOS]: got game id %s.\n", gameid);
CHEEVOS_LOG("[CHEEVOS]: got game id %s.\n", gameid);
coro->gameid = (unsigned)strtol(gameid, NULL, 10);
CORO_RET();
}
@@ -3497,11 +3159,11 @@ found:
if (!coro->json)
{
RARCH_ERR("[CHEEVOS]: error getting achievements for game id %u.\n", coro->gameid);
CHEEVOS_ERR("[CHEEVOS]: error getting achievements for game id %u.\n", coro->gameid);
CORO_STOP();
}
RARCH_LOG("[CHEEVOS]: got achievements for game id %u.\n", coro->gameid);
CHEEVOS_LOG("[CHEEVOS]: got achievements for game id %u.\n", coro->gameid);
CORO_RET();
/**************************************************************************
@@ -3554,7 +3216,7 @@ found:
if (!badge_exists(coro->badge_fullpath))
{
#ifdef CHEEVOS_LOG_BADGES
RARCH_LOG(
CHEEVOS_LOG(
"[CHEEVOS]: downloading badge %s\n",
coro->badge_fullpath);
#endif
@@ -3569,7 +3231,7 @@ found:
{
if (!filestream_write_file(coro->badge_fullpath,
coro->json, coro->k))
RARCH_ERR("[CHEEVOS]: error writing badge %s\n", coro->badge_fullpath);
CHEEVOS_ERR("[CHEEVOS]: error writing badge %s\n", coro->badge_fullpath);
else
free(coro->json);
}
@@ -3618,7 +3280,7 @@ found:
runloop_msg_queue_push(
"Please fill in your account information in Settings.",
0, 5 * 60, false);
RARCH_ERR("[CHEEVOS]: login info not informed.\n");
CHEEVOS_ERR("[CHEEVOS]: login info not informed.\n");
CORO_STOP();
}
@@ -3702,7 +3364,7 @@ found:
}
runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false);
RARCH_ERR("[CHEEVOS]: error getting user token.\n");
CHEEVOS_ERR("[CHEEVOS]: error getting user token.\n");
CORO_STOP();
@@ -3734,7 +3396,7 @@ found:
for (coro->k = 0; coro->k < 5; coro->k++)
{
if (coro->k != 0)
RARCH_LOG("[CHEEVOS]: Retrying HTTP request: %u of 5\n", coro->k + 1);
CHEEVOS_LOG("[CHEEVOS]: Retrying HTTP request: %u of 5\n", coro->k + 1);
coro->json = NULL;
coro->conn = net_http_connection_new(
@@ -3796,7 +3458,7 @@ found:
net_http_connection_free(coro->conn);
}
RARCH_LOG("[CHEEVOS]: Couldn't connect to server after 5 tries\n");
CHEEVOS_LOG("[CHEEVOS]: Couldn't connect to server after 5 tries\n");
CORO_RET();
/**************************************************************************
@@ -3828,15 +3490,15 @@ found:
if (coro->json)
{
if (!cheevos_deactivate_unlocks(coro->json, CHEEVOS_ACTIVE_SOFTCORE))
RARCH_LOG("[CHEEVOS]: deactivated unlocked achievements in softcore mode.\n");
CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked achievements in softcore mode.\n");
else
RARCH_ERR("[CHEEVOS]: error deactivating unlocked achievements in softcore mode.\n");
CHEEVOS_ERR("[CHEEVOS]: error deactivating unlocked achievements in softcore mode.\n");
if ((void*)coro->json)
free((void*)coro->json);
}
else
RARCH_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in softcore mode.\n");
CHEEVOS_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in softcore mode.\n");
/* Deactivate achievements in hardcore mode. */
snprintf(
@@ -3857,15 +3519,15 @@ found:
if (coro->json)
{
if (!cheevos_deactivate_unlocks(coro->json, CHEEVOS_ACTIVE_HARDCORE))
RARCH_LOG("[CHEEVOS]: deactivated unlocked achievements in hardcore mode.\n");
CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked achievements in hardcore mode.\n");
else
RARCH_ERR("[CHEEVOS]: error deactivating unlocked achievements in hardcore mode.\n");
CHEEVOS_ERR("[CHEEVOS]: error deactivating unlocked achievements in hardcore mode.\n");
if ((void*)coro->json)
free((void*)coro->json);
}
else
RARCH_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in hardcore mode.\n");
CHEEVOS_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in hardcore mode.\n");
#endif
CORO_RET();
@@ -3894,14 +3556,14 @@ found:
if (coro->json)
{
RARCH_LOG("[CHEEVOS]: posted playing activity.\n");
CHEEVOS_LOG("[CHEEVOS]: posted playing activity.\n");
if ((void*)coro->json)
free((void*)coro->json);
}
else
RARCH_ERR("[CHEEVOS]: error posting playing activity.\n");
CHEEVOS_ERR("[CHEEVOS]: error posting playing activity.\n");
RARCH_LOG("[CHEEVOS]: posted playing activity.\n");
CHEEVOS_LOG("[CHEEVOS]: posted playing activity.\n");
CORO_RET();
CORO_LEAVE();
@@ -3922,16 +3584,14 @@ static void cheevos_task_handler(retro_task_t *task)
cheevos_locals.task = NULL;
CHEEVOS_UNLOCK(cheevos_locals.task_lock);
#ifdef CHEEVOS_VERBOSE
if (task_get_cancelled(task))
{
RARCH_LOG("[CHEEVOS]: Load task cancelled\n");
CHEEVOS_LOG("[CHEEVOS]: Load task cancelled\n");
}
else
{
RARCH_LOG("[CHEEVOS]: Load task finished\n");
CHEEVOS_LOG("[CHEEVOS]: Load task finished\n");
}
#endif
if (coro->data)
free(coro->data);
+14
View File
@@ -38,6 +38,20 @@ End of setup
#define CHEEVOS_TAG "[CHEEVOS]: "
#ifdef CHEEVOS_VERBOSE
#define CHEEVOS_LOG RARCH_LOG
#define CHEEVOS_ERR RARCH_ERR
#else
void cheevos_log(const char *fmt, ...);
#define CHEEVOS_LOG cheevos_log
#define CHEEVOS_ERR cheevos_log
#endif
typedef struct cheevos_ctx_desc
{
unsigned idx;
+1 -4
View File
@@ -65,7 +65,7 @@ static cheevos_cond_op_t cheevos_cond_parse_operator(const char** memaddr)
}
else
{
RARCH_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str);
CHEEVOS_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str);
op = CHEEVOS_COND_OP_EQUALS;
}
@@ -168,9 +168,6 @@ void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsign
if (index == which)
{
cheevos_cond_parse(cond, &memaddr);
#ifdef CHEEVOS_VERBOSE
/*cheevos_log_cond(cond);*/
#endif
cond++;
}
else
+1 -12
View File
@@ -24,17 +24,6 @@
#include "../core.h"
#include "../verbosity.h"
static void STUB_LOG(const char *fmt, ...)
{
(void)fmt;
}
#ifdef CHEEVOS_VERBOSE
#define CHEEVOS_LOG RARCH_LOG
#else
#define CHEEVOS_LOG STUB_LOG
#endif
/*****************************************************************************
Parsing
*****************************************************************************/
@@ -327,7 +316,7 @@ uint8_t* cheevos_var_get_memory(const cheevos_var_t* var)
meminfo.id = RETRO_MEMORY_RTC;
break;
default:
RARCH_ERR(CHEEVOS_TAG "invalid bank id: %s\n", var->bank_id);
CHEEVOS_ERR(CHEEVOS_TAG "invalid bank id: %s\n", var->bank_id);
break;
}
+25 -12
View File
@@ -169,6 +169,7 @@ static const struct cmd_map map[] = {
{ "DISK_NEXT", RARCH_DISK_NEXT },
{ "DISK_PREV", RARCH_DISK_PREV },
{ "GRAB_MOUSE_TOGGLE", RARCH_GRAB_MOUSE_TOGGLE },
{ "UI_COMPANION_TOGGLE", RARCH_UI_COMPANION_TOGGLE },
{ "GAME_FOCUS_TOGGLE", RARCH_GAME_FOCUS_TOGGLE },
{ "MENU_TOGGLE", RARCH_MENU_TOGGLE },
{ "MENU_UP", RETRO_DEVICE_ID_JOYPAD_UP },
@@ -1015,7 +1016,7 @@ static void command_event_init_controllers(void)
/* Ideally these checks shouldn't be required but if we always
* call core_set_controller_port_device input won't work on
* cores that don't set port information properly */
if (info && info->ports.size != 0 && i < info->ports.size)
if (info && info->ports.size != 0)
set_controller = true;
break;
default:
@@ -1029,7 +1030,7 @@ static void command_event_init_controllers(void)
break;
}
if (set_controller)
if (set_controller && i < info->ports.size)
{
pad.device = device;
pad.port = i;
@@ -1705,7 +1706,7 @@ void command_playlist_update_write(
const char *core_path,
const char *core_display_name,
const char *crc32,
const char *db_name)
const char *db_name)
{
playlist_t *plist = (playlist_t*)data;
playlist_t *playlist = plist ? plist : playlist_get_cached();
@@ -1787,10 +1788,11 @@ bool command_event(enum event_command cmd, void *data)
return false;
#endif
libretro_get_system_info(
if (!libretro_get_system_info(
core_path,
system,
&system_info->load_no_content);
&system_info->load_no_content))
return false;
info_find.path = core_path;
if (!core_info_load(&info_find))
@@ -1803,11 +1805,17 @@ bool command_event(enum event_command cmd, void *data)
}
break;
case CMD_EVENT_LOAD_CORE:
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
{
bool success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
#ifndef HAVE_DYNAMIC
command_event(CMD_EVENT_QUIT, NULL);
#else
if (!success)
return false;
#endif
break;
}
case CMD_EVENT_LOAD_STATE:
/* Immutable - disallow savestate load when
* we absolutely cannot change game state. */
@@ -1925,7 +1933,7 @@ bool command_event(enum event_command cmd, void *data)
cheevos_toggle_hardcore_mode();
#endif
break;
/* this fallthrough is on purpose, it should do
/* this fallthrough is on purpose, it should do
a CMD_EVENT_REINIT too */
case CMD_EVENT_REINIT_FROM_TOGGLE:
retroarch_unset_forced_fullscreen();
@@ -2010,7 +2018,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_AUTOSAVE_INIT:
command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL);
#ifdef HAVE_THREADS
{
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
@@ -2024,7 +2032,7 @@ TODO: Add a setting for these tweaks */
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
}
}
}
#endif
break;
case CMD_EVENT_AUTOSAVE_STATE:
@@ -2306,7 +2314,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_RESUME:
rarch_menu_running_finished();
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
ui_companion_driver_toggle(false);
break;
case CMD_EVENT_ADD_TO_FAVORITES:
{
@@ -2355,7 +2363,7 @@ TODO: Add a setting for these tweaks */
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true);
break;
}
}
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;
@@ -2577,7 +2585,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_FULLSCREEN_TOGGLE:
{
settings_t *settings = config_get_ptr();
bool new_fullscreen_state = !settings->bools.video_fullscreen
bool new_fullscreen_state = !settings->bools.video_fullscreen
&& !retroarch_is_forced_fullscreen();
if (!video_driver_has_windowed())
return false;
@@ -2736,6 +2744,11 @@ TODO: Add a setting for these tweaks */
video_driver_show_mouse();
}
break;
case CMD_EVENT_UI_COMPANION_TOGGLE:
{
ui_companion_driver_toggle(true);
break;
}
case CMD_EVENT_GAME_FOCUS_TOGGLE:
{
static bool game_focus_state = false;
+4 -2
View File
@@ -139,7 +139,7 @@ enum event_command
/* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES,
/* Reset playlist entry associated core to DETECT */
CMD_EVENT_RESET_CORE_ASSOCIATION,
CMD_EVENT_RESET_CORE_ASSOCIATION,
/* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */
@@ -218,6 +218,8 @@ enum event_command
CMD_EVENT_GRAB_MOUSE_TOGGLE,
/* Toggles game focus. */
CMD_EVENT_GAME_FOCUS_TOGGLE,
/* Toggles desktop menu. */
CMD_EVENT_UI_COMPANION_TOGGLE,
/* Toggles fullscreen mode. */
CMD_EVENT_FULLSCREEN_TOGGLE,
CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG,
@@ -271,7 +273,7 @@ void command_playlist_push_write(
void command_playlist_update_write(
void *data,
size_t idx,
const char *path,
const char *path,
const char *label,
const char *core_path,
const char *core_display_name,
+6
View File
@@ -670,6 +670,12 @@ static const bool ui_companion_start_on_boot = true;
static const bool ui_companion_enable = false;
/* Currently only used to show the WIMP UI on startup */
static const bool ui_companion_toggle = false;
/* Only init the WIMP UI for this session if this is enabled */
static const bool desktop_menu_enable = true;
#if defined(__QNX__) || defined(_XBOX1) || defined(_XBOX360) || defined(__CELLOS_LV2__) || (defined(__MACH__) && defined(IOS)) || defined(ANDROID) || defined(WIIU) || defined(HAVE_NEON) || defined(GEKKO) || defined(__ARM_NEON__)
static enum resampler_quality audio_resampler_quality_level = RESAMPLER_QUALITY_LOWER;
#elif defined(PSP) || defined(_3DS) || defined(VITA)
+2
View File
@@ -97,6 +97,7 @@ static const struct retro_keybind retro_keybinds_1[] = {
{ true, RARCH_DISK_PREV, MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GRAB_MOUSE_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GAME_FOCUS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_UI_COMPANION_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_MENU_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, RETROK_SPACE, NO_BTN, NO_BTN, 0, AXIS_NONE },
#else
{ true, RETRO_DEVICE_ID_JOYPAD_B, MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, RETROK_z, NO_BTN, NO_BTN, 0, AXIS_NONE },
@@ -172,6 +173,7 @@ static const struct retro_keybind retro_keybinds_1[] = {
{ true, RARCH_DISK_PREV, MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GRAB_MOUSE_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, RETROK_F11, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_GAME_FOCUS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, RETROK_SCROLLOCK, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_UI_COMPANION_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, RETROK_F5, NO_BTN, NO_BTN, 0, AXIS_NONE },
{ true, RARCH_MENU_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, RETROK_F1, NO_BTN, NO_BTN, 0, AXIS_NONE },
#endif
};
+8 -5
View File
@@ -1180,6 +1180,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("automatically_add_content_to_playlist", &settings->bools.automatically_add_content_to_playlist, true, automatically_add_content_to_playlist, false);
SETTING_BOOL("ui_companion_start_on_boot", &settings->bools.ui_companion_start_on_boot, true, ui_companion_start_on_boot, false);
SETTING_BOOL("ui_companion_enable", &settings->bools.ui_companion_enable, true, ui_companion_enable, false);
SETTING_BOOL("ui_companion_toggle", &settings->bools.ui_companion_toggle, false, ui_companion_toggle, false);
SETTING_BOOL("desktop_menu_enable", &settings->bools.desktop_menu_enable, true, desktop_menu_enable, false);
SETTING_BOOL("video_gpu_record", &settings->bools.video_gpu_record, true, gpu_record, false);
SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false);
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, all_users_control_menu, false);
@@ -1253,6 +1255,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("keyboard_gamepad_enable", &settings->bools.input_keyboard_gamepad_enable, true, true, false);
SETTING_BOOL("core_set_supports_no_game_enable", &settings->bools.set_supports_no_game_enable, true, true, false);
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, audio_enable, false);
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, false, false);
SETTING_BOOL("audio_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE), true, false, false);
SETTING_BOOL("audio_mixer_mute_enable", audio_get_bool_ptr(AUDIO_ACTION_MIXER_MUTE_ENABLE), true, false, false);
SETTING_BOOL("location_allow", &settings->bools.location_allow, true, false, false);
@@ -3525,14 +3528,14 @@ static void save_keybind_mbutton(config_file_t *conf,
const char *base,
const struct retro_keybind *bind, bool save_empty)
{
char key[64];
char key[64];
key[0] = '\0';
key[0] = '\0';
fill_pathname_join_delim_concat(key, prefix,
base, '_', "_mbtn", sizeof(key));
fill_pathname_join_delim_concat(key, prefix,
base, '_', "_mbtn", sizeof(key));
switch ( bind->mbutton )
switch ( bind->mbutton )
{
case RETRO_DEVICE_ID_MOUSE_LEFT:
config_set_uint64(conf, key, 1);
+3
View File
@@ -99,6 +99,7 @@ typedef struct settings
/* Audio */
bool audio_enable;
bool audio_enable_menu;
bool audio_sync;
bool audio_rate_control;
bool audio_wasapi_exclusive_mode;
@@ -197,6 +198,8 @@ typedef struct settings
bool ui_suspend_screensaver_enable;
bool ui_companion_start_on_boot;
bool ui_companion_enable;
bool ui_companion_toggle;
bool desktop_menu_enable;
/* Cheevos */
bool cheevos_enable;
+8
View File
@@ -151,6 +151,7 @@ static void core_info_list_free(core_info_list_t *core_info_list)
free(info->systemname);
free(info->system_manufacturer);
free(info->display_name);
free(info->display_version);
free(info->supported_extensions);
free(info->authors);
free(info->permissions);
@@ -278,6 +279,13 @@ static core_info_list_t *core_info_list_new(const char *path,
free(tmp);
tmp = NULL;
}
if (config_get_string(conf, "display_version", &tmp)
&& !string_is_empty(tmp))
{
core_info[i].display_version = strdup(tmp);
free(tmp);
tmp = NULL;
}
if (config_get_string(conf, "corename", &tmp)
&& !string_is_empty(tmp))
{
+1
View File
@@ -43,6 +43,7 @@ typedef struct
char *path;
void *config_data;
char *display_name;
char *display_version;
char *core_name;
char *system_manufacturer;
char *systemname;
+5461
View File
File diff suppressed because it is too large. Load diff
+2745
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -34,7 +34,7 @@
# include <config.h>
#endif
#include "private/bitmath.h"
#include "include/private/bitmath.h"
/* An example of what FLAC__bitmath_silog2() computes:
*
+7 -7
View File
@@ -38,13 +38,13 @@
#include <stdlib.h>
#include <string.h>
#include "private/bitmath.h"
#include "private/bitreader.h"
#include "private/crc.h"
#include "private/macros.h"
#include "FLAC/assert.h"
#include "share/compat.h"
#include "share/endswap.h"
#include "include/private/bitmath.h"
#include "include/private/bitreader.h"
#include "include/private/crc.h"
#include "include/private/macros.h"
#include "include/FLAC/assert.h"
#include "include/share/compat.h"
#include "include/share/endswap.h"
/* Things should be fastest when this matches the machine word size */
/* WATCHOUT: if you change this you must also change the following #defines down to COUNT_ZERO_MSBS2 below to match */
+4 -3
View File
@@ -34,11 +34,12 @@
# include <config.h>
#endif
#include "private/cpu.h"
#include "share/compat.h"
#include <stdlib.h>
#include <string.h>
#include "include/private/cpu.h"
#include "include/share/compat.h"
#if defined(_MSC_VER)
# include <intrin.h> /* for __cpuid() and _xgetbv() */
#endif
@@ -83,7 +84,7 @@ cpu_xgetbv_x86(void)
return (uint32_t)_xgetbv(0);
#elif defined __GNUC__
uint32_t lo, hi;
asm volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(lo), "=d"(hi) : "c" (0));
__asm__ volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(lo), "=d"(hi) : "c" (0));
return lo;
#else
return 0;
+1 -1
View File
@@ -34,7 +34,7 @@
# include <config.h>
#endif
#include "private/crc.h"
#include "include/private/crc.h"
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
+5 -5
View File
@@ -38,11 +38,11 @@
#include <math.h>
#include <string.h>
#include "share/compat.h"
#include "private/bitmath.h"
#include "private/fixed.h"
#include "private/macros.h"
#include "FLAC/assert.h"
#include "include/share/compat.h"
#include "include/private/bitmath.h"
#include "include/private/fixed.h"
#include "include/private/macros.h"
#include "include/FLAC/assert.h"
#ifdef local_abs
#undef local_abs
+3 -3
View File
@@ -34,9 +34,9 @@
# include <config.h>
#endif
#include "FLAC/assert.h"
#include "share/compat.h"
#include "private/float.h"
#include "include/FLAC/assert.h"
#include "include/share/compat.h"
#include "include/private/float.h"
#ifdef FLAC__INTEGER_ONLY_LIBRARY
+6 -6
View File
@@ -40,12 +40,12 @@
#include <retro_miscellaneous.h>
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "share/alloc.h"
#include "share/compat.h"
#include "private/format.h"
#include "private/macros.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include "include/share/alloc.h"
#include "include/share/compat.h"
#include "include/private/format.h"
#include "include/private/macros.h"
/* FLAC_PACKAGE_VERSION should come from configure */
#if defined(__LIBRETRO__) || defined(RARCH_INTERNAL)
+1 -1
View File
@@ -512,7 +512,7 @@ typedef enum {
FLAC__METADATA_TYPE_UNDEFINED = 7,
/**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE,
FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE
/**< No type will ever be greater than this. There is not enough room in the protocol block. */
} FLAC__MetadataType;
+3 -3
View File
@@ -35,10 +35,10 @@
#include <retro_inline.h>
#include "FLAC/ordinals.h"
#include "FLAC/assert.h"
#include "../FLAC/ordinals.h"
#include "../FLAC/assert.h"
#include "share/compat.h"
#include "../share/compat.h"
#if defined(_MSC_VER)
#include <intrin.h> /* for _BitScanReverse* */
+1 -1
View File
@@ -34,7 +34,7 @@
#define FLAC__PRIVATE__BITREADER_H
#include <stdio.h> /* for FILE */
#include "FLAC/ordinals.h"
#include "../FLAC/ordinals.h"
#include "cpu.h"
/*
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef FLAC__PRIVATE__CPU_H
#define FLAC__PRIVATE__CPU_H
#include "FLAC/ordinals.h"
#include "../FLAC/ordinals.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef FLAC__PRIVATE__CRC_H
#define FLAC__PRIVATE__CRC_H
#include "FLAC/ordinals.h"
#include "../FLAC/ordinals.h"
/* 8 bit CRC generator, MSB shifted first
** polynomial = x^8 + x^2 + x^1 + x^0
+3 -3
View File
@@ -37,9 +37,9 @@
#include <config.h>
#endif
#include "private/cpu.h"
#include "private/float.h"
#include "FLAC/format.h"
#include "../private/cpu.h"
#include "../private/float.h"
#include "../FLAC/format.h"
/*
* FLAC__fixed_compute_best_predictor()
+1 -1
View File
@@ -37,7 +37,7 @@
#include <config.h>
#endif
#include "FLAC/ordinals.h"
#include "../FLAC/ordinals.h"
/*
* All the code in libFLAC that uses float and double
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef FLAC__PRIVATE__FORMAT_H
#define FLAC__PRIVATE__FORMAT_H
#include "FLAC/format.h"
#include "../FLAC/format.h"
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order);
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize);
+3 -3
View File
@@ -37,9 +37,9 @@
#include <config.h>
#endif
#include "private/cpu.h"
#include "private/float.h"
#include "FLAC/format.h"
#include "../private/cpu.h"
#include "../private/float.h"
#include "../FLAC/format.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
+1 -1
View File
@@ -26,7 +26,7 @@
* Still in the public domain, with no warranty.
*/
#include "FLAC/ordinals.h"
#include "../FLAC/ordinals.h"
typedef union {
FLAC__byte *p8;
+2 -2
View File
@@ -39,8 +39,8 @@
#include <stdlib.h> /* for size_t */
#include "private/float.h"
#include "FLAC/ordinals.h" /* for FLAC__bool */
#include "../private/float.h"
#include "../FLAC/ordinals.h" /* for FLAC__bool */
/* Returns the unaligned address returned by malloc.
* Use free() on this address to deallocate.
+2 -2
View File
@@ -33,9 +33,9 @@
#ifndef FLAC__PROTECTED__STREAM_DECODER_H
#define FLAC__PROTECTED__STREAM_DECODER_H
#include "FLAC/stream_decoder.h"
#include "../FLAC/stream_decoder.h"
#if FLAC__HAS_OGG
#include "private/ogg_decoder_aspect.h"
#include "../private/ogg_decoder_aspect.h"
#endif
typedef struct FLAC__StreamDecoderProtected {
+17 -15
View File
@@ -33,6 +33,8 @@
#ifndef FLAC__SHARE__ALLOC_H
#define FLAC__SHARE__ALLOC_H
#include <retro_inline.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -46,7 +48,7 @@
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
#endif
#include <stdlib.h> /* for size_t, malloc(), etc */
#include "share/compat.h"
#include "../share/compat.h"
#ifndef SIZE_MAX
# ifndef SIZE_T_MAX
@@ -66,7 +68,7 @@
/* avoid malloc()ing 0 bytes, see:
* https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003
*/
static inline void *safe_malloc_(size_t size)
static INLINE void *safe_malloc_(size_t size)
{
/* malloc(0) is undefined; FLAC src convention is to always allocate */
if(!size)
@@ -74,7 +76,7 @@ static inline void *safe_malloc_(size_t size)
return malloc(size);
}
static inline void *safe_calloc_(size_t nmemb, size_t size)
static INLINE void *safe_calloc_(size_t nmemb, size_t size)
{
if(!nmemb || !size)
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
@@ -83,7 +85,7 @@ static inline void *safe_calloc_(size_t nmemb, size_t size)
/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */
static inline void *safe_malloc_add_2op_(size_t size1, size_t size2)
static INLINE void *safe_malloc_add_2op_(size_t size1, size_t size2)
{
size2 += size1;
if(size2 < size1)
@@ -91,7 +93,7 @@ static inline void *safe_malloc_add_2op_(size_t size1, size_t size2)
return safe_malloc_(size2);
}
static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
static INLINE void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
{
size2 += size1;
if(size2 < size1)
@@ -102,7 +104,7 @@ static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size
return safe_malloc_(size3);
}
static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
static INLINE void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
{
size2 += size1;
if(size2 < size1)
@@ -118,7 +120,7 @@ static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size
void *safe_malloc_mul_2op_(size_t size1, size_t size2) ;
static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
static INLINE void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || !size2 || !size3)
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
@@ -131,7 +133,7 @@ static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size
}
/* size1*size2 + size3 */
static inline void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
static INLINE void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || !size2)
return safe_malloc_(size3);
@@ -141,7 +143,7 @@ static inline void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size
}
/* size1 * (size2 + size3) */
static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
static INLINE void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || (!size2 && !size3))
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
@@ -153,7 +155,7 @@ static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size
return malloc(size1*size2);
}
static inline void *safe_realloc_(void *ptr, size_t size)
static INLINE void *safe_realloc_(void *ptr, size_t size)
{
void *oldptr = ptr;
void *newptr = realloc(ptr, size);
@@ -161,7 +163,7 @@ static inline void *safe_realloc_(void *ptr, size_t size)
free(oldptr);
return newptr;
}
static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
static INLINE void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
{
size2 += size1;
if(size2 < size1) {
@@ -171,7 +173,7 @@ static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
return realloc(ptr, size2);
}
static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
static INLINE void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
{
size2 += size1;
if(size2 < size1)
@@ -182,7 +184,7 @@ static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2,
return realloc(ptr, size3);
}
static inline void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
static INLINE void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
{
size2 += size1;
if(size2 < size1)
@@ -196,7 +198,7 @@ static inline void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2,
return realloc(ptr, size4);
}
static inline void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
static INLINE void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
{
if(!size1 || !size2)
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
@@ -206,7 +208,7 @@ static inline void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
}
/* size1 * (size2 + size3) */
static inline void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
static INLINE void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
{
if(!size1 || (!size2 && !size3))
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
+6 -6
View File
@@ -36,12 +36,12 @@
#include <math.h>
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "share/compat.h"
#include "private/bitmath.h"
#include "private/lpc.h"
#include "private/macros.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include "include/share/compat.h"
#include "include/private/bitmath.h"
#include "include/private/lpc.h"
#include "include/private/macros.h"
#if defined DEBUG || defined FLAC__OVERFLOW_DETECT || defined FLAC__OVERFLOW_DETECT_VERBOSE
#include <stdio.h>
#endif
+4 -4
View File
@@ -34,16 +34,16 @@
# include <config.h>
#endif
#include "private/cpu.h"
#include "include/private/cpu.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#ifndef FLAC__NO_ASM
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
#include "private/lpc.h"
#include "include/private/lpc.h"
#ifdef FLAC__AVX2_SUPPORTED
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include <immintrin.h> /* AVX2 */
+4 -4
View File
@@ -34,15 +34,15 @@
# include <config.h>
#endif
#include "private/cpu.h"
#include "include/private/cpu.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#ifndef FLAC__NO_ASM
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
#include "private/lpc.h"
#include "include/private/lpc.h"
#ifdef FLAC__SSE_SUPPORTED
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include <xmmintrin.h> /* SSE */
+4 -4
View File
@@ -34,16 +34,16 @@
# include <config.h>
#endif
#include "private/cpu.h"
#include "include/private/cpu.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#ifndef FLAC__NO_ASM
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
#include "private/lpc.h"
#include "include/private/lpc.h"
#ifdef FLAC__SSE2_SUPPORTED
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include <emmintrin.h> /* SSE2 */
+4 -4
View File
@@ -34,16 +34,16 @@
# include <config.h>
#endif
#include "private/cpu.h"
#include "include/private/cpu.h"
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#ifndef FLAC__NO_ASM
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
#include "private/lpc.h"
#include "include/private/lpc.h"
#ifdef FLAC__SSE4_1_SUPPORTED
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "include/FLAC/assert.h"
#include "include/FLAC/format.h"
#include <smmintrin.h> /* SSE4.1 */
+3 -3
View File
@@ -5,9 +5,9 @@
#include <stdlib.h> /* for malloc() */
#include <string.h> /* for memcpy() */
#include "private/md5.h"
#include "share/alloc.h"
#include "share/endswap.h"
#include "include/private/md5.h"
#include "include/share/alloc.h"
#include "include/share/endswap.h"
/*
* This code implements the MD5 message-digest algorithm.
+3 -3
View File
@@ -38,9 +38,9 @@
#include <stdint.h>
#endif
#include "private/memory.h"
#include "FLAC/assert.h"
#include "share/alloc.h"
#include "include/private/memory.h"
#include "include/FLAC/assert.h"
#include "include/share/alloc.h"
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
{
+14 -14
View File
@@ -42,20 +42,20 @@
#include <retro_miscellaneous.h>
#include "share/compat.h"
#include "FLAC/assert.h"
#include "share/alloc.h"
#include "protected/stream_decoder.h"
#include "private/bitreader.h"
#include "private/bitmath.h"
#include "private/cpu.h"
#include "private/crc.h"
#include "private/fixed.h"
#include "private/format.h"
#include "private/lpc.h"
#include "private/md5.h"
#include "private/memory.h"
#include "private/macros.h"
#include "include/share/compat.h"
#include "include/FLAC/assert.h"
#include "include/share/alloc.h"
#include "include/protected/stream_decoder.h"
#include "include/private/bitreader.h"
#include "include/private/bitmath.h"
#include "include/private/cpu.h"
#include "include/private/crc.h"
#include "include/private/fixed.h"
#include "include/private/format.h"
#include "include/private/lpc.h"
#include "include/private/md5.h"
#include "include/private/memory.h"
#include "include/private/macros.h"
/* technically this should be in an "export.c" but this is convenient enough */
+2
View File
@@ -86,6 +86,8 @@ enum file_path_enum
FILE_PATH_ZIP_EXTENSION,
FILE_PATH_7Z_EXTENSION,
FILE_PATH_OGG_EXTENSION,
FILE_PATH_MP3_EXTENSION,
FILE_PATH_FLAC_EXTENSION,
FILE_PATH_WAV_EXTENSION,
FILE_PATH_MOD_EXTENSION,
FILE_PATH_S3M_EXTENSION,
+6
View File
@@ -101,6 +101,12 @@ const char *file_path_str(enum file_path_enum enum_idx)
case FILE_PATH_PNG_EXTENSION:
str = ".png";
break;
case FILE_PATH_MP3_EXTENSION:
str = ".mp3";
break;
case FILE_PATH_FLAC_EXTENSION:
str = ".flac";
break;
case FILE_PATH_OGG_EXTENSION:
str = ".ogg";
break;
-3
View File
@@ -54,9 +54,6 @@
#ifdef ANDROID
#include <sys/system_properties.h>
#ifdef __arm__
#include <machine/cpu-features.h>
#endif
#endif
#include <boolean.h>
+16 -1
View File
@@ -37,6 +37,13 @@
#include "../paths.h"
#include "../retroarch.h"
/* griffin hack */
#ifdef HAVE_QT
#ifndef HAVE_MAIN
#define HAVE_MAIN
#endif
#endif
#ifndef HAVE_MAIN
#include "../retroarch.h"
#endif
@@ -98,6 +105,9 @@ void main_exit(void *args)
int rarch_main(int argc, char *argv[], void *data)
{
void *args = (void*)data;
#if defined(HAVE_MAIN) && defined(HAVE_QT)
const ui_application_t *ui_application = NULL;
#endif
rarch_ctl(RARCH_CTL_PREINIT, NULL);
frontend_driver_init_first(args);
@@ -124,7 +134,7 @@ int rarch_main(int argc, char *argv[], void *data)
ui_companion_driver_init_first();
#ifndef HAVE_MAIN
#if !defined(HAVE_MAIN)
do
{
unsigned sleep_ms = 0;
@@ -140,6 +150,11 @@ int rarch_main(int argc, char *argv[], void *data)
}while(1);
main_exit(args);
#elif defined(HAVE_QT)
ui_application = ui_companion_driver_get_qt_application_ptr();
if (ui_application && ui_application->run)
ui_application->run(args);
#endif
return 0;
+45
View File
@@ -22,11 +22,56 @@
#include <d3d8.h>
#include "../drivers/d3d.h"
#include "../video_driver.h"
#include "../../verbosity.h"
RETRO_BEGIN_DECLS
typedef struct d3d8_video
{
bool keep_aspect;
bool should_resize;
bool quitting;
bool needs_restore;
bool overlays_enabled;
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
unsigned cur_mon_id;
unsigned dev_rotation;
overlay_t *menu;
const d3d_renderchain_driver_t *renderchain_driver;
void *renderchain_data;
RECT font_rect;
RECT font_rect_shifted;
math_matrix_4x4 mvp;
math_matrix_4x4 mvp_rotate;
math_matrix_4x4 mvp_transposed;
struct video_viewport vp;
struct video_shader shader;
video_info_t video_info;
WNDCLASSEX windowClass;
LPDIRECT3DDEVICE8 dev;
d3d_video_viewport_t final_viewport;
char *shader_path;
struct
{
int size;
int offset;
void *buffer;
void *decl;
}menu_display;
size_t overlays_size;
overlay_t *overlays;
} d3d8_video_t;
static INLINE bool d3d8_swap(void *data, LPDIRECT3DDEVICE8 dev)
{
if (IDirect3DDevice8_Present(dev, NULL, NULL, NULL, NULL)
+46
View File
@@ -19,14 +19,60 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_inline.h>
#include <gfx/math/matrix_4x4.h>
#include <d3d9.h>
#include "../drivers/d3d.h"
#include "../video_driver.h"
#include "../../verbosity.h"
RETRO_BEGIN_DECLS
typedef struct d3d9_video
{
bool keep_aspect;
bool should_resize;
bool quitting;
bool needs_restore;
bool overlays_enabled;
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
unsigned cur_mon_id;
unsigned dev_rotation;
overlay_t *menu;
const d3d_renderchain_driver_t *renderchain_driver;
void *renderchain_data;
RECT font_rect;
RECT font_rect_shifted;
math_matrix_4x4 mvp;
math_matrix_4x4 mvp_rotate;
math_matrix_4x4 mvp_transposed;
struct video_viewport vp;
struct video_shader shader;
video_info_t video_info;
WNDCLASSEX windowClass;
LPDIRECT3DDEVICE9 dev;
d3d_video_viewport_t final_viewport;
char *shader_path;
struct
{
int size;
int offset;
void *buffer;
void *decl;
}menu_display;
size_t overlays_size;
overlay_t *overlays;
} d3d9_video_t;
static INLINE bool d3d9_swap(void *data, LPDIRECT3DDEVICE9 dev)
{
#ifdef _XBOX
+1 -1
View File
@@ -767,7 +767,7 @@ static INLINE HRESULT DXGICreateFactory(DXGIFactory* factory)
#define DXGI_COLOR_RGBA(r, g, b, a) (((UINT32)(a) << 24) | ((UINT32)(b) << 16) | ((UINT32)(g) << 8) | ((UINT32)(r) << 0))
typedef enum {
DXGI_FORMAT_EX_A4R4G4B4_UNORM = 1000,
DXGI_FORMAT_EX_A4R4G4B4_UNORM = 1000
} DXGI_FORMAT_EX;
typedef struct
+195 -12
View File
@@ -92,6 +92,176 @@ extern void *dinput_wgl;
extern void *dinput;
#endif
typedef enum {
DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED_CUSTOM = 0,
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE_CUSTOM = 1,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_CUSTOM = 2,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST_CUSTOM = DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_CUSTOM,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST_CUSTOM = 3,
DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM;
typedef enum {
DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE_CUSTOM = 1,
DISPLAYCONFIG_MODE_INFO_TYPE_TARGET_CUSTOM = 2,
DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE_CUSTOM = 3,
DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_MODE_INFO_TYPE_CUSTOM;
typedef enum {
DISPLAYCONFIG_PIXELFORMAT_8BPP_CUSTOM = 1,
DISPLAYCONFIG_PIXELFORMAT_16BPP_CUSTOM = 2,
DISPLAYCONFIG_PIXELFORMAT_24BPP_CUSTOM = 3,
DISPLAYCONFIG_PIXELFORMAT_32BPP_CUSTOM = 4,
DISPLAYCONFIG_PIXELFORMAT_NONGDI_CUSTOM = 5,
DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32_CUSTOM = 0xffffffff
} DISPLAYCONFIG_PIXELFORMAT_CUSTOM;
typedef enum {
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER_CUSTOM = -1,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15_CUSTOM = 0,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO_CUSTOM = 1,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO_CUSTOM = 2,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO_CUSTOM = 3,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI_CUSTOM = 4,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI_CUSTOM = 5,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS_CUSTOM = 6,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN_CUSTOM = 8,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI_CUSTOM = 9,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL_CUSTOM = 10,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED_CUSTOM = 11,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL_CUSTOM = 12,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED_CUSTOM = 13,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE_CUSTOM = 14,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_MIRACAST_CUSTOM = 15,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL_CUSTOM = 0x80000000,
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY_CUSTOM;
typedef enum {
DISPLAYCONFIG_ROTATION_IDENTITY_CUSTOM = 1,
DISPLAYCONFIG_ROTATION_ROTATE90_CUSTOM = 2,
DISPLAYCONFIG_ROTATION_ROTATE180_CUSTOM = 3,
DISPLAYCONFIG_ROTATION_ROTATE270_CUSTOM = 4,
DISPLAYCONFIG_ROTATION_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_ROTATION_CUSTOM;
typedef enum {
DISPLAYCONFIG_SCALING_IDENTITY_CUSTOM = 1,
DISPLAYCONFIG_SCALING_CENTERED_CUSTOM = 2,
DISPLAYCONFIG_SCALING_STRETCHED_CUSTOM = 3,
DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX_CUSTOM = 4,
DISPLAYCONFIG_SCALING_CUSTOM_CUSTOM = 5,
DISPLAYCONFIG_SCALING_PREFERRED_CUSTOM = 128,
DISPLAYCONFIG_SCALING_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_SCALING_CUST;
typedef enum {
DISPLAYCONFIG_TOPOLOGY_INTERNAL_CUSTOM = 0x00000001,
DISPLAYCONFIG_TOPOLOGY_CLONE_CUSTOM = 0x00000002,
DISPLAYCONFIG_TOPOLOGY_EXTEND_CUSTOM = 0x00000004,
DISPLAYCONFIG_TOPOLOGY_EXTERNAL_CUSTOM = 0x00000008,
DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32_CUSTOM = 0xFFFFFFFF
} DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM;
typedef struct DISPLAYCONFIG_RATIONAL_CUSTOM {
UINT32 Numerator;
UINT32 Denominator;
} DISPLAYCONFIG_RATIONAL_CUSTOM;
typedef struct DISPLAYCONFIG_2DREGION_CUSTOM {
UINT32 cx;
UINT32 cy;
} DISPLAYCONFIG_2DREGION_CUSTOM;
typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM {
UINT64 pixelRate;
DISPLAYCONFIG_RATIONAL_CUSTOM hSyncFreq;
DISPLAYCONFIG_RATIONAL_CUSTOM vSyncFreq;
DISPLAYCONFIG_2DREGION_CUSTOM activeSize;
DISPLAYCONFIG_2DREGION_CUSTOM totalSize;
union {
struct {
UINT32 videoStandard :16;
UINT32 vSyncFreqDivider :6;
UINT32 reserved :10;
} AdditionalSignalInfo;
UINT32 videoStandard;
};
DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM scanLineOrdering;
} DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM;
typedef struct DISPLAYCONFIG_TARGET_MODE_CUSTOM {
DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM targetVideoSignalInfo;
} DISPLAYCONFIG_TARGET_MODE_CUSTOM;
typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM {
LUID adapterId;
UINT32 id;
union {
UINT32 modeInfoIdx;
struct {
UINT32 cloneGroupId :16;
UINT32 sourceModeInfoIdx :16;
} DUMMYSTRUCTNAME;
} DUMMYUNIONNAME;
UINT32 statusFlags;
} DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM;
typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM {
POINTL PathSourceSize;
RECTL DesktopImageRegion;
RECTL DesktopImageClip;
} DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM;
typedef struct DISPLAYCONFIG_SOURCE_MODE_CUSTOM {
UINT32 width;
UINT32 height;
DISPLAYCONFIG_PIXELFORMAT_CUSTOM pixelFormat;
POINTL position;
} DISPLAYCONFIG_SOURCE_MODE_CUSTOM;
typedef struct DISPLAYCONFIG_MODE_INFO_CUSTOM {
DISPLAYCONFIG_MODE_INFO_TYPE_CUSTOM infoType;
UINT32 id;
LUID adapterId;
union {
DISPLAYCONFIG_TARGET_MODE_CUSTOM targetMode;
DISPLAYCONFIG_SOURCE_MODE_CUSTOM sourceMode;
DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM desktopImageInfo;
};
} DISPLAYCONFIG_MODE_INFO_CUSTOM;
typedef struct DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM {
LUID adapterId;
UINT32 id;
union {
UINT32 modeInfoIdx;
struct {
UINT32 desktopModeInfoIdx :16;
UINT32 targetModeInfoIdx :16;
};
};
DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY_CUSTOM outputTechnology;
DISPLAYCONFIG_ROTATION_CUSTOM rotation;
DISPLAYCONFIG_SCALING_CUST scaling;
DISPLAYCONFIG_RATIONAL_CUSTOM refreshRate;
DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM scanLineOrdering;
BOOL targetAvailable;
UINT32 statusFlags;
} DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM;
typedef struct DISPLAYCONFIG_PATH_INFO_CUSTOM {
DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM sourceInfo;
DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM targetInfo;
UINT32 flags;
} DISPLAYCONFIG_PATH_INFO_CUSTOM;
typedef LONG (WINAPI *QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO_CUSTOM*, UINT32*, DISPLAYCONFIG_MODE_INFO_CUSTOM*, DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM*);
typedef LONG (WINAPI *GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*);
static bool g_resized = false;
bool g_restore_desktop = false;
static bool doubleclick_on_titlebar = false;
@@ -434,7 +604,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
#ifndef _XBOX
static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
WPARAM wparam, LPARAM lparam)
{
uint16_t mod = 0;
@@ -818,7 +988,7 @@ bool win32_window_create(void *data, unsigned style,
notification_filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
notification_filter.dbcc_classguid = GUID_DEVINTERFACE_HID;
notification_handler = RegisterDeviceNotification(
main_window.hwnd, &notification_filter, DEVICE_NOTIFY_WINDOW_HANDLE);
main_window.hwnd, &notification_filter, DEVICE_NOTIFY_WINDOW_HANDLE);
if (!notification_handler)
RARCH_ERR("Error registering for notifications\n");
@@ -1029,7 +1199,7 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
float refresh_mod = settings->bools.video_black_frame_insertion ? 2.0f : 1.0f;
unsigned refresh = roundf(settings->floats.video_refresh_rate
* refresh_mod * settings->uints.video_swap_interval);
if (windowed_full)
{
*style = WS_EX_TOPMOST | WS_POPUP;
@@ -1270,12 +1440,24 @@ float win32_get_refresh_rate(void *data)
float refresh_rate = 0.0f;
#if _WIN32_WINNT >= 0x0601 || _WIN32_WINDOWS >= 0x0601 /* Win 7 */
OSVERSIONINFO version_info;
DISPLAYCONFIG_TOPOLOGY_ID TopologyID;
DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM TopologyID;
unsigned int NumPathArrayElements = 0;
unsigned int NumModeInfoArrayElements = 0;
DISPLAYCONFIG_PATH_INFO *PathInfoArray = NULL;
DISPLAYCONFIG_MODE_INFO *ModeInfoArray = NULL;
DISPLAYCONFIG_PATH_INFO_CUSTOM *PathInfoArray = NULL;
DISPLAYCONFIG_MODE_INFO_CUSTOM *ModeInfoArray = NULL;
int result = 0;
#ifdef HAVE_DYNAMIC
static QUERYDISPLAYCONFIG pQueryDisplayConfig;
static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes;
if (!pQueryDisplayConfig)
pQueryDisplayConfig = (QUERYDISPLAYCONFIG)GetProcAddress(GetModuleHandle("user32.dll"), "QueryDisplayConfig");
if (!pGetDisplayConfigBufferSizes)
pGetDisplayConfigBufferSizes = (GETDISPLAYCONFIGBUFFERSIZES)GetProcAddress(GetModuleHandle("user32.dll"), "GetDisplayConfigBufferSizes");
#else
static QUERYDISPLAYCONFIG pQueryDisplayConfig = QueryDisplayConfig;
static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes = GetDisplayConfigBufferSizes;
#endif
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&version_info))
@@ -1285,24 +1467,25 @@ float win32_get_refresh_rate(void *data)
(version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 1))
return refresh_rate;
result = GetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT,
result = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT,
&NumPathArrayElements,
&NumModeInfoArrayElements);
if (result != ERROR_SUCCESS)
return refresh_rate;
PathInfoArray = (DISPLAYCONFIG_PATH_INFO *)
malloc(sizeof(DISPLAYCONFIG_PATH_INFO) * NumPathArrayElements);
ModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)
malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * NumModeInfoArrayElements);
PathInfoArray = (DISPLAYCONFIG_PATH_INFO_CUSTOM *)
malloc(sizeof(DISPLAYCONFIG_PATH_INFO_CUSTOM) * NumPathArrayElements);
ModeInfoArray = (DISPLAYCONFIG_MODE_INFO_CUSTOM *)
malloc(sizeof(DISPLAYCONFIG_MODE_INFO_CUSTOM) * NumModeInfoArrayElements);
result = QueryDisplayConfig(QDC_DATABASE_CURRENT,
result = pQueryDisplayConfig(QDC_DATABASE_CURRENT,
&NumPathArrayElements,
PathInfoArray,
&NumModeInfoArrayElements,
ModeInfoArray,
&TopologyID);
if (result == ERROR_SUCCESS && NumPathArrayElements >= 1)
{
refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator /
-1
View File
@@ -50,7 +50,6 @@ const video_display_server_t dispserv_null = {
null_set_window_progress,
NULL,
NULL,
NULL,
"null"
};
+15 -14
View File
@@ -34,6 +34,7 @@
#include "../video_display_server.h"
#include "../common/win32_common.h"
#include "../../verbosity.h"
#include "../video_driver.h" /* needed to set refresh rate in set resolution */
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
#define HAS_TASKBAR_EXT
@@ -65,6 +66,9 @@ calling RegisterWindowMessage(L("TaskbarButtonCreated")). That message must
be received by your application before it calls any ITaskbarList3 method.
*/
static unsigned win32_orig_width = 0;
static unsigned win32_orig_height = 0;
static void* win32_display_server_init(void)
{
HRESULT hr;
@@ -99,6 +103,10 @@ static void* win32_display_server_init(void)
static void win32_display_server_destroy(void *data)
{
dispserv_win32_t *dispserv = (dispserv_win32_t*)data;
if (win32_orig_width > 0 && win32_orig_height > 0 )
video_display_server_switch_resolution(win32_orig_width, win32_orig_height,
60, 60);
#ifdef HAS_TASKBAR_EXT
if (g_taskbarList && win32_taskbar_is_created())
@@ -192,23 +200,25 @@ static bool win32_set_window_decorations(void *data, bool on)
}
static bool win32_display_server_set_resolution(void *data,
unsigned width, unsigned height, int f_restore, int hz)
unsigned width, unsigned height, int int_hz, float hz)
{
LONG res;
DEVMODE curDevmode;
DEVMODE devmode;
int iModeNum;
int freq = 0;
int freq = int_hz;
DWORD flags = 0;
int depth = 0;
dispserv_win32_t *serv = (dispserv_win32_t*)data;
if (!serv)
return false;
if (f_restore == 0)
freq = hz;
if (win32_orig_width == 0)
win32_orig_width = GetSystemMetrics(SM_CXSCREEN);
if (win32_orig_height == 0)
win32_orig_height = GetSystemMetrics(SM_CYSCREEN);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &curDevmode);
@@ -270,14 +280,6 @@ static bool win32_display_server_set_resolution(void *data,
return true;
}
void win32_display_server_get_current_resolution(
unsigned *width, unsigned *height)
{
if (width)
*width = GetSystemMetrics(SM_CYSCREEN);
if (height)
*height = GetSystemMetrics(SM_CXSCREEN);
}
const video_display_server_t dispserv_win32 = {
win32_display_server_init,
@@ -285,7 +287,6 @@ const video_display_server_t dispserv_win32 = {
win32_set_window_opacity,
win32_set_window_progress,
win32_set_window_decorations,
win32_display_server_get_current_resolution,
win32_display_server_set_resolution,
"win32"
};
+197 -2
View File
@@ -18,6 +18,15 @@
#include "../video_display_server.h"
#include "../common/x11_common.h"
#include "../../configuration.h"
#include "../video_driver.h" /* needed to set refresh rate in set resolution */
#include "../video_crt_switch.h" /* needed to set aspect for low res in linux */
#include <sys/types.h>
#include <unistd.h>
static char old_mode[150];
static char new_mode[150];
static bool crt_en = false;
typedef struct
{
@@ -39,6 +48,9 @@ static void x11_display_server_destroy(void *data)
{
dispserv_x11_t *dispserv = (dispserv_x11_t*)data;
if (crt_en == true)
system("xrandr -s 704x480");
if (dispserv)
free(dispserv);
}
@@ -72,14 +84,197 @@ static bool x11_set_window_decorations(void *data, bool on)
return true;
}
static bool x11_set_resolution(void *data,
unsigned width, unsigned height, int int_hz, float hz)
{
int i = 0;
int hfp = 0;
int hsp = 0;
int hbp = 0;
int vfp = 0;
int vsp = 0;
int vbp = 0;
int hmax = 0;
int vmax = 0;
float pixel_clock = 0;
char xrandr[250];
char fbset[150];
char output[150];
crt_en = true;
hsp = width*1.14;
/* set core refresh from hz */
video_monitor_set_refresh_rate(hz);
/* following code is the mode line genorator */
if (width < 300)
{
width = width*2;
crt_aspect_ratio_switch(width, height);
}
hfp = width+16;
hbp = width*1.22;
hmax = hbp;
if (height < 241)
{
vmax = 261;
}
if (height < 241 && hz > 56 && hz < 58)
{
vmax = 280;
}
if (height < 241 && hz < 55)
{
vmax = 313;
}
if (height > 250 && height < 260 && hz > 54)
{
vmax = 296;
}
if (height > 250 && height < 260 && hz > 52 && hz < 54)
{
vmax = 285;
}
if (height > 240 && height < 260 && hz < 52)
{
vmax = 265;
}
if (height > 250 && height < 260 && hz < 52)
{
vmax = 313;
}
if (height > 260 && height < 300)
{
vmax = 313;
}
if (height > 400 && hz > 56)
{
vmax = 523;
}
if (height > 520 && hz < 57)
{
vmax = 580;
}
if (height > 300 && hz < 56)
{
vmax = 627;
}
if (hz < 53)
{
vfp = height+((vmax-height)*0.38);
}
if (hz > 56)
{
vfp = height+((vmax-height)*0.15);
}
if (hz > 53 && hz < 56)
{
vfp = height+((vmax-height)*0.35);
}
if ( vfp < 1 )
{
vfp = height+2;
}
if (height < 300)
{
vsp = vfp+3; /* needs to me 3 for progressive */
} if (height > 300)
{
vsp = vfp+6; /* needs to me 6 for interlaced */
}
vbp = vmax;
if (height < 300)
{
pixel_clock = (hmax*vmax*hz)/1000000;
}
if (height > 300)
{
pixel_clock = ((hmax*vmax*hz)/1000000)/2;
}
/* above code is the modeline genorator */
/* create progressive newmode from modline variables */
if (height < 300)
{
sprintf(xrandr,"xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp);
system(xrandr);
}
/* create interlaced newmode from modline variables */
if (height > 300)
{
sprintf(xrandr,"xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp);
system(xrandr);
}
/* variable for new mode */
sprintf(new_mode,"%dx%d_%0.2f", width, height, hz);
/* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to add and delete modes */
for (i =0; i < 3; i++)
{
sprintf(output,"xrandr --addmode %s%d %s", "DVI",i ,new_mode);
system(output);
sprintf(output,"xrandr --delmode %s%d %s", "DVI",i ,old_mode);
system(output);
}
for (i =0; i < 3; i++)
{
sprintf(output,"xrandr --addmode %s-%d %s", "DVI",i ,new_mode);
system(output);
sprintf(output,"xrandr --delmode %s-%d %s", "DVI",i ,old_mode);
system(output);
}
for (i =0; i < 3; i++)
{
sprintf(output,"xrandr --addmode %s%d %s", "VGA",i ,new_mode);
system(output);
sprintf(output,"xrandr --delmode %s%d %s", "VGA",i ,old_mode);
system(output);
}
for (i =0; i < 3; i++)
{
sprintf(output,"xrandr --addmode %s-%d %s", "VGA",i ,new_mode);
system(output);
sprintf(output,"xrandr --delmode %s-%d %s", "VGA",i ,old_mode);
system(output);
}
sprintf(output,"xrandr -s %s", new_mode);
system(output);
/* remove old mode */
sprintf(output,"xrandr --rmmode %s", old_mode);
system(output);
system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* needs xdotool installed. needed to recaputure window. */
/* variable for old mode */
sprintf(old_mode,"%s", new_mode);
system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* needs xdotool installed. needed to recaputure window. */
/* Second run needed as some times it runs to fast to capture first time */
return true;
}
const video_display_server_t dispserv_x11 = {
x11_display_server_init,
x11_display_server_destroy,
x11_set_window_opacity,
NULL,
x11_set_window_decorations,
NULL, /* get_current_resolution */
NULL, /* set_resolution */
x11_set_resolution, /* set_resolution */
"x11"
};
-46
View File
@@ -17,8 +17,6 @@
#ifndef __D3DVIDEO_INTF_H__
#define __D3DVIDEO_INTF_H__
#include <gfx/math/matrix_4x4.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
@@ -64,49 +62,5 @@ typedef struct d3d_video_viewport
float max_z;
} d3d_video_viewport_t;
typedef struct d3d_video
{
bool keep_aspect;
bool should_resize;
bool quitting;
bool needs_restore;
bool overlays_enabled;
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
unsigned cur_mon_id;
unsigned dev_rotation;
overlay_t *menu;
const d3d_renderchain_driver_t *renderchain_driver;
void *renderchain_data;
RECT font_rect;
RECT font_rect_shifted;
math_matrix_4x4 mvp;
math_matrix_4x4 mvp_rotate;
math_matrix_4x4 mvp_transposed;
struct video_viewport vp;
struct video_shader shader;
video_info_t video_info;
WNDCLASSEX windowClass;
void *dev;
d3d_video_viewport_t final_viewport;
char *shader_path;
struct
{
int size;
int offset;
void *buffer;
void *decl;
}menu_display;
size_t overlays_size;
overlay_t *overlays;
} d3d_video_t;
#endif
+44 -44
View File
@@ -92,7 +92,7 @@ static void d3d8_renderchain_set_mvp(
const void *mat_data)
{
D3DMATRIX matrix;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
d3d_matrix_identity(&matrix);
@@ -108,7 +108,7 @@ static void d3d8_renderchain_set_mvp(
static bool d3d8_renderchain_create_first_pass(void *data,
const video_info_t *info)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
@@ -145,7 +145,7 @@ static void d3d8_renderchain_set_vertices(void *data, unsigned pass,
unsigned vert_width, unsigned vert_height, uint64_t frame_count)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
d3d8_renderchain_t *chain = d3d ? (d3d8_renderchain_t*)d3d->renderchain_data : NULL;
video_driver_get_size(&width, &height);
@@ -254,7 +254,7 @@ static void d3d8_renderchain_viewport_info(void *data,
struct video_viewport *vp)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d || !vp)
return;
@@ -271,7 +271,7 @@ static void d3d8_renderchain_viewport_info(void *data,
}
static void d3d8_renderchain_render_pass(
d3d_video_t *d3d, LPDIRECT3DDEVICE8 d3dr,
d3d8_video_t *d3d, LPDIRECT3DDEVICE8 d3dr,
d3d8_renderchain_t *chain,
unsigned pass_index,
unsigned rotation)
@@ -298,7 +298,7 @@ static bool d3d8_renderchain_render(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
unsigned pitch, unsigned rotation)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
@@ -320,7 +320,7 @@ static bool d3d8_renderchain_init(void *data,
)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
const video_info_t *video_info = (const video_info_t*)_video_info;
const struct LinkInfo *link_info = (const struct LinkInfo*)info_data;
@@ -330,7 +330,7 @@ static bool d3d8_renderchain_init(void *data,
video_driver_get_size(&width, &height);
chain->dev = (LPDIRECT3DDEVICE8)dev_data;
chain->dev = dev_data;
chain->pixel_size = (fmt == RETRO_PIXEL_FORMAT_RGB565) ? 2 : 4;
chain->tex_w = link_info->tex_w;
chain->tex_h = link_info->tex_h;
@@ -357,7 +357,7 @@ static void *d3d8_renderchain_new(void)
return renderchain;
}
static bool d3d8_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
static bool d3d8_init_chain(d3d8_video_t *d3d, const video_info_t *video_info)
{
struct LinkInfo link_info;
unsigned current_width, current_height, out_width, out_height;
@@ -394,7 +394,7 @@ static bool d3d8_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
return true;
}
static bool d3d8_init_singlepass(d3d_video_t *d3d)
static bool d3d8_init_singlepass(d3d8_video_t *d3d)
{
struct video_shader_pass *pass = NULL;
@@ -422,7 +422,7 @@ static bool d3d8_init_singlepass(d3d_video_t *d3d)
static void d3d8_viewport_info(void *data, struct video_viewport *vp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (d3d)
d3d8_renderchain_viewport_info(d3d, vp);
@@ -432,12 +432,12 @@ static void d3d8_set_mvp(void *data,
void *shader_data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (d3d)
d3d8_renderchain_set_mvp(d3d, d3d->renderchain_data, shader_data, mat_data);
}
static void d3d8_overlay_render(d3d_video_t *d3d,
static void d3d8_overlay_render(d3d8_video_t *d3d,
video_frame_info_t *video_info,
overlay_t *overlay, bool force_linear)
{
@@ -535,7 +535,7 @@ static void d3d8_overlay_render(d3d_video_t *d3d,
d3d8_set_viewports(d3d->dev, &d3d->final_viewport);
}
static void d3d8_free_overlay(d3d_video_t *d3d, overlay_t *overlay)
static void d3d8_free_overlay(d3d8_video_t *d3d, overlay_t *overlay)
{
if (!d3d)
return;
@@ -544,14 +544,14 @@ static void d3d8_free_overlay(d3d_video_t *d3d, overlay_t *overlay)
d3d8_vertex_buffer_free(overlay->vert_buf, NULL);
}
static void d3d8_deinit_chain(d3d_video_t *d3d)
static void d3d8_deinit_chain(d3d8_video_t *d3d)
{
d3d8_renderchain_free(d3d->renderchain_data);
d3d->renderchain_data = NULL;
}
static void d3d8_deinitialize(d3d_video_t *d3d)
static void d3d8_deinitialize(d3d8_video_t *d3d)
{
if (!d3d)
return;
@@ -596,7 +596,7 @@ static bool d3d8_is_windowed_enable(bool info_fullscreen)
}
#ifdef _XBOX
static void d3d8_get_video_size(d3d_video_t *d3d,
static void d3d8_get_video_size(d3d8_video_t *d3d,
unsigned *width, unsigned *height)
{
DWORD video_mode = XGetVideoFlags();
@@ -662,7 +662,7 @@ static void d3d8_get_video_size(d3d_video_t *d3d,
static void d3d8_make_d3dpp(void *data,
const video_info_t *info, void *_d3dpp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
D3DPRESENT_PARAMETERS *d3dpp = (D3DPRESENT_PARAMETERS*)_d3dpp;
bool windowed_enable = d3d8_is_windowed_enable(info->fullscreen);
@@ -762,7 +762,7 @@ static bool d3d8_init_base(void *data, const video_info_t *info)
{
D3DPRESENT_PARAMETERS d3dpp;
HWND focus_window = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
#ifndef _XBOX
focus_window = win32_get_window();
@@ -801,7 +801,7 @@ static void d3d8_calculate_rect(void *data,
bool allow_rotate)
{
float device_aspect = (float)*width / *height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
settings_t *settings = config_get_ptr();
video_driver_get_size(width, height);
@@ -881,7 +881,7 @@ static void d3d8_set_viewport(void *data,
D3DMATRIX proj, ortho, rot, matrix;
int x = 0;
int y = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
d3d8_calculate_rect(data, &width, &height, &x, &y,
force_full, allow_rotate);
@@ -907,7 +907,7 @@ static void d3d8_set_viewport(void *data,
d3d_matrix_transpose(&d3d->mvp_rotate, &matrix);
}
static bool d3d8_initialize(d3d_video_t *d3d, const video_info_t *info)
static bool d3d8_initialize(d3d8_video_t *d3d, const video_info_t *info)
{
unsigned width, height;
bool ret = true;
@@ -982,7 +982,7 @@ static bool d3d8_initialize(d3d_video_t *d3d, const video_info_t *info)
static bool d3d8_restore(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return false;
@@ -1004,7 +1004,7 @@ static bool d3d8_restore(void *data)
static void d3d8_set_nonblock_state(void *data, bool state)
{
unsigned interval = state ? 0 : 1;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1022,7 +1022,7 @@ static void d3d8_set_nonblock_state(void *data, bool state)
#endif
}
static bool d3d8_set_resize(d3d_video_t *d3d,
static bool d3d8_set_resize(d3d8_video_t *d3d,
unsigned new_width, unsigned new_height)
{
/* No changes? */
@@ -1043,7 +1043,7 @@ static bool d3d8_alive(void *data)
unsigned temp_width = 0;
unsigned temp_height = 0;
bool ret = false;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
bool quit = false;
bool resize = false;
@@ -1083,7 +1083,7 @@ static bool d3d8_suppress_screensaver(void *data, bool enable)
static void d3d8_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
switch (aspect_ratio_idx)
{
@@ -1115,7 +1115,7 @@ static void d3d8_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
static void d3d8_apply_state_changes(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (d3d)
d3d->should_resize = true;
}
@@ -1125,7 +1125,7 @@ static void d3d8_set_osd_msg(void *data,
const char *msg,
const void *params, void *font)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
d3d8_begin_scene(d3d->dev);
font_driver_render_msg(video_info, font, msg, params);
@@ -1163,7 +1163,7 @@ static void d3d8_input_driver(
#endif
}
static bool d3d8_init_internal(d3d_video_t *d3d,
static bool d3d8_init_internal(d3d8_video_t *d3d,
const video_info_t *info, const input_driver_t **input,
void **input_data)
{
@@ -1259,7 +1259,7 @@ static bool d3d8_init_internal(d3d_video_t *d3d,
static void d3d8_set_rotation(void *data, unsigned rot)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1278,7 +1278,7 @@ static void d3d8_show_mouse(void *data, bool state)
static void *d3d8_init(const video_info_t *info,
const input_driver_t **input, void **input_data)
{
d3d_video_t *d3d = (d3d_video_t*)calloc(1, sizeof(*d3d));
d3d8_video_t *d3d = (d3d8_video_t*)calloc(1, sizeof(*d3d));
if (!d3d)
return NULL;
@@ -1317,7 +1317,7 @@ static void *d3d8_init(const video_info_t *info,
}
#ifdef HAVE_OVERLAY
static void d3d8_free_overlays(d3d_video_t *d3d)
static void d3d8_free_overlays(d3d8_video_t *d3d)
{
unsigned i;
@@ -1334,7 +1334,7 @@ static void d3d8_free_overlays(d3d_video_t *d3d)
static void d3d8_free(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1378,7 +1378,7 @@ static void d3d8_overlay_tex_geom(
float x, float y,
float w, float h)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1400,7 +1400,7 @@ static void d3d8_overlay_vertex_geom(
float x, float y,
float w, float h)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1417,7 +1417,7 @@ static bool d3d8_overlay_load(void *data,
{
unsigned i, y;
overlay_t *new_overlays = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
const struct texture_image *images = (const struct texture_image*)
image_data;
@@ -1474,7 +1474,7 @@ static bool d3d8_overlay_load(void *data,
static void d3d8_overlay_enable(void *data, bool state)
{
unsigned i;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
@@ -1488,7 +1488,7 @@ static void d3d8_overlay_enable(void *data, bool state)
static void d3d8_overlay_full_screen(void *data, bool enable)
{
unsigned i;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
for (i = 0; i < d3d->overlays_size; i++)
d3d->overlays[i].fullscreen = enable;
@@ -1496,7 +1496,7 @@ static void d3d8_overlay_full_screen(void *data, bool enable)
static void d3d8_overlay_set_alpha(void *data, unsigned index, float mod)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (d3d)
d3d->overlays[index].alpha_mod = mod;
}
@@ -1559,7 +1559,7 @@ static bool d3d8_frame(void *data, const void *frame,
{
D3DVIEWPORT8 screen_vp;
unsigned i = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
(void)i;
@@ -1683,7 +1683,7 @@ static void d3d8_set_menu_texture_frame(void *data,
float alpha)
{
D3DLOCKED_RECT d3dlr;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
(void)d3dlr;
(void)frame;
@@ -1768,7 +1768,7 @@ static void d3d8_set_menu_texture_frame(void *data,
static void d3d8_set_menu_texture_enable(void *data,
bool state, bool full_screen)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d || !d3d->menu)
return;
@@ -1790,7 +1790,7 @@ static void d3d8_video_texture_load_d3d(
{
D3DLOCKED_RECT d3dlr;
unsigned usage = 0;
d3d_video_t *d3d = (d3d_video_t*)info->userdata;
d3d8_video_t *d3d = (d3d8_video_t*)info->userdata;
struct texture_image *ti = (struct texture_image*)info->data;
LPDIRECT3DTEXTURE8 tex = (LPDIRECT3DTEXTURE8)d3d8_texture_new(d3d->dev, NULL,
ti->width, ti->height, 0,
+81 -75
View File
@@ -74,7 +74,7 @@ void *dinput;
static bool d3d9_widescreen_mode = false;
#endif
static bool d3d9_set_resize(d3d_video_t *d3d,
static bool d3d9_set_resize(d3d9_video_t *d3d,
unsigned new_width, unsigned new_height)
{
/* No changes? */
@@ -90,7 +90,7 @@ static bool d3d9_set_resize(d3d_video_t *d3d,
return true;
}
static bool d3d9_init_imports(d3d_video_t *d3d)
static bool d3d9_init_imports(d3d9_video_t *d3d)
{
retro_ctx_memory_info_t mem_info;
state_tracker_t *state_tracker = NULL;
@@ -182,7 +182,7 @@ static bool renderchain_d3d_init_first(
return false;
}
static bool d3d9_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
static bool d3d9_init_chain(d3d9_video_t *d3d, const video_info_t *video_info)
{
struct LinkInfo link_info;
unsigned current_width, current_height, out_width, out_height;
@@ -289,7 +289,7 @@ static bool d3d9_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
return true;
}
static bool d3d9_init_singlepass(d3d_video_t *d3d)
static bool d3d9_init_singlepass(d3d9_video_t *d3d)
{
struct video_shader_pass *pass = NULL;
@@ -315,7 +315,7 @@ static bool d3d9_init_singlepass(d3d_video_t *d3d)
return true;
}
static bool d3d9_init_multipass(d3d_video_t *d3d, const char *shader_path)
static bool d3d9_init_multipass(d3d9_video_t *d3d, const char *shader_path)
{
unsigned i;
bool use_extra_pass = false;
@@ -383,7 +383,7 @@ static bool d3d9_init_multipass(d3d_video_t *d3d, const char *shader_path)
return true;
}
static bool d3d9_process_shader(d3d_video_t *d3d)
static bool d3d9_process_shader(d3d9_video_t *d3d)
{
const char *shader_path = d3d->shader_path;
if (d3d && !string_is_empty(shader_path) &&
@@ -395,7 +395,7 @@ static bool d3d9_process_shader(d3d_video_t *d3d)
static void d3d9_viewport_info(void *data, struct video_viewport *vp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if ( d3d &&
d3d->renderchain_driver &&
@@ -407,16 +407,17 @@ static void d3d9_set_mvp(void *data,
void *shader_data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
d3d9_set_vertex_shader_constantf(d3d->dev, 0, (const float*)mat_data, 4);
}
static void d3d9_overlay_render(d3d_video_t *d3d,
static void d3d9_overlay_render(d3d9_video_t *d3d,
video_frame_info_t *video_info,
overlay_t *overlay, bool force_linear)
{
D3DTEXTUREFILTERTYPE filter_type;
LPDIRECT3DVERTEXDECLARATION9 vertex_decl;
LPDIRECT3DDEVICE9 dev;
struct video_viewport vp;
void *verts;
unsigned i;
@@ -436,10 +437,12 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
if (!d3d || !overlay || !overlay->tex)
return;
dev = d3d->dev;
if (!overlay->vert_buf)
{
overlay->vert_buf = d3d9_vertex_buffer_new(
d3d->dev, sizeof(vert), D3DUSAGE_WRITEONLY,
dev, sizeof(vert), D3DUSAGE_WRITEONLY,
#ifdef _XBOX
0,
#else
@@ -477,18 +480,18 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
vert[2].v = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3].v = overlay->tex_coords[1] + overlay->tex_coords[3];
verts = d3d9_vertex_buffer_lock(overlay->vert_buf);
verts = d3d9_vertex_buffer_lock((LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf);
memcpy(verts, vert, sizeof(vert));
d3d9_vertex_buffer_unlock(overlay->vert_buf);
d3d9_vertex_buffer_unlock((LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf);
d3d9_enable_blend_func(d3d->dev);
/* set vertex declaration for overlay. */
d3d9_vertex_declaration_new(d3d->dev, &vElems, (void**)&vertex_decl);
d3d9_set_vertex_declaration(d3d->dev, vertex_decl);
d3d9_vertex_declaration_new(dev, &vElems, (void**)&vertex_decl);
d3d9_set_vertex_declaration(dev, vertex_decl);
d3d9_vertex_declaration_free(vertex_decl);
d3d9_set_stream_source(d3d->dev, 0, overlay->vert_buf,
d3d9_set_stream_source(dev, 0, (LPDIRECT3DVERTEXBUFFER9)overlay->vert_buf,
0, sizeof(*vert));
if (overlay->fullscreen)
@@ -501,7 +504,7 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
vp_full.Height = height;
vp_full.MinZ = 0.0f;
vp_full.MaxZ = 1.0f;
d3d9_set_viewports(d3d->dev, &vp_full);
d3d9_set_viewports(dev, &vp_full);
}
filter_type = D3DTEXF_LINEAR;
@@ -514,28 +517,28 @@ static void d3d9_overlay_render(d3d_video_t *d3d,
}
/* Render overlay. */
d3d9_set_texture(d3d->dev, 0, overlay->tex);
d3d9_set_sampler_address_u(d3d->dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_address_v(d3d->dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_minfilter(d3d->dev, 0, filter_type);
d3d9_set_sampler_magfilter(d3d->dev, 0, filter_type);
d3d9_draw_primitive(d3d->dev, D3DPT_TRIANGLESTRIP, 0, 2);
d3d9_set_texture(dev, 0, (LPDIRECT3DTEXTURE9)overlay->tex);
d3d9_set_sampler_address_u(dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_address_v(dev, 0, D3DTADDRESS_BORDER);
d3d9_set_sampler_minfilter(dev, 0, filter_type);
d3d9_set_sampler_magfilter(dev, 0, filter_type);
d3d9_draw_primitive(dev, D3DPT_TRIANGLESTRIP, 0, 2);
/* Restore previous state. */
d3d9_disable_blend_func(d3d->dev);
d3d9_set_viewports(d3d->dev, &d3d->final_viewport);
d3d9_disable_blend_func(dev);
d3d9_set_viewports(dev, &d3d->final_viewport);
}
static void d3d9_free_overlay(d3d_video_t *d3d, overlay_t *overlay)
static void d3d9_free_overlay(d3d9_video_t *d3d, overlay_t *overlay)
{
if (!d3d)
return;
d3d9_texture_free(overlay->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)overlay->tex);
d3d9_vertex_buffer_free(overlay->vert_buf, NULL);
}
static void d3d9_deinit_chain(d3d_video_t *d3d)
static void d3d9_deinit_chain(d3d9_video_t *d3d)
{
if (!d3d || !d3d->renderchain_driver)
return;
@@ -547,7 +550,7 @@ static void d3d9_deinit_chain(d3d_video_t *d3d)
d3d->renderchain_data = NULL;
}
static void d3d9_deinitialize(d3d_video_t *d3d)
static void d3d9_deinitialize(d3d9_video_t *d3d)
{
if (!d3d)
return;
@@ -597,7 +600,7 @@ static bool d3d9_is_windowed_enable(bool info_fullscreen)
}
#ifdef _XBOX
static void d3d9_get_video_size(d3d_video_t *d3d,
static void d3d9_get_video_size(d3d9_video_t *d3d,
unsigned *width, unsigned *height)
{
XVIDEO_MODE video_mode;
@@ -628,7 +631,7 @@ static void d3d9_get_video_size(d3d_video_t *d3d,
void d3d9_make_d3dpp(void *data,
const video_info_t *info, void *_d3dpp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
D3DPRESENT_PARAMETERS *d3dpp = (D3DPRESENT_PARAMETERS*)_d3dpp;
#ifdef _XBOX
/* TODO/FIXME - get rid of global state dependencies. */
@@ -708,11 +711,11 @@ void d3d9_make_d3dpp(void *data,
static bool d3d9_init_base(void *data, const video_info_t *info)
{
D3DPRESENT_PARAMETERS d3dpp;
HWND focus_window = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
HWND focus_window = NULL;
d3d9_video_t *d3d = (d3d9_video_t*)data;
#ifndef _XBOX
focus_window = win32_get_window();
focus_window = win32_get_window();
#endif
memset(&d3dpp, 0, sizeof(d3dpp));
@@ -747,9 +750,9 @@ static void d3d9_calculate_rect(void *data,
bool force_full,
bool allow_rotate)
{
float device_aspect = (float)*width / *height;
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
float device_aspect = (float)*width / *height;
d3d9_video_t *d3d = (d3d9_video_t*)data;
settings_t *settings = config_get_ptr();
video_driver_get_size(width, height);
@@ -827,7 +830,7 @@ static void d3d9_set_viewport(void *data,
{
int x = 0;
int y = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
d3d9_calculate_rect(data, &width, &height, &x, &y,
force_full, allow_rotate);
@@ -849,7 +852,7 @@ static void d3d9_set_viewport(void *data,
d3d->renderchain_driver->set_font_rect(d3d, NULL);
}
static bool d3d9_initialize(d3d_video_t *d3d, const video_info_t *info)
static bool d3d9_initialize(d3d9_video_t *d3d, const video_info_t *info)
{
unsigned width, height;
bool ret = true;
@@ -947,7 +950,7 @@ static bool d3d9_initialize(d3d_video_t *d3d, const video_info_t *info)
static bool d3d9_restore(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return false;
@@ -969,7 +972,7 @@ static bool d3d9_restore(void *data)
static void d3d9_set_nonblock_state(void *data, bool state)
{
unsigned interval = state ? 0 : 1;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
@@ -990,12 +993,12 @@ static void d3d9_set_nonblock_state(void *data, bool state)
static bool d3d9_alive(void *data)
{
unsigned temp_width = 0;
unsigned temp_height = 0;
bool ret = false;
bool quit = false;
bool resize = false;
d3d_video_t *d3d = (d3d_video_t*)data;
unsigned temp_width = 0;
unsigned temp_height = 0;
bool ret = false;
bool quit = false;
bool resize = false;
d3d9_video_t *d3d = (d3d9_video_t*)data;
/* Needed because some context drivers don't track their sizes */
video_driver_get_size(&temp_width, &temp_height);
@@ -1034,7 +1037,7 @@ static bool d3d9_suppress_screensaver(void *data, bool enable)
static void d3d9_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
switch (aspect_ratio_idx)
{
@@ -1066,7 +1069,7 @@ static void d3d9_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
static void d3d9_apply_state_changes(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (d3d)
d3d->should_resize = true;
}
@@ -1076,14 +1079,15 @@ static void d3d9_set_osd_msg(void *data,
const char *msg,
const void *params, void *font)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
LPDIRECT3DDEVICE9 dev = d3d->dev;
if (d3d->renderchain_driver->set_font_rect && params)
d3d->renderchain_driver->set_font_rect(d3d, params);
d3d9_begin_scene(d3d->dev);
d3d9_begin_scene(dev);
font_driver_render_msg(video_info, font, msg, (const struct font_params *)params);
d3d9_end_scene(d3d->dev);
d3d9_end_scene(dev);
}
static void d3d9_input_driver(
@@ -1118,7 +1122,7 @@ static void d3d9_input_driver(
#endif
}
static bool d3d9_init_internal(d3d_video_t *d3d,
static bool d3d9_init_internal(d3d9_video_t *d3d,
const video_info_t *info, const input_driver_t **input,
void **input_data)
{
@@ -1238,7 +1242,7 @@ static bool d3d9_init_internal(d3d_video_t *d3d,
static void d3d9_set_rotation(void *data, unsigned rot)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
if (!d3d)
@@ -1257,7 +1261,7 @@ static void d3d9_show_mouse(void *data, bool state)
static void *d3d9_init(const video_info_t *info,
const input_driver_t **input, void **input_data)
{
d3d_video_t *d3d = (d3d_video_t*)calloc(1, sizeof(*d3d));
d3d9_video_t *d3d = (d3d9_video_t*)calloc(1, sizeof(*d3d));
if (!d3d)
return NULL;
@@ -1296,7 +1300,7 @@ static void *d3d9_init(const video_info_t *info,
}
#ifdef HAVE_OVERLAY
static void d3d9_free_overlays(d3d_video_t *d3d)
static void d3d9_free_overlays(d3d9_video_t *d3d)
{
unsigned i;
@@ -1313,7 +1317,7 @@ static void d3d9_free_overlays(d3d_video_t *d3d)
static void d3d9_free(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
@@ -1357,7 +1361,8 @@ static void d3d9_overlay_tex_geom(
float x, float y,
float w, float h)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
@@ -1373,7 +1378,8 @@ static void d3d9_overlay_vertex_geom(
float x, float y,
float w, float h)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
@@ -1390,7 +1396,7 @@ static bool d3d9_overlay_load(void *data,
{
unsigned i, y;
overlay_t *new_overlays = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
const struct texture_image *images = (const struct texture_image*)
image_data;
@@ -1421,7 +1427,7 @@ static bool d3d9_overlay_load(void *data,
return false;
}
if (d3d9_lock_rectangle(overlay->tex, 0, &d3dlr,
if (d3d9_lock_rectangle((LPDIRECT3DTEXTURE9)overlay->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
uint32_t *dst = (uint32_t*)(d3dlr.pBits);
@@ -1430,7 +1436,7 @@ static bool d3d9_overlay_load(void *data,
for (y = 0; y < height; y++, dst += pitch, src += width)
memcpy(dst, src, width << 2);
d3d9_unlock_rectangle(overlay->tex);
d3d9_unlock_rectangle((LPDIRECT3DTEXTURE9)overlay->tex);
}
overlay->tex_w = width;
@@ -1447,7 +1453,7 @@ static bool d3d9_overlay_load(void *data,
static void d3d9_overlay_enable(void *data, bool state)
{
unsigned i;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
@@ -1461,7 +1467,7 @@ static void d3d9_overlay_enable(void *data, bool state)
static void d3d9_overlay_full_screen(void *data, bool enable)
{
unsigned i;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
for (i = 0; i < d3d->overlays_size; i++)
d3d->overlays[i].fullscreen = enable;
@@ -1469,7 +1475,7 @@ static void d3d9_overlay_full_screen(void *data, bool enable)
static void d3d9_overlay_set_alpha(void *data, unsigned index, float mod)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (d3d)
d3d->overlays[index].alpha_mod = mod;
}
@@ -1534,7 +1540,7 @@ static bool d3d9_frame(void *data, const void *frame,
{
D3DVIEWPORT9 screen_vp;
unsigned i = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
(void)i;
@@ -1605,8 +1611,8 @@ static bool d3d9_frame(void *data, const void *frame,
d3d9_overlay_render(d3d, video_info, d3d->menu, false);
d3d->menu_display.offset = 0;
d3d9_set_vertex_declaration(d3d->dev, d3d->menu_display.decl);
d3d9_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, sizeof(Vertex));
d3d9_set_vertex_declaration(d3d->dev, (LPDIRECT3DVERTEXDECLARATION9)d3d->menu_display.decl);
d3d9_set_stream_source(d3d->dev, 0, (LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer, 0, sizeof(Vertex));
d3d9_set_viewports(d3d->dev, &screen_vp);
menu_driver_frame(video_info);
@@ -1652,7 +1658,7 @@ static bool d3d9_frame(void *data, const void *frame,
static bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if ( !d3d ||
!d3d->renderchain_driver ||
@@ -1665,7 +1671,7 @@ static bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
static bool d3d9_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
char *old_shader = (d3d && !string_is_empty(d3d->shader_path)) ? strdup(d3d->shader_path) : NULL;
if (!string_is_empty(d3d->shader_path))
@@ -1704,7 +1710,7 @@ static void d3d9_set_menu_texture_frame(void *data,
float alpha)
{
D3DLOCKED_RECT d3dlr;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
(void)d3dlr;
(void)frame;
@@ -1718,7 +1724,7 @@ static void d3d9_set_menu_texture_frame(void *data,
d3d->menu->tex_h != height)
{
if (d3d->menu)
d3d9_texture_free(d3d->menu->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d->menu->tex = d3d9_texture_new(d3d->dev, NULL,
width, height, 1,
@@ -1737,7 +1743,7 @@ static void d3d9_set_menu_texture_frame(void *data,
d3d->menu->alpha_mod = alpha;
if (d3d9_lock_rectangle(d3d->menu->tex, 0, &d3dlr,
if (d3d9_lock_rectangle((LPDIRECT3DTEXTURE9)d3d->menu->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
unsigned h, w;
@@ -1778,14 +1784,14 @@ static void d3d9_set_menu_texture_frame(void *data,
if (d3d->menu)
d3d9_unlock_rectangle(d3d->menu->tex);
d3d9_unlock_rectangle((LPDIRECT3DTEXTURE9)d3d->menu->tex);
}
}
static void d3d9_set_menu_texture_enable(void *data,
bool state, bool full_screen)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d || !d3d->menu)
return;
@@ -1809,7 +1815,7 @@ static void d3d9_video_texture_load_d3d(
LPDIRECT3DTEXTURE9 tex = NULL;
unsigned usage = 0;
bool want_mipmap = false;
d3d_video_t *d3d = (d3d_video_t*)info->userdata;
d3d9_video_t *d3d = (d3d9_video_t*)info->userdata;
struct texture_image *ti = (struct texture_image*)info->data;
if (!ti)
+3 -4
View File
@@ -1687,7 +1687,8 @@ static void gl_begin_debug(gl_t *gl)
extern gl_renderchain_driver_t gl2_renderchain;
static const gl_renderchain_driver_t *renderchain_gl_drivers[] = {
&gl2_renderchain
&gl2_renderchain,
NULL
};
static bool renderchain_gl_init_first(
@@ -2604,9 +2605,7 @@ static uint32_t gl_get_flags(void *data)
{
uint32_t flags = 0;
if (gl_check_capability(GL_CAPS_SYNC))
BIT32_SET(flags, GFX_CTX_FLAGS_HARD_SYNC);
BIT32_SET(flags, GFX_CTX_FLAGS_HARD_SYNC);
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
+2 -3
View File
@@ -179,9 +179,8 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
mali->native_window.width = vinfo.xres;
mali->native_window.height = vinfo.yres;
mali->refresh_rate =
ctx->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len)
mali->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len) /
(vinfo.xres + vinfo.left_margin + vinfo.right_margin + vinfo.hsync_len);
#ifdef HAVE_EGL
+1 -1
View File
@@ -124,7 +124,7 @@ typedef struct Hints
} Hints;
/* We use long because X11 wants 32-bit pixels for 32-bit systems and 64 for 64... */
const unsigned long retroarch_icon_data[] = {
static const unsigned long retroarch_icon_data[] = {
16, 16,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+2 -2
View File
@@ -48,7 +48,7 @@ typedef struct d3dx_font_desc
typedef struct
{
d3d_video_t *d3d;
d3d9_video_t *d3d;
void *font;
uint32_t font_size;
uint32_t ascent;
@@ -80,7 +80,7 @@ static void *d3dfonts_w32_init_font(void *video_data,
#endif
d3dfonts->font_size = font_size * 1.2; /* to match the other font drivers */
d3dfonts->d3d = (d3d_video_t*)video_data;
d3dfonts->d3d = (d3d9_video_t*)video_data;
desc.Height = d3dfonts->font_size;
+2 -2
View File
@@ -29,7 +29,7 @@
typedef struct
{
d3d_video_t *d3d;
d3d8_video_t *d3d;
XFONT *debug_font;
D3DSurface *surf;
} xfonts_t;
@@ -46,7 +46,7 @@ static void *xfonts_init_font(void *video_data,
(void)font_path;
(void)font_size;
xfont->d3d = (d3d_video_t*)video_data;
xfont->d3d = (d3d8_video_t*)video_data;
XFONT_OpenDefaultFont(&xfont->debug_font);
+22 -155
View File
@@ -49,15 +49,10 @@ struct XPR_HEADER
/* structure member offsets matter */
struct XBRESOURCE
{
#if defined(_XBOX1)
char *strName;
DWORD dwOffset;
#elif defined(_XBOX360)
DWORD dwType;
DWORD dwOffset;
DWORD dwSize;
char *strName;
#endif
};
enum
@@ -90,39 +85,19 @@ class PackedResource
BOOL m_bInitialized; /* Resource is fully initialized */
/* Retrieves the resource tags */
void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags );
/* Functions to retrieve resources by their name */
void *GetData( const char* strName );
void *GetTexture(const char* strName);
LPDIRECT3DTEXTURE9 *GetTexture(const char* strName);
/* Constructor/destructor */
PackedResource();
~PackedResource();
};
void *PackedResource::GetTexture(const char* strName)
LPDIRECT3DTEXTURE9 *PackedResource::GetTexture(const char* strName)
{
#ifdef _XBOX1
LPDIRECT3DRESOURCE8 pResource = (LPDIRECT3DRESOURCE8)GetData(strName);
/* Register the resource, if it has not yet been registered. We mark
* a resource as registered by upping it's reference count. */
if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 )
{
/* Special case CPU-copy push buffers (which live in system memory) */
if( ( pResource->Common & D3DCOMMON_TYPE_PUSHBUFFER ) &&
( pResource->Common & D3DPUSHBUFFER_RUN_USING_CPU_COPY ) )
pResource->Data += (DWORD)m_pSysMemData;
else
pResource->Register( m_pVidMemData );
pResource->AddRef();
}
return (LPDIRECT3DTEXTURE8)pResource;
#elif defined(_XBOX360)
LPDIRECT3DRESOURCE9 pResource = (LPDIRECT3DRESOURCE9)GetData(strName);
return (LPDIRECT3DTEXTURE9)pResource;
#endif
LPDIRECT3DRESOURCE9 pResource = (LPDIRECT3DRESOURCE9)GetData(strName);
return (LPDIRECT3DTEXTURE9)pResource;
}
PackedResource::PackedResource()
@@ -146,11 +121,7 @@ void *PackedResource::GetData(const char *strName)
if (!m_pResourceTags || !strName)
return NULL;
#if defined(_XBOX1)
for (DWORD i=0; m_pResourceTags[i].strName; i++)
#elif defined(_XBOX360)
for (DWORD i = 0; i < m_dwNumResourceTags; i++)
#endif
{
if (string_is_equal_noncase(strName, m_pResourceTags[i].strName))
return &m_pSysMemData[m_pResourceTags[i].dwOffset];
@@ -161,106 +132,38 @@ void *PackedResource::GetData(const char *strName)
static INLINE void* AllocateContiguousMemory(DWORD Size, DWORD Alignment)
{
#if defined(_XBOX1)
return D3D_AllocContiguousMemory(Size, Alignment);
#elif defined(_XBOX360)
return XMemAlloc(Size, MAKE_XALLOC_ATTRIBUTES(0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
Alignment, XALLOC_MEMPROTECT_WRITECOMBINE, 0, XALLOC_MEMTYPE_PHYSICAL));
#endif
}
static INLINE void FreeContiguousMemory(void* pData)
{
#if defined(_XBOX1)
return D3D_FreeContiguousMemory(pData);
#elif defined(_XBOX360)
return XMemFree(pData, MAKE_XALLOC_ATTRIBUTES(0, 0, 0, 0, eXALLOCAllocatorId_GameMax,
0, 0, 0, XALLOC_MEMTYPE_PHYSICAL));
#endif
}
#ifdef _XBOX1
char g_strMediaPath[512] = "D:\\Media\\";
static HRESULT FindMediaFile(char *strPath, const char *strFilename, size_t strPathsize)
{
if (!strFilename || !strPath)
return E_INVALIDARG;
strlcpy(strPath, strFilename, strPathsize);
if(strFilename[1] != ':')
snprintf(strPath, strPathsize, "%s%s", g_strMediaPath, strFilename);
HANDLE hFile = CreateFile(strPath, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return 0x82000004;
CloseHandle(hFile);
return S_OK;
}
#endif
HRESULT PackedResource::Create(const char *strFilename,
DWORD dwNumResourceTags, void* pResourceTags)
{
unsigned i;
HANDLE hFile;
DWORD dwNumBytesRead;
XPR_HEADER xprh;
bool retval = false;
#ifdef _XBOX360
(void)dwNumResourceTags;
(void)pResourceTags;
#endif
#ifdef _XBOX1
char strResourcePath[512];
bool bHasResourceOffsetsTable = false;
if (FAILED(FindMediaFile(strResourcePath, strFilename, sizeof(strResourcePath))))
return E_FAIL;
strFilename = strResourcePath;
#endif
hFile = CreateFile(strFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
HANDLE hFile = CreateFile(strFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return E_FAIL;
retval = ReadFile(hFile, &xprh, sizeof(XPR_HEADER), &dwNumBytesRead, NULL);
#if defined(_XBOX1)
if(xprh.dwMagic == XPR0_MAGIC_VALUE)
bHasResourceOffsetsTable = false;
else if(xprh.dwMagic == XPR1_MAGIC_VALUE)
bHasResourceOffsetsTable = true;
else
#elif defined(_XBOX360)
if(!retval)
{
CloseHandle(hFile);
return E_FAIL;
}
if (xprh.dwMagic != XPR2_MAGIC_VALUE)
#endif
if (!ReadFile(hFile, &xprh, sizeof(XPR_HEADER), &dwNumBytesRead, NULL) ||
xprh.dwMagic != XPR2_MAGIC_VALUE)
{
CloseHandle(hFile);
return E_FAIL;
}
/* Compute memory requirements */
#if defined(_XBOX1)
m_dwSysMemDataSize = xprh.dwHeaderSize - sizeof(XPR_HEADER);
m_dwVidMemDataSize = xprh.dwTotalSize - xprh.dwHeaderSize;
#elif defined(_XBOX360)
m_dwSysMemDataSize = xprh.dwHeaderSize;
m_dwVidMemDataSize = xprh.dwDataSize;
#endif
/* Allocate memory */
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
@@ -272,12 +175,8 @@ HRESULT PackedResource::Create(const char *strFilename,
}
m_pVidMemData = (BYTE*)AllocateContiguousMemory(m_dwVidMemDataSize,
#if defined(_XBOX1)
D3DTEXTURE_ALIGNMENT
#elif defined(_XBOX360)
XALLOC_PHYSICAL_ALIGNMENT_4K
#endif
);
);
if(!m_pVidMemData)
{
@@ -299,59 +198,27 @@ HRESULT PackedResource::Create(const char *strFilename,
/* Done with the file */
CloseHandle( hFile);
#ifdef _XBOX1
if (bHasResourceOffsetsTable)
/* Extract resource table from the header data */
m_dwNumResourceTags = *(DWORD*)(m_pSysMemData + 0);
m_pResourceTags = (XBRESOURCE*)(m_pSysMemData + 4);
/* Patch up the resources */
for(i = 0; i < m_dwNumResourceTags; i++)
{
#endif
/* Extract resource table from the header data */
m_dwNumResourceTags = *(DWORD*)(m_pSysMemData + 0);
m_pResourceTags = (XBRESOURCE*)(m_pSysMemData + 4);
/* Patch up the resources */
for(i = 0; i < m_dwNumResourceTags; i++)
m_pResourceTags[i].strName = (char*)(m_pSysMemData + (DWORD)m_pResourceTags[i].strName);
if((m_pResourceTags[i].dwType & 0xffff0000) == (RESOURCETYPE_TEXTURE & 0xffff0000))
{
m_pResourceTags[i].strName = (char*)(m_pSysMemData + (DWORD)m_pResourceTags[i].strName);
#ifdef _XBOX360
if((m_pResourceTags[i].dwType & 0xffff0000) == (RESOURCETYPE_TEXTURE & 0xffff0000))
{
D3DTexture *pTexture = (D3DTexture*)&m_pSysMemData[m_pResourceTags[i].dwOffset];
XGOffsetBaseTextureAddress(pTexture, m_pVidMemData, m_pVidMemData);
}
#endif
D3DTexture *pTexture = (D3DTexture*)&m_pSysMemData[m_pResourceTags[i].dwOffset];
XGOffsetBaseTextureAddress(pTexture, m_pVidMemData, m_pVidMemData);
}
#ifdef _XBOX1
}
#endif
#ifdef _XBOX1
/* Use user-supplied number of resources and the resource tags */
if(dwNumResourceTags != 0 || pResourceTags != NULL)
{
m_pResourceTags = (XBRESOURCE*)pResourceTags;
m_dwNumResourceTags = dwNumResourceTags;
}
#endif
m_bInitialized = true;
return S_OK;
}
void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags,
XBRESOURCE** ppResourceTags)
{
#ifdef _XBOX360
if (pdwNumResourceTags)
(*pdwNumResourceTags) = m_dwNumResourceTags;
if (ppResourceTags)
(*ppResourceTags) = m_pResourceTags;
#endif
}
void PackedResource::Destroy()
{
free(m_pSysMemData);
@@ -388,7 +255,7 @@ typedef struct
typedef struct
{
Font_Locals_t s_FontLocals;
d3d_video_t *d3d;
d3d9_video_t *d3d;
uint32_t m_dwSavedState;
uint32_t m_cMaxGlyph; /* Number of entries in the translator table. */
uint32_t m_dwNumGlyphs; /* Number of valid glyphs. */
@@ -493,7 +360,7 @@ static void *xdk360_init_font(void *video_data,
(void)font_size;
font->d3d = (d3d_video_t*)video_data;
font->d3d = (d3d9_video_t*)video_data;
font->m_pFontTexture = NULL;
font->m_dwNumGlyphs = 0L;
@@ -776,7 +776,7 @@ static void *d3d9_cg_renderchain_new(void)
static bool d3d9_cg_renderchain_init_shader(void *data,
void *renderchain_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
cg_renderchain_t *renderchain = (cg_renderchain_t*)renderchain_data;
if (!d3d || !renderchain)
@@ -913,7 +913,7 @@ static bool d3d9_cg_renderchain_init(void *data,
const void *info_data, bool rgb32)
{
const struct LinkInfo *info = (const struct LinkInfo*)info_data;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
cg_renderchain_t *chain = (cg_renderchain_t*)d3d->renderchain_data;
const video_info_t *video_info = (const video_info_t*)_video_info;
unsigned fmt = (rgb32) ? RETRO_PIXEL_FORMAT_XRGB8888 : RETRO_PIXEL_FORMAT_RGB565;
@@ -1027,7 +1027,7 @@ static void d3d9_cg_renderchain_convert_geometry(
}
static void d3d_recompute_pass_sizes(cg_renderchain_t *chain,
d3d_video_t *d3d)
d3d9_video_t *d3d)
{
unsigned i;
struct LinkInfo link_info;
@@ -1076,7 +1076,7 @@ static void d3d9_cg_renderchain_set_final_viewport(
void *renderchain_data,
const void *viewport_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
cg_renderchain_t *chain = (cg_renderchain_t*)renderchain_data;
const D3DVIEWPORT9 *final_viewport = (const D3DVIEWPORT9*)viewport_data;
@@ -1493,7 +1493,7 @@ static bool d3d9_cg_renderchain_render(
LPDIRECT3DSURFACE9 back_buffer, target;
unsigned i, current_width, current_height, out_width = 0, out_height = 0;
struct Pass *last_pass = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
cg_renderchain_t *chain = d3d ? (cg_renderchain_t*)d3d->renderchain_data : NULL;
d3d9_cg_renderchain_start_render(chain);
@@ -1596,7 +1596,7 @@ static void d3d9_cg_renderchain_set_font_rect(
const void *font_data)
{
settings_t *settings = config_get_ptr();
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
float pos_x = settings->floats.video_msg_pos_x;
float pos_y = settings->floats.video_msg_pos_y;
float font_size = settings->floats.video_font_size;
@@ -1632,8 +1632,8 @@ static bool d3d9_cg_renderchain_read_viewport(
LPDIRECT3DSURFACE9 target = NULL;
LPDIRECT3DSURFACE9 dest = NULL;
bool ret = true;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE9 d3dr = (LPDIRECT3DDEVICE9)d3d->dev;
d3d9_video_t *d3d = (d3d9_video_t*)data;
LPDIRECT3DDEVICE9 d3dr = d3d->dev;
video_driver_get_size(&width, &height);
@@ -1690,7 +1690,7 @@ static void d3d9_cg_renderchain_viewport_info(
void *data, struct video_viewport *vp)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d || !vp)
return;
@@ -63,8 +63,8 @@ static bool hlsl_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
{ 0, 2 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
D3DDECL_END()
};
d3d_video_t *d3d = (d3d_video_t*)data;
d3d_video_t *pass = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
d3d9_video_t *pass = (d3d9_video_t*)data;
hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)
d3d->renderchain_data;
@@ -77,7 +77,7 @@ static bool hlsl_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
static bool hlsl_d3d9_renderchain_create_first_pass(void *data,
const video_info_t *info)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)
d3d->renderchain_data;
@@ -122,7 +122,7 @@ static void hlsl_d3d9_renderchain_set_vertices(
video_shader_ctx_params_t params;
video_shader_ctx_info_t shader_info;
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
hlsl_d3d9_renderchain_t *chain = d3d ?
(hlsl_d3d9_renderchain_t*)d3d->renderchain_data : NULL;
@@ -242,7 +242,7 @@ static void hlsl_d3d9_renderchain_deinit_shader(void *data)
static void hlsl_d3d9_renderchain_free(void *data)
{
d3d_video_t *chain = (d3d_video_t*)data;
d3d9_video_t *chain = (d3d9_video_t*)data;
if (!chain)
return;
@@ -266,7 +266,7 @@ static bool hlsl_d3d9_renderchain_init_shader(void *data,
void *renderchain_data)
{
video_shader_ctx_init_t init;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
settings_t *settings = config_get_ptr();
(void)renderchain_data;
@@ -292,7 +292,7 @@ static bool hlsl_d3d9_renderchain_init(void *data,
)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
const video_info_t *video_info = (const video_info_t*)_video_info;
const struct LinkInfo *link_info = (const struct LinkInfo*)info_data;
hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)
@@ -342,7 +342,7 @@ static bool hlsl_d3d9_renderchain_render(void *data, const void *frame,
{
unsigned i;
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
settings_t *settings = config_get_ptr();
hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*)d3d->renderchain_data;
bool video_smooth = settings->bools.video_smooth;
@@ -411,7 +411,7 @@ static void hlsl_d3d9_renderchain_viewport_info(
void *data, struct video_viewport *vp)
{
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d || !vp)
return;
+5 -5
View File
@@ -23,7 +23,7 @@ typedef enum glslang_format
{
SLANG_FORMAT_UNKNOWN = 0,
// 8-bit
/* 8-bit */
SLANG_FORMAT_R8_UNORM,
SLANG_FORMAT_R8_UINT,
SLANG_FORMAT_R8_SINT,
@@ -35,11 +35,11 @@ typedef enum glslang_format
SLANG_FORMAT_R8G8B8A8_SINT,
SLANG_FORMAT_R8G8B8A8_SRGB,
// 10-bit
/* 10-bit */
SLANG_FORMAT_A2B10G10R10_UNORM_PACK32,
SLANG_FORMAT_A2B10G10R10_UINT_PACK32,
// 16-bit
/* 16-bit */
SLANG_FORMAT_R16_UINT,
SLANG_FORMAT_R16_SINT,
SLANG_FORMAT_R16_SFLOAT,
@@ -50,7 +50,7 @@ typedef enum glslang_format
SLANG_FORMAT_R16G16B16A16_SINT,
SLANG_FORMAT_R16G16B16A16_SFLOAT,
// 32-bit
/* 32-bit */
SLANG_FORMAT_R32_UINT,
SLANG_FORMAT_R32_SINT,
SLANG_FORMAT_R32_SFLOAT,
@@ -105,7 +105,7 @@ struct glslang_output
bool glslang_compile_shader(const char *shader_path, glslang_output *output);
// Helpers for internal use.
/* Helpers for internal use. */
bool glslang_read_shader_file(const char *path, std::vector<std::string> *output, bool root_file);
bool glslang_parse_meta(const std::vector<std::string> &lines, glslang_meta *meta);
#endif
+2 -2
View File
@@ -454,8 +454,8 @@ error:
static void *hlsl_init(void *data, const char *path)
{
unsigned i;
d3d_video_t *d3d = (d3d_video_t*)data;
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)
d3d9_video_t *d3d = (d3d9_video_t*)data;
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)
calloc(1, sizeof(hlsl_shader_data_t));
if (!hlsl || !d3d)
+1 -1
View File
@@ -277,7 +277,7 @@ static bool slang_process_reflection(
shader_info->pass[index].feedback = true;
if (semantic == SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY &&
shader_info->history_size < index)
(unsigned)shader_info->history_size < index)
shader_info->history_size = index;
}
+12 -11
View File
@@ -43,7 +43,7 @@ static void crt_check_first_run(void)
if (!first_run)
return;
video_display_server_get_current_resolution(&orig_width, &orig_height);
first_run = false;
}
@@ -52,19 +52,21 @@ static void switch_crt_hz(void)
{
if (ra_core_hz == ra_tmp_core_hz)
return;
/* set hz float an int for windows switching */
/* set hz float to an int for windows switching */
if (ra_core_hz < 53)
ra_set_core_hz = 50;
if (ra_core_hz >= 53 && ra_core_hz < 57)
ra_set_core_hz = 55;
if (ra_core_hz >= 57)
ra_set_core_hz = 60;
video_monitor_set_refresh_rate(ra_set_core_hz);
ra_tmp_core_hz = ra_core_hz;
}
static void crt_aspect_ratio_switch(unsigned width, unsigned height)
void crt_aspect_ratio_switch(unsigned width, unsigned height)
{
/* send aspect float to videeo_driver */
fly_aspect = (float)width / height;
@@ -76,7 +78,7 @@ static void switch_res_crt(unsigned width, unsigned height)
if (height > 100)
{
video_display_server_switch_resolution(width, height,
0, ra_set_core_hz);
ra_set_core_hz, ra_core_hz);
video_driver_apply_state_changes();
}
}
@@ -84,15 +86,17 @@ static void switch_res_crt(unsigned width, unsigned height)
/* Create correct aspect to fit video if resolution does not exist */
static void crt_screen_setup_aspect(unsigned width, unsigned height)
{
switch_crt_hz();
/* get original resolution of core */
if (height == 4)
{
/* detect menu only */
if (width < 1920)
width = 640;
width = 704;
height = 480;
crt_aspect_ratio_switch(width, height);
}
@@ -178,8 +182,5 @@ void crt_video_restore(void)
if (first_run)
return;
video_display_server_switch_resolution(orig_width, orig_height,
0, 60);
first_run = true;
first_run = true;
}
+2
View File
@@ -29,6 +29,8 @@ RETRO_BEGIN_DECLS
void crt_switch_res_core(unsigned width, unsigned height, float hz);
void crt_aspect_ratio_switch(unsigned width, unsigned height);
void crt_video_restore(void);
RETRO_END_DECLS
+2 -11
View File
@@ -82,20 +82,11 @@ bool video_display_server_set_window_decorations(bool on)
return false;
}
bool video_display_server_get_current_resolution(unsigned *width, unsigned *height)
{
if (current_display_server && current_display_server->get_current_resolution)
{
current_display_server->get_current_resolution(width, height);
return true;
}
return false;
}
bool video_display_server_switch_resolution(unsigned width, unsigned height,
int f_restore, int hz)
int int_hz, float hz)
{
if (current_display_server && current_display_server->switch_resolution)
return current_display_server->switch_resolution(current_display_server_data, width, height, f_restore, hz);
return current_display_server->switch_resolution(current_display_server_data, width, height, int_hz, hz);
return false;
}
+2 -6
View File
@@ -30,9 +30,8 @@ typedef struct video_display_server
bool (*set_window_opacity)(void *data, unsigned opacity);
bool (*set_window_progress)(void *data, int progress, bool finished);
bool (*set_window_decorations)(void *data, bool on);
void (*get_current_resolution)(unsigned *width, unsigned *height);
bool (*switch_resolution)(void *data, unsigned width,
unsigned height, int f_restore, int hz);
unsigned height, int int_hz, float hz);
const char *ident;
} video_display_server_t;
@@ -44,14 +43,11 @@ bool video_display_server_set_window_opacity(unsigned opacity);
bool video_display_server_set_window_progress(int progress, bool finished);
bool video_display_server_get_current_resolution(
unsigned *width, unsigned *height);
bool video_display_server_set_window_decorations(bool on);
bool video_display_server_switch_resolution(
unsigned width, unsigned height,
int f_restore, int hz);
int int_hz, float hz);
extern const video_display_server_t dispserv_win32;
extern const video_display_server_t dispserv_x11;
+14 -5
View File
@@ -229,6 +229,8 @@ static void *video_context_data = NULL;
static bool deferred_video_context_driver_set_flags = false;
static gfx_ctx_flags_t deferred_flag_data = {0};
static bool video_started_fullscreen = false;
static shader_backend_t *current_shader = NULL;
static void *current_shader_data = NULL;
@@ -422,6 +424,11 @@ static const shader_backend_t *shader_ctx_drivers[] = {
NULL
};
bool video_driver_started_fullscreen(void)
{
return video_started_fullscreen;
}
/* Stub functions */
static void update_window_title_null(void *data, void *data2)
@@ -1021,6 +1028,8 @@ static bool video_driver_init_internal(bool *video_is_threaded)
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
video.parent = 0;
video_started_fullscreen = video.fullscreen;
/* Reset video frame count */
video_driver_frame_count = 0;
@@ -1631,7 +1640,7 @@ bool video_driver_supports_viewport_read(void)
bool video_driver_supports_read_frame_raw(void)
{
if (current_video->read_frame_raw)
return true;
return true;
return false;
}
@@ -2562,11 +2571,11 @@ void video_driver_frame(const void *data, unsigned width,
compute_audio_buffer_statistics(&audio_stats);
snprintf(video_info.stat_text,
sizeof(video_info.stat_text),
sizeof(video_info.stat_text),
"Video Statistics:\n -Frame rate: %6.2f fps\n -Frame time: %6.2f ms\n -Frame time deviation: %.3f %%\n"
" -Frame count: %" PRIu64"\n -Viewport: %d x %d x %3.2f\n"
"Audio Statistics:\n -Average buffer saturation: %.2f %%\n -Standard deviation: %.2f %%\n -Time spent close to underrun: %.2f %%\n -Time spent close to blocking: %.2f %%\n -Sample count: %d\n"
"Core Geometry:\n -Size: %u x %u\n -Max Size: %u x %u\n -Aspect: %3.2f\nCore Timing:\n -FPS: %3.2f\n -Sample Rate: %6.2f\n",
"Core Geometry:\n -Size: %u x %u\n -Max Size: %u x %u\n -Aspect: %3.2f\nCore Timing:\n -FPS: %3.2f\n -Sample Rate: %6.2f\n",
video_info.frame_rate,
video_info.frame_time,
100.0 * stddev,
@@ -3336,7 +3345,7 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
enum gfx_ctx_api video_context_driver_get_api(void)
{
enum gfx_ctx_api ctx_api = video_context_data ?
enum gfx_ctx_api ctx_api = video_context_data ?
current_video_context.get_api(video_context_data) : GFX_CTX_NONE;
if (ctx_api == GFX_CTX_NONE)
@@ -3436,7 +3445,7 @@ void video_shader_driver_use(void *data)
{
if (current_shader && current_shader->use)
{
video_shader_ctx_info_t *shader_info =
video_shader_ctx_info_t *shader_info =
(video_shader_ctx_info_t*)data;
current_shader->use(shader_info->data, current_shader_data,
shader_info->idx, shader_info->set_active);
+2
View File
@@ -1347,6 +1347,8 @@ float video_driver_get_refresh_rate(void);
extern bool (*video_driver_cb_has_focus)(void);
bool video_driver_started_fullscreen(void);
extern video_driver_t video_gl;
extern video_driver_t video_vulkan;
extern video_driver_t video_psp1;
+7 -9
View File
@@ -33,18 +33,16 @@ MENU
UI
============================================================ */
#if defined(HAVE_QT)
#define HAVE_MAIN /* also requires defining in frontend.c */
#include "../ui/drivers/ui_qt.cpp"
#include "../ui/drivers/qt/ui_qt_window.cpp"
#include "../ui/drivers/qt/ui_qt_load_core_window.cpp"
#include "../ui/drivers/qt/ui_qt_browser_window.cpp"
#include "../ui/drivers/qt/ui_qt_msg_window.cpp"
#include "../ui/drivers/qt/ui_qt_application.cpp"
#endif
#if defined(HAVE_QT_WRAPPER)
#include "../ui/drivers/ui_qt.cpp"
#endif
/*============================================================
VIDEO DRIVER
============================================================ */
@@ -74,11 +72,11 @@ FONTS
#endif
#ifdef WANT_GLSLANG
#ifdef _WIN32
#include "../deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp"
#endif
#ifdef _WIN32
#include "../deps/glslang/glslang/glslang/OSDependent/Windows/ossource.cpp"
#endif
#if defined(__linux__)
#include "../deps/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp"
#include "../deps/glslang/glslang/glslang/OSDependent/Unix/ossource.cpp"
#endif
#endif
+356
View File
@@ -0,0 +1,356 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "hid_device_driver.h"
#define DS3_ACTIVATION_REPORT_ID 0xf4
#define DS3_RUMBLE_REPORT_ID 0x01
typedef struct ds3_instance {
void *handle;
joypad_connection_t *pad;
int slot;
bool led_set;
uint32_t buttons;
int16_t analog_state[3][2];
uint16_t motors[2];
uint8_t data[64];
} ds3_instance_t;
static uint8_t activation_packet[] = {
#if defined(IOS)
0x53, 0xF4,
#elif defined(HAVE_WIIUSB_HID)
0x02,
#endif
0x42, 0x0c, 0x00, 0x00
};
#if defined(WIIU)
#define PACKET_OFFSET 2
#elif defined(HAVE_WIIUSB_HID)
#define PACKET_OFFSET 1
#else
#define PACKET_OFFSET 0
#endif
#define LED_OFFSET 11
#define MOTOR1_OFFSET 4
#define MOTOR2_OFFSET 6
static uint8_t control_packet[] = {
0x52, 0x01,
0x00, 0xff, 0x00, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00
};
static int control_packet_size = sizeof(control_packet);
extern pad_connection_interface_t ds3_pad_connection;
static void update_pad_state(ds3_instance_t *instance);
static void update_analog_state(ds3_instance_t *instance);
static int32_t send_activation_packet(ds3_instance_t *instance)
{
int32_t result;
#if defined(WIIU)
result = HID_SET_REPORT(instance->handle,
HID_REPORT_FEATURE,
DS3_ACTIVATION_REPORT_ID,
activation_packet,
sizeof(activation_packet));
#else
HID_SEND_CONTROL(instance->handle,
activation_packet, sizeof(activation_packet));
#endif
return result;
}
static uint32_t set_protocol(ds3_instance_t *instance, int protocol)
{
uint32_t result = 0;
#if defined(WIIU)
result = HID_SET_PROTOCOL(instance->handle, 1);
#endif
return result;
}
static int32_t send_control_packet(ds3_instance_t *instance)
{
uint8_t packet_buffer[control_packet_size];
int32_t result = 0;
memcpy(packet_buffer, control_packet, control_packet_size);
packet_buffer[LED_OFFSET] = 0;
if(instance->pad) {
packet_buffer[LED_OFFSET] = 1 << ((instance->slot % 4) + 1);
}
packet_buffer[MOTOR1_OFFSET] = instance->motors[1] >> 8;
packet_buffer[MOTOR2_OFFSET] = instance->motors[0] >> 8;
#if defined(HAVE_WIIUSB_HID)
packet_buffer[1] = 0x03;
#endif
#if defined(WIIU)
result = HID_SET_REPORT(instance->handle,
HID_REPORT_OUTPUT,
DS3_RUMBLE_REPORT_ID,
packet_buffer+PACKET_OFFSET,
control_packet_size-PACKET_OFFSET);
#else
HID_SEND_CONTROL(instance->handle,
packet_buffer+PACKET_OFFSET,
control_packet_size-PACKET_OFFSET);
#endif /* WIIU */
return result;
}
static void *ds3_init(void *handle)
{
ds3_instance_t *instance;
int errors = 0;
RARCH_LOG("[ds3]: init\n");
instance = (ds3_instance_t *)calloc(1, sizeof(ds3_instance_t));
if(!instance)
goto error;
memset(instance, 0, sizeof(ds3_instance_t));
instance->handle = handle;
RARCH_LOG("[ds3]: setting protocol\n");
/* this might fail, but we don't care. */
set_protocol(instance, 1);
RARCH_LOG("[ds3]: sending control packet\n");
if(send_control_packet(instance) < 0)
errors++;
RARCH_LOG("[ds3]: sending activation packet\n");
if(send_activation_packet(instance) < 0)
errors++;
if(errors)
goto error;
instance->pad = hid_pad_register(instance, &ds3_pad_connection);
if(!instance->pad)
goto error;
RARCH_LOG("[ds3]: init complete.\n");
return instance;
error:
RARCH_ERR("[ds3]: init failed.\n");
if(instance)
free(instance);
return NULL;
}
static void ds3_free(void *data)
{
ds3_instance_t *instance = (ds3_instance_t *)data;
if(instance) {
hid_pad_deregister(instance->pad);
free(instance);
}
}
static void ds3_handle_packet(void *data, uint8_t *packet, size_t size)
{
ds3_instance_t *instance = (ds3_instance_t *)data;
if(!instance || !instance->pad)
return;
instance->pad->iface->packet_handler(data, packet, size);
}
static bool ds3_detect(uint16_t vendor_id, uint16_t product_id)
{
return vendor_id == VID_SONY && product_id == PID_SONY_DS3;
}
hid_device_t ds3_hid_device = {
ds3_init,
ds3_free,
ds3_handle_packet,
ds3_detect,
"Sony DualShock 3"
};
/**
* pad interface implementation
*/
static void *ds3_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
pad->slot = slot;
return data;
}
static void ds3_pad_deinit(void *data)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
if(pad) {
input_autoconfigure_disconnect(pad->slot, ds3_pad_connection.get_name(pad));
}
}
static void ds3_get_buttons(void *data, input_bits_t *state)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
if(pad)
{
BITS_COPY16_PTR(state, pad->buttons);
if(pad->buttons & 0x10000)
BIT256_SET_PTR(state, RARCH_MENU_TOGGLE);
} else {
BIT256_CLEAR_ALL_PTR(state);
}
}
static void ds3_packet_handler(void *data, uint8_t *packet, uint16_t size)
{
ds3_instance_t *instance = (ds3_instance_t *)data;
if(instance->pad && !instance->led_set)
{
send_control_packet(instance);
instance->led_set = true;
}
if(size > control_packet_size)
{
RARCH_ERR("[ds3]: Expecting packet to be %d but was %d\n",
control_packet_size, size);
return;
}
memcpy(instance->data, packet, size);
update_pad_state(instance);
update_analog_state(instance);
}
static void update_analog_state(ds3_instance_t *instance)
{
int pad_axis;
int16_t interpolated;
unsigned stick, axis;
for(pad_axis = 0; pad_axis < 4; pad_axis++)
{
axis = pad_axis % 2 ? 0 : 1;
stick = pad_axis / 2;
interpolated = instance->data[6+pad_axis];
instance->analog_state[stick][axis] = (interpolated - 128) * 256;
}
}
static void update_pad_state(ds3_instance_t *instance)
{
uint32_t i, pressed_keys;
static const uint32_t button_mapping[17] =
{
RETRO_DEVICE_ID_JOYPAD_SELECT,
RETRO_DEVICE_ID_JOYPAD_L3,
RETRO_DEVICE_ID_JOYPAD_R3,
RETRO_DEVICE_ID_JOYPAD_START,
RETRO_DEVICE_ID_JOYPAD_UP,
RETRO_DEVICE_ID_JOYPAD_RIGHT,
RETRO_DEVICE_ID_JOYPAD_DOWN,
RETRO_DEVICE_ID_JOYPAD_LEFT,
RETRO_DEVICE_ID_JOYPAD_L2,
RETRO_DEVICE_ID_JOYPAD_R2,
RETRO_DEVICE_ID_JOYPAD_L,
RETRO_DEVICE_ID_JOYPAD_R,
RETRO_DEVICE_ID_JOYPAD_X,
RETRO_DEVICE_ID_JOYPAD_A,
RETRO_DEVICE_ID_JOYPAD_B,
RETRO_DEVICE_ID_JOYPAD_Y,
16 /* PS button */
};
instance->buttons = 0;
pressed_keys = instance->data[2]|(instance->data[3] << 8)|((instance->data[4] & 0x01) << 16);
for(i = 0; i < 17; i++)
instance->buttons |= (pressed_keys & (1 << i)) ?
(1 << button_mapping[i]) : 0;
}
static void ds3_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
}
static int16_t ds3_get_axis(void *data, unsigned axis)
{
axis_data axis_data;
ds3_instance_t *pad = (ds3_instance_t *)data;
gamepad_read_axis_data(axis, &axis_data);
if(!pad || axis_data.axis >= 4)
return 0;
return gamepad_get_axis_value(pad->analog_state, &axis_data);
}
static const char *ds3_get_name(void *data)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
return "Sony DualShock 3";
}
static bool ds3_button(void *data, uint16_t joykey)
{
ds3_instance_t *pad = (ds3_instance_t *)data;
if(!pad || joykey > 31)
return false;
return pad->buttons & (1 << joykey);
}
pad_connection_interface_t ds3_pad_connection = {
ds3_pad_init,
ds3_pad_deinit,
ds3_packet_handler,
ds3_set_rumble,
ds3_get_buttons,
ds3_get_axis,
ds3_get_name,
ds3_button
};
+154
View File
@@ -0,0 +1,154 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "hid_device_driver.h"
extern pad_connection_interface_t ds4_pad_connection;
typedef struct ds4_instance {
void *handle;
joypad_connection_t *pad;
int slot;
uint32_t buttons;
uint16_t motors[2];
uint8_t data[64];
} ds4_instance_t;
/**
* I'm leaving this code in here for posterity, and because maybe it can
* be used on other platforms. But using the DS4 on the Wii U directly is
* impossible because it doesn't generate a HID event. Which makes me think
* it's not a HID device at all--at least, not over USB.
*
* I imagine it might be useful in Bluetooth mode, though.
*/
static void *ds4_init(void *handle)
{
ds4_instance_t *instance;
instance = (ds4_instance_t *)calloc(1, sizeof(ds4_instance_t));
if(!instance)
goto error;
memset(instance, 0, sizeof(ds4_instance_t));
instance->handle = handle;
instance->pad = hid_pad_register(instance, &ds4_pad_connection);
if(!instance->pad)
goto error;
RARCH_LOG("[ds4]: init complete.\n");
return instance;
error:
RARCH_ERR("[ds4]: init failed.\n");
if(instance)
free(instance);
return NULL;
}
static void ds4_free(void *data)
{
ds4_instance_t *instance = (ds4_instance_t *)data;
if(instance) {
hid_pad_deregister(instance->pad);
free(instance);
}
}
static void ds4_handle_packet(void *data, uint8_t *buffer, size_t size)
{
ds4_instance_t *instance = (ds4_instance_t *)data;
if(instance && instance->pad)
instance->pad->iface->packet_handler(instance->pad->data, buffer, size);
}
static bool ds4_detect(uint16_t vendor_id, uint16_t product_id)
{
return vendor_id == VID_SONY && product_id == PID_SONY_DS4;
}
hid_device_t ds4_hid_device = {
ds4_init,
ds4_free,
ds4_handle_packet,
ds4_detect,
"Sony DualShock 4"
};
static void *ds4_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
{
ds4_instance_t *instance = (ds4_instance_t *)data;
if(!instance)
return NULL;
instance->slot = slot;
return instance;
}
static void ds4_pad_deinit(void *data)
{
}
static void ds4_get_buttons(void *data, input_bits_t *state)
{
ds4_instance_t *instance = (ds4_instance_t *)data;
if(!instance)
return;
/* TODO: get buttons */
}
static void ds4_packet_handler(void *data, uint8_t *packet, uint16_t size)
{
ds4_instance_t *instance = (ds4_instance_t *)data;
if(!instance)
return;
RARCH_LOG_BUFFER(packet, size);
}
static void ds4_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
{
}
static int16_t ds4_get_axis(void *data, unsigned axis)
{
return 0;
}
static const char *ds4_get_name(void *data)
{
return "Sony DualShock 4";
}
static bool ds4_button(void *data, uint16_t joykey)
{
return false;
}
pad_connection_interface_t ds4_pad_connection = {
ds4_pad_init,
ds4_pad_deinit,
ds4_packet_handler,
ds4_set_rumble,
ds4_get_buttons,
ds4_get_axis,
ds4_get_name,
ds4_button
};
+219
View File
@@ -0,0 +1,219 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "hid_device_driver.h"
extern pad_connection_interface_t null_pad_connection;
/*
* This is the instance data structure for the pad you are implementing.
* This is a good starting point, but you can add/remove things as makes
* sense for the pad you're writing for. The pointer to this structure
* will be passed in as a void pointer to the methods you implement below.
*/
typedef struct null_instance {
void *handle; /* a handle to the HID subsystem adapter */
joypad_connection_t *pad; /* a pointer to the joypad connection you assign
in init() */
int slot; /* which slot does this pad occupy? */
uint32_t buttons; /* a bitmap of the digital buttons for the pad */
uint16_t motors[2]; /* rumble strength, if appropriate */
uint8_t data[64]; /* a buffer large enough to hold the device's
max rx packet */
} null_instance_t;
/**
* Use the HID_ macros (see input/include/hid_driver.h) to send data packets
* to the device. When this method returns, the device needs to be in a state
* where we can read data packets from the device. So, if there's any
* activation packets (see the ds3 and Wii U GameCube adapter drivers for
* examples), send them here.
*
* While you *can* allocate the retro pad here, it isn't mandatory (see
* the Wii U GC adapter).
*
* If initialization fails, return NULL.
*/
static void *null_init(void *handle)
{
null_instance_t *instance;
instance = (null_instance_t *)calloc(1, sizeof(null_instance_t));
if(!instance)
goto error;
memset(instance, 0, sizeof(null_instance_t));
instance->handle = handle;
instance->pad = hid_pad_register(instance, &null_pad_connection);
if(!instance->pad)
goto error;
RARCH_LOG("[null]: init complete.\n");
return instance;
error:
RARCH_ERR("[null]: init failed.\n");
if(instance)
free(instance);
return NULL;
}
/*
* Gets called when the pad is disconnected. It must clean up any memory
* allocated and used by the instance data.
*/
static void null_free(void *data)
{
null_instance_t *instance = (null_instance_t *)data;
if(instance) {
hid_pad_deregister(instance->pad);
free(instance);
}
}
/**
* Handle a single packet from the device.
* For most pads you'd just forward it onto the pad driver (see below).
* A more complicated example is in the Wii U GC adapter driver.
*/
static void null_handle_packet(void *data, uint8_t *buffer, size_t size)
{
null_instance_t *instance = (null_instance_t *)data;
if(instance && instance->pad)
instance->pad->iface->packet_handler(instance->pad->data, buffer, size);
}
/**
* Return true if the passed in VID and PID are supported by the driver.
*/
static bool null_detect(uint16_t vendor_id, uint16_t product_id)
{
return vendor_id == VID_NONE && product_id == PID_NONE;
}
/**
* Assign function pointers to the driver structure.
*/
hid_device_t null_hid_device = {
null_init,
null_free,
null_handle_packet,
null_detect,
"Null HID device"
};
/**
* This is called via hid_pad_register(). In the common case where the
* device only controls one pad, you can simply return the data parameter.
* But if you need to track multiple pads attached to the same HID device
* (see: Wii U GC adapter), you can allocate that memory here.
*/
static void *null_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
{
null_instance_t *instance = (null_instance_t *)data;
if(!instance)
return NULL;
instance->slot = slot;
return instance;
}
/**
* If you allocate any memory in null_pad_init() above, de-allocate it here.
*/
static void null_pad_deinit(void *data)
{
}
/**
* Translate the button data from the pad into the input_bits_t format
* that RetroArch can use.
*/
static void null_get_buttons(void *data, input_bits_t *state)
{
null_instance_t *instance = (null_instance_t *)data;
if(!instance)
return;
/* TODO: get buttons */
}
/**
* Handle a single packet for the pad.
*/
static void null_packet_handler(void *data, uint8_t *packet, uint16_t size)
{
null_instance_t *instance = (null_instance_t *)data;
if(!instance)
return;
RARCH_LOG_BUFFER(packet, size);
}
/**
* If the pad doesn't support rumble, then this can just be a no-op.
*/
static void null_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
{
}
/**
* Read analog sticks.
* If the pad doesn't have any analog axis, just return 0 here.
*
* The return value must conform to the following characteristics:
* - (0, 0) is center
* - (-32768,-32768) is top-left
* - (32767,32767) is bottom-right
*/
static int16_t null_get_axis(void *data, unsigned axis)
{
return 0;
}
/**
* The name the pad will show up as in the UI, also used to auto-assign
* buttons in input/input_autodetect_builtin.c
*/
static const char *null_get_name(void *data)
{
return "Null HID Pad";
}
/**
* Read the state of a single button.
*/
static bool null_button(void *data, uint16_t joykey)
{
return false;
}
/**
* Fill in the joypad interface
*/
pad_connection_interface_t null_pad_connection = {
null_pad_init,
null_pad_deinit,
null_packet_handler,
null_set_rumble,
null_get_buttons,
null_get_axis,
null_get_name,
null_button
};
+362
View File
@@ -0,0 +1,362 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "hid_device_driver.h"
#ifdef WII
static uint8_t activation_packet[] = { 0x01, 0x13 };
#else
static uint8_t activation_packet[] = { 0x13 };
#endif
#define GCA_PORT_INITIALIZING 0x00
#define GCA_PORT_POWERED 0x04
#define GCA_PORT_CONNECTED 0x10
#define GCA_WAVEBIRD_CONNECTED 0x22
typedef struct wiiu_gca_instance {
void *handle;
bool online;
uint8_t device_state[37];
joypad_connection_t *pads[4];
} wiiu_gca_instance_t;
typedef struct gca_pad_data
{
void *gca_handle; // instance handle for the GCA adapter
hid_driver_t *driver; // HID system driver interface
uint8_t data[9]; // pad data
uint32_t slot; // slot this pad occupies
uint32_t buttons; // digital button state
int16_t analog_state[3][2]; // analog state
} gca_pad_t;
static void update_pad_state(wiiu_gca_instance_t *instance);
static void unregister_pad(wiiu_gca_instance_t *instance, int port);
extern pad_connection_interface_t wiiu_gca_pad_connection;
static void *wiiu_gca_init(void *handle)
{
RARCH_LOG("[gca]: allocating driver instance...\n");
wiiu_gca_instance_t *instance = calloc(1, sizeof(wiiu_gca_instance_t));
if(instance == NULL) goto error;
memset(instance, 0, sizeof(wiiu_gca_instance_t));
instance->handle = handle;
hid_instance.os_driver->send_control(handle, activation_packet, sizeof(activation_packet));
hid_instance.os_driver->read(handle, instance->device_state, sizeof(instance->device_state));
instance->online = true;
RARCH_LOG("[gca]: init done\n");
return instance;
error:
RARCH_ERR("[gca]: init failed\n");
if(instance)
free(instance);
return NULL;
}
static void wiiu_gca_free(void *data) {
wiiu_gca_instance_t *instance = (wiiu_gca_instance_t *)data;
int i;
if(instance) {
instance->online = false;
for(i = 0; i < 4; i++)
unregister_pad(instance, i);
free(instance);
}
}
static void wiiu_gca_handle_packet(void *data, uint8_t *buffer, size_t size)
{
wiiu_gca_instance_t *instance = (wiiu_gca_instance_t *)data;
if(!instance || !instance->online)
{
RARCH_WARN("[gca]: instance null or not ready yet.\n");
return;
}
if(size > sizeof(instance->device_state))
{
RARCH_WARN("[gca]: packet size %d is too big for buffer of size %d\n",
size, sizeof(instance->device_state));
return;
}
memcpy(instance->device_state, buffer, size);
update_pad_state(instance);
}
static void update_pad_state(wiiu_gca_instance_t *instance)
{
int i, port;
unsigned char port_connected;
if(!instance || !instance->online)
return;
joypad_connection_t *pad;
/* process each pad */
for(i = 1; i < 37; i += 9)
{
port = i / 9;
pad = instance->pads[port];
port_connected = instance->device_state[i];
if(port_connected > GCA_PORT_POWERED)
{
if(pad == NULL)
{
RARCH_LOG("[gca]: Gamepad at port %d connected.\n", port+1);
instance->pads[port] = hid_pad_register(instance, &wiiu_gca_pad_connection);
pad = instance->pads[port];
if(pad == NULL)
{
RARCH_ERR("[gca]: Failed to register pad.\n");
break;
}
}
pad->iface->packet_handler(pad->data, &instance->device_state[i], 9);
} else {
if(pad != NULL) {
RARCH_LOG("[gca]: Gamepad at port %d disconnected.\n", port+1);
unregister_pad(instance, port);
}
}
}
}
static void unregister_pad(wiiu_gca_instance_t *instance, int slot)
{
if(!instance || slot < 0 || slot >= 4 || instance->pads[slot] == NULL)
return;
joypad_connection_t *pad = instance->pads[slot];
instance->pads[slot] = NULL;
hid_pad_deregister(pad);
}
static bool wiiu_gca_detect(uint16_t vendor_id, uint16_t product_id) {
return vendor_id == VID_NINTENDO && product_id == PID_NINTENDO_GCA;
}
hid_device_t wiiu_gca_hid_device = {
wiiu_gca_init,
wiiu_gca_free,
wiiu_gca_handle_packet,
wiiu_gca_detect,
"Wii U Gamecube Adapter"
};
/**
* Pad connection interface implementation. This handles each individual
* GC controller (as opposed to the above that handles the GCA itself).
*/
static void *wiiu_gca_pad_init(void *data, uint32_t slot, hid_driver_t *driver)
{
gca_pad_t *pad = (gca_pad_t *)calloc(1, sizeof(gca_pad_t));
if(!pad)
return NULL;
memset(pad, 0, sizeof(gca_pad_t));
pad->gca_handle = data;
pad->driver = driver;
pad->slot = slot;
return pad;
}
static void wiiu_gca_pad_deinit(void *data)
{
gca_pad_t *pad = (gca_pad_t *)data;
if(pad)
{
input_autoconfigure_disconnect(pad->slot, wiiu_gca_pad_connection.get_name(pad));
free(pad);
}
}
static void wiiu_gca_get_buttons(void *data, input_bits_t *state)
{
gca_pad_t *pad = (gca_pad_t *)data;
if(pad)
{
BITS_COPY16_PTR(state, pad->buttons);
} else {
BIT256_CLEAR_ALL_PTR(state);
}
}
static void update_buttons(gca_pad_t *pad)
{
uint32_t i, pressed_keys;
static const uint32_t button_mapping[12] =
{
RETRO_DEVICE_ID_JOYPAD_A,
RETRO_DEVICE_ID_JOYPAD_B,
RETRO_DEVICE_ID_JOYPAD_X,
RETRO_DEVICE_ID_JOYPAD_Y,
RETRO_DEVICE_ID_JOYPAD_LEFT,
RETRO_DEVICE_ID_JOYPAD_RIGHT,
RETRO_DEVICE_ID_JOYPAD_DOWN,
RETRO_DEVICE_ID_JOYPAD_UP,
RETRO_DEVICE_ID_JOYPAD_START,
RETRO_DEVICE_ID_JOYPAD_SELECT,
RETRO_DEVICE_ID_JOYPAD_R,
RETRO_DEVICE_ID_JOYPAD_L,
};
if(!pad)
return;
pressed_keys = pad->data[1] | (pad->data[2] << 8);
pad->buttons = 0;
for(i = 0; i < 12; i++)
pad->buttons |= (pressed_keys & (1 << i)) ?
(1 << button_mapping[i]) : 0;
}
#if 0
const char *axes[] = {
"left x",
"left y",
"right x",
"right y"
};
#endif
static void update_analog_state(gca_pad_t *pad)
{
int pad_axis;
int16_t interpolated;
unsigned stick, axis;
/* GameCube analog axis are 8-bit unsigned, where 128/128 is center.
* So, we subtract 128 to get a signed, 0-based value and then mulitply
* by 256 to get the 16-bit range RetroArch expects. */
for(pad_axis = 0; pad_axis < 4; pad_axis++)
{
axis = pad_axis % 2 ? 0 : 1;
stick = pad_axis / 2;
interpolated = pad->data[3 + pad_axis];
/* libretro requires "up" to be negative, so we invert the y axis */
interpolated = (axis) ?
((interpolated - 128) * 256) :
((interpolated - 128) * -256);
pad->analog_state[stick][axis] = interpolated;
#if 0
RARCH_LOG("%s: %d\n", axes[pad_axis], interpolated);
#endif
}
}
/**
* The USB packet provides a 9-byte data packet for each pad.
*
* byte 0: connection status (0x14 = connected, 0x04 = disconnected)
* bytes 1-2: digital buttons
* bytes 3-4: left analog stick x/y
* bytes 5-6: right analog stick x/y
* bytes 7-8: L/R analog state (note that these have digital buttons too)
*/
static void wiiu_gca_packet_handler(void *data, uint8_t *packet, uint16_t size)
{
gca_pad_t *pad = (gca_pad_t *)data;
uint32_t i, pressed_keys;
if(!pad || !packet || size > sizeof(pad->data))
return;
memcpy(pad->data, packet, size);
update_buttons(pad);
update_analog_state(pad);
}
static void wiiu_gca_set_rumble(void *data, enum retro_rumble_effect effect, uint16_t strength)
{
(void)data;
(void)effect;
(void)strength;
}
static int16_t wiiu_gca_get_axis(void *data, unsigned axis)
{
axis_data axis_data;
gca_pad_t *pad = (gca_pad_t *)data;
gamepad_read_axis_data(axis, &axis_data);
if(!pad || axis_data.axis >= 4)
return 0;
return gamepad_get_axis_value(pad->analog_state, &axis_data);
}
static const char *wiiu_gca_get_name(void *data)
{
gca_pad_t *pad = (gca_pad_t *)data;
return "GameCube Controller";
}
/**
* Button bitmask values:
* 0x0001 - A 0x0010 - left 0x0100 - Start/Pause
* 0x0002 - B 0x0020 - right 0x0200 - Z
* 0x0004 - X 0x0040 - down 0x0400 - R
* 0x0008 - Y 0x0080 - up 0x0800 - L
*/
static bool wiiu_gca_button(void *data, uint16_t joykey)
{
gca_pad_t *pad = (gca_pad_t *)data;
if(!pad || joykey > 31)
return false;
return pad->buttons & (1 << joykey);
}
pad_connection_interface_t wiiu_gca_pad_connection = {
wiiu_gca_pad_init,
wiiu_gca_pad_deinit,
wiiu_gca_packet_handler,
wiiu_gca_set_rumble,
wiiu_gca_get_buttons,
wiiu_gca_get_axis,
wiiu_gca_get_name,
wiiu_gca_button
};
+156
View File
@@ -0,0 +1,156 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "hid_device_driver.h"
hid_driver_instance_t hid_instance = {0};
hid_device_t *hid_device_list[] = {
&wiiu_gca_hid_device,
&ds3_hid_device,
/* &ds4_hid_device, */
NULL /* must be last entry in list */
};
hid_device_t *hid_device_driver_lookup(uint16_t vendor_id, uint16_t product_id) {
int i = 0;
for(i = 0; hid_device_list[i] != NULL; i++) {
if(hid_device_list[i]->detect(vendor_id, product_id))
return hid_device_list[i];
}
return NULL;
}
joypad_connection_t *hid_pad_register(void *pad_handle, pad_connection_interface_t *iface)
{
int slot;
joypad_connection_t *result;
if(!pad_handle)
return NULL;
slot = pad_connection_find_vacant_pad(hid_instance.pad_list);
if(slot < 0)
{
RARCH_ERR("[hid]: failed to find a vacant pad.\n");
return NULL;
}
result = &(hid_instance.pad_list[slot]);
result->iface = iface;
result->data = iface->init(pad_handle, slot, hid_instance.os_driver);
result->connected = true;
input_pad_connect(slot, hid_instance.pad_driver);
return result;
}
void hid_pad_deregister(joypad_connection_t *pad)
{
if(!pad)
return;
if(pad->data) {
pad->iface->deinit(pad->data);
pad->data = NULL;
}
pad->iface = NULL;
pad->connected = false;
}
static bool init_pad_list(hid_driver_instance_t *instance, unsigned slots)
{
if(!instance || slots > MAX_USERS)
return false;
if(instance->pad_list)
return true;
RARCH_LOG("[hid]: initializing pad list...\n");
instance->pad_list = pad_connection_init(slots);
if(!instance->pad_list)
return false;
instance->max_slot = slots;
return true;
}
/**
* Fill in instance with data from initialized hid subsystem.
*
* @argument instance the hid_driver_instance_t struct to fill in
* @argument hid_driver the HID driver to initialize
* @argument pad_driver the gamepad driver to handle HID pads detected by the HID driver.
*
* @returns true if init is successful, false otherwise.
*/
bool hid_init(hid_driver_instance_t *instance,
hid_driver_t *hid_driver,
input_device_driver_t *pad_driver,
unsigned slots)
{
RARCH_LOG("[hid]: initializing instance with %d pad slots\n", slots);
if(!instance || !hid_driver || !pad_driver || slots > MAX_USERS)
return false;
RARCH_LOG("[hid]: initializing HID subsystem driver...\n");
instance->os_driver_data = hid_driver->init();
if(!instance->os_driver_data)
return false;
if(!init_pad_list(instance, slots))
{
hid_driver->free(instance->os_driver_data);
instance->os_driver_data = NULL;
return false;
}
instance->os_driver = hid_driver;
instance->pad_driver = pad_driver;
RARCH_LOG("[hid]: instance initialization complete.\n");
return true;
}
/**
* Tear down the HID system set up by hid_init()
*
* @argument instance the hid_driver_instance_t to tear down.
*/
void hid_deinit(hid_driver_instance_t *instance)
{
if(!instance)
return;
RARCH_LOG("[hid]: destroying instance\n");
if(instance->os_driver && instance->os_driver_data)
{
RARCH_LOG("[hid]: tearing down HID subsystem driver...\n");
instance->os_driver->free(instance->os_driver_data);
}
RARCH_LOG("[hid]: destroying pad data...\n");
pad_connection_destroy(instance->pad_list);
RARCH_LOG("[hid]: wiping instance data...\n");
memset(instance, 0, sizeof(hid_driver_instance_t));
}
+46
View File
@@ -0,0 +1,46 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HID_DEVICE_DRIVER__H
#define HID_DEVICE_DRIVER__H
#include "../../input_driver.h"
#include "../../connect/joypad_connection.h"
#include "../../include/hid_driver.h"
#include "../../include/gamepad.h"
#include "../../../verbosity.h"
#include "../../../tasks/tasks_internal.h"
typedef struct hid_device {
void *(*init)(void *handle);
void (*free)(void *data);
void (*handle_packet)(void *data, uint8_t *buffer, size_t size);
bool (*detect)(uint16_t vid, uint16_t pid);
const char *name;
} hid_device_t;
extern hid_device_t wiiu_gca_hid_device;
extern hid_device_t ds3_hid_device;
extern hid_device_t ds4_hid_device;
extern hid_driver_instance_t hid_instance;
hid_device_t *hid_device_driver_lookup(uint16_t vendor_id, uint16_t product_id);
joypad_connection_t *hid_pad_register(void *pad_handle, pad_connection_interface_t *iface);
void hid_pad_deregister(joypad_connection_t *pad);
bool hid_init(hid_driver_instance_t *instance, hid_driver_t *hid_driver, input_device_driver_t *pad_driver, unsigned slots);
void hid_deinit(hid_driver_instance_t *instance);
#endif /* HID_DEVICE_DRIVER__H */
+78
View File
@@ -0,0 +1,78 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../include/gamepad.h"
enum pad_axes {
AXIS_LEFT_ANALOG_X,
AXIS_LEFT_ANALOG_Y,
AXIS_RIGHT_ANALOG_X,
AXIS_RIGHT_ANALOG_Y,
AXIS_INVALID
};
static int16_t clamp_axis(int16_t value, bool is_negative)
{
if(is_negative && value > 0)
return 0;
if(!is_negative && value < 0)
return 0;
return value;
}
void gamepad_read_axis_data(uint32_t axis, axis_data *data)
{
if(!data)
return;
data->axis = AXIS_POS_GET(axis);
data->is_negative = false;
if(data->axis >= AXIS_INVALID)
{
data->axis = AXIS_NEG_GET(axis);
data->is_negative = true;
}
}
int16_t gamepad_get_axis_value(int16_t state[3][2], axis_data *data)
{
int16_t value = 0;
if(!data)
return 0;
switch(data->axis)
{
case AXIS_LEFT_ANALOG_X:
value = state[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X];
break;
case AXIS_LEFT_ANALOG_Y:
value = state[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y];
break;
case AXIS_RIGHT_ANALOG_X:
value = state[RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X];
break;
case AXIS_RIGHT_ANALOG_Y:
value = state[RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y];
break;
}
return clamp_axis(value, data->is_negative);
}
+1 -4
View File
@@ -21,10 +21,7 @@
#include <boolean.h>
#include "joypad_connection.h"
#include "../input_defines.h"
#ifdef WIIU
#include <wiiu/syshid.h>
#endif
#include "../common/hid/hid_device_driver.h"
struct hidpad_ps3_data
{
+1
View File
@@ -25,6 +25,7 @@
#include "joypad_connection.h"
#include "../input_defines.h"
#include "../../driver.h"
#include "../common/hid/hid_device_driver.h"
enum connect_ps4_dpad_states
{
+1
View File
@@ -26,6 +26,7 @@
#include "joypad_connection.h"
#include "../input_defines.h"
#include "../common/hid/hid_device_driver.h"
/* wiimote state flags*/
#define WIIMOTE_STATE_DEV_FOUND 0x0001
+1
View File
@@ -21,6 +21,7 @@
#include <boolean.h>
#include "joypad_connection.h"
#include "../input_defines.h"
#include "../common/hid/hid_device_driver.h"
struct hidpad_wiiugca_data
{
+1
View File
@@ -23,6 +23,7 @@
#include "joypad_connection.h"
#include "../input_defines.h"
#include "../../driver.h"
#include "../common/hid/hid_device_driver.h"
struct wiiupro_buttons
{
+1 -2
View File
@@ -61,10 +61,9 @@ typedef struct pad_connection_interface
void (*get_buttons)(void *data, input_bits_t *state);
int16_t (*get_axis)(void *data, unsigned axis);
const char* (*get_name)(void *data);
bool (*button)(void *data, uint16_t joykey);
} pad_connection_interface_t;
typedef struct joypad_connection joypad_connection_t;
extern pad_connection_interface_t pad_connection_wii;
extern pad_connection_interface_t pad_connection_wiiupro;
extern pad_connection_interface_t pad_connection_ps3;
+4
View File
@@ -33,7 +33,11 @@
#include "wiiu_dbg.h"
#ifdef WIIU_HID
#define MAX_PADS 16
#else
#define MAX_PADS 5
#endif
static uint8_t keyboardChannel = 0x00;
static bool keyboardState[RETROK_LAST] = { 0 };
+18 -62
View File
@@ -512,8 +512,8 @@ static void iohidmanager_hid_device_add_autodetect(unsigned idx,
RARCH_LOG("Port %d: %s.\n", idx, device_name);
}
static void iohidmanager_hid_device_add(IOHIDDeviceRef device, iohidmanager_hid_t* hid)
static void iohidmanager_hid_device_add(void *data, IOReturn result,
void *sender, IOHIDDeviceRef device)
{
int i;
IOReturn ret;
@@ -527,6 +527,8 @@ static void iohidmanager_hid_device_add(IOHIDDeviceRef device, iohidmanager_hid_
apple_input_rec_t *tmp = NULL;
apple_input_rec_t *tmpButtons = NULL;
apple_input_rec_t *tmpAxes = NULL;
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)
hid_driver_get_data();
struct iohidmanager_hid_adapter *adapter = (struct iohidmanager_hid_adapter*)
calloc(1, sizeof(*adapter));
@@ -850,70 +852,24 @@ static int iohidmanager_hid_manager_free(iohidmanager_hid_t *hid)
static int iohidmanager_hid_manager_set_device_matching(
iohidmanager_hid_t *hid)
{
unsigned i;
hid_list_t* devList = NULL;
CFSetRef set = IOHIDManagerCopyDevices(hid->ptr);
CFIndex num_devices = CFSetGetCount(set);
IOHIDDeviceRef *device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef));
CFMutableArrayRef matcher = CFArrayCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeArrayCallBacks);
CFSetGetValues(set, (const void **) device_array);
for (i = 0; i < num_devices; i++)
{
IOHIDDeviceRef dev = device_array[i];
if (!matcher)
return -1;
/* filter gamepad/joystick devices */
if ( IOHIDDeviceConformsTo(dev, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)
|| IOHIDDeviceConformsTo(dev, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad)
)
{
if (!devList)
{
devList = (hid_list_t *)malloc(sizeof(hid_list_t));
devList->device = dev;
devList->lid = iohidmanager_hid_device_get_location_id(dev);
devList->next = NULL;
}
else
{
hid_list_t *ptr = NULL;
hid_list_t *new = (hid_list_t *)malloc(sizeof(hid_list_t));
new->device = dev;
new->lid = iohidmanager_hid_device_get_location_id(dev);
new->next = NULL;
iohidmanager_hid_append_matching_dictionary(matcher,
kHIDPage_GenericDesktop,
kHIDUsage_GD_Joystick);
iohidmanager_hid_append_matching_dictionary(matcher,
kHIDPage_GenericDesktop,
kHIDUsage_GD_GamePad);
ptr = devList;
IOHIDManagerSetDeviceMatchingMultiple(hid->ptr, matcher);
IOHIDManagerRegisterDeviceMatchingCallback(hid->ptr,
iohidmanager_hid_device_add, 0);
if ( new->lid < ptr->lid )
{
new->next = ptr;
devList = new;
}
else
{
while ((ptr->lid < new->lid ) && ptr->next)
ptr = ptr->next;
new->next = ptr->next;
ptr->next = new;
}
}
}
}
{
/* register devices */
hid_list_t * ptr = devList;
while (ptr)
{
iohidmanager_hid_device_add(ptr->device, hid);
ptr = ptr->next;
free(devList);
devList = ptr;
}
}
free(device_array);
CFRelease(matcher);
return 0;
}
+1
View File
@@ -18,6 +18,7 @@
#include "../input_defines.h"
#include "../input_driver.h"
#include "../include/hid_driver.h"
typedef struct null_hid
{
+32 -52
View File
@@ -14,11 +14,13 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <wiiu/pad_driver.h>
#include "../../wiiu/input/wiiu_input.h"
#include "wiiu_dbg.h"
static input_device_driver_t *pad_drivers[MAX_USERS];
extern pad_connection_listener_t wiiu_pad_connection_listener;
static bool ready = false;
@@ -31,64 +33,30 @@ static int16_t wiiu_joypad_axis(unsigned pad, uint32_t axis);
static void wiiu_joypad_poll(void);
static const char *wiiu_joypad_name(unsigned pad);
/**
* Translates a pad to its appropriate driver.
* Note that this is a helper for build_pad_map and shouldn't be
* used directly.
*/
static input_device_driver_t *get_driver_for_pad(unsigned pad)
{
if(wpad_driver.query_pad(pad))
return &wpad_driver;
if(kpad_driver.query_pad(pad))
return &kpad_driver;
#ifdef WIIU_HID
return &hidpad_driver;
#else
return NULL;
#endif
}
/**
* Populates the pad_driver array. We do this once at init time so
* that lookups at runtime are constant time.
*/
static void build_pad_map(void)
{
unsigned i;
for(i = 0; i < MAX_USERS; i++)
{
pad_drivers[i] = get_driver_for_pad(i);
}
}
static bool wiiu_joypad_init(void* data)
{
/* the sub-drivers have to init first, otherwise
* build_pad_map will fail (because all lookups will return false). */
wpad_driver.init(data);
kpad_driver.init(data);
set_connection_listener(&wiiu_pad_connection_listener);
hid_instance.pad_list = pad_connection_init(MAX_USERS);
hid_instance.max_slot = MAX_USERS;
wpad_driver.init(data);
kpad_driver.init(data);
#ifdef WIIU_HID
hidpad_driver.init(data);
hidpad_driver.init(data);
#endif
build_pad_map();
ready = true;
(void)data;
ready = true;
(void)data;
return true;
return true;
}
static bool wiiu_joypad_query_pad(unsigned pad)
{
#ifdef WIIU_HID
return ready && pad < MAX_USERS;
#else
return ready && pad < 5;
#endif
return ready &&
pad < MAX_USERS &&
pad_drivers[pad] != NULL &&
pad_drivers[pad]->query_pad(pad);
}
static void wiiu_joypad_destroy(void)
@@ -137,10 +105,17 @@ static void wiiu_joypad_poll(void)
static const char* wiiu_joypad_name(unsigned pad)
{
if(!wiiu_joypad_query_pad(pad))
return "N/A";
if(!wiiu_joypad_query_pad(pad))
return "N/A";
return pad_drivers[pad]->name(pad);
return pad_drivers[pad]->name(pad);
}
static void wiiu_joypad_connection_listener(unsigned pad,
input_device_driver_t *driver)
{
if(pad < MAX_USERS)
pad_drivers[pad] = driver;
}
input_device_driver_t wiiu_joypad =
@@ -156,3 +131,8 @@ input_device_driver_t wiiu_joypad =
wiiu_joypad_name,
"wiiu",
};
pad_connection_listener_t wiiu_pad_connection_listener =
{
wiiu_joypad_connection_listener
};
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff. Show more