Commit 104c9541d9510c2bb2b9aa478e90c54e6230dd8d

Sam Lantinga 2016-10-07T17:46:58

Converted README documentation to DOS text format

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
diff --git a/docs/README-android.md b/docs/README-android.md
index bf7b1cd..da6f1d5 100644
--- a/docs/README-android.md
+++ b/docs/README-android.md
@@ -1,4 +1,4 @@
-Android
+Android
 ================================================================================
 
 Requirements:
diff --git a/docs/README-cmake.md b/docs/README-cmake.md
index 5b440c5..2ce11d7 100644
--- a/docs/README-cmake.md
+++ b/docs/README-cmake.md
@@ -1,6 +1,6 @@
-CMake
+CMake
 ================================================================================
-(www.cmake.org)
+(www.cmake.org)
 
 SDL's build system was traditionally based on autotools. Over time, this
 approach has suffered from several issues across the different supported 
diff --git a/docs/README-directfb.md b/docs/README-directfb.md
index 7df8bb8..eeac428 100644
--- a/docs/README-directfb.md
+++ b/docs/README-directfb.md
@@ -1,5 +1,5 @@
 DirectFB
-========
+========
 
 Supports:
 
diff --git a/docs/README-dynapi.md b/docs/README-dynapi.md
index bfaecb3..96da4b8 100644
--- a/docs/README-dynapi.md
+++ b/docs/README-dynapi.md
@@ -1,130 +1,130 @@
-Dynamic API
-================================================================================
-Originally posted by Ryan at:
-  https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U
-
-Background:
-
-- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, 
-  but developers are shipping their own SDL2 with individual Steam games. 
-  These games might stop getting updates, but a newer SDL2 might be needed later. 
-  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't 
-  ever needed, and these fixes won't make it to a game shipping its own SDL.
-- Even if we replace the SDL2 in those games with a compatible one, that is to 
-  say, edit a developer's Steam depot (yuck!), there are developers that are 
-  statically linking SDL2 that we can't do this for. We can't even force the 
-  dynamic loader to ignore their SDL2 in this case, of course.
-- If you don't ship an SDL2 with the game in some form, people that disabled the
-  Steam Runtime, or just tried to run the game from the command line instead of 
-  Steam might find themselves unable to run the game, due to a missing dependency.
-- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
-  generic Linux boxes that may or may not have SDL2 installed, you have to ship 
-  the library or risk a total failure to launch. So now, you might have to have 
-  a non-Steam build plus a Steam build (that is, one with and one without SDL2 
-  included), which is inconvenient if you could have had one universal build 
-  that works everywhere.
-- We like the zlib license, but the biggest complaint from the open source 
-  community about the license change is the static linking. The LGPL forced this 
-  as a legal, not technical issue, but zlib doesn't care. Even those that aren't
-  concerned about the GNU freedoms found themselves solving the same problems: 
-  swapping in a newer SDL to an older game often times can save the day. 
-  Static linking stops this dead.
-
-So here's what we did:
-
-SDL now has, internally, a table of function pointers. So, this is what SDL_Init
-now looks like:
-
-    UInt32 SDL_Init(Uint32 flags)
-    {
-        return jump_table.SDL_Init(flags);
-    }
-
-Except that is all done with a bunch of macro magic so we don't have to maintain
-every one of these.
-
-What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
-SDL_Init() that you've been calling all this time. But at startup, it looks more 
-like this:
-
-    Uint32 SDL_Init_DEFAULT(Uint32 flags)
-    {
-        SDL_InitDynamicAPI();
-        return jump_table.SDL_Init(flags);
-    }
-
-SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function 
-pointers, which means that this _DEFAULT function never gets called again. 
-First call to any SDL function sets the whole thing up.
-
-So you might be asking, what was the value in that? Isn't this what the operating
-system's dynamic loader was supposed to do for us? Yes, but now we've got this 
-level of indirection, we can do things like this:
-
-    export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
-    ./MyGameThatIsStaticallyLinkedToSDL2
-
-And now, this game that is staticallly linked to SDL, can still be overridden 
-with a newer, or better, SDL. The statically linked one will only be used as 
-far as calling into the jump table in this case. But in cases where no override
-is desired, the statically linked version will provide its own jump table, 
-and everyone is happy.
-
-So now:
-- Developers can statically link SDL, and users can still replace it. 
-  (We'd still rather you ship a shared library, though!)
-- Developers can ship an SDL with their game, Valve can override it for, say, 
-  new features on SteamOS, or distros can override it for their own needs, 
-  but it'll also just work in the default case.
-- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), 
-  and it'll do the right thing.
-- End users (and Valve) can update a game's SDL in almost any case, 
-  to keep abandoned games running on newer platforms.
-- Everyone develops with SDL exactly as they have been doing all along. 
-  Same headers, same ABI. Just get the latest version to enable this magic.
-
-
-A little more about SDL_InitDynamicAPI():
-
-Internally, InitAPI does some locking to make sure everything waits until a 
-single thread initializes everything (although even SDL_CreateThread() goes 
-through here before spinning a thread, too), and then decides if it should use
-an external SDL library. If not, it sets up the jump table using the current 
-SDL's function pointers (which might be statically linked into a program, or in
-a shared library of its own). If so, it loads that library and looks for and 
-calls a single function:
-
-    SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
-
-That function takes a version number (more on that in a moment), the address of
-the jump table, and the size, in bytes, of the table. 
-Now, we've got policy here: this table's layout never changes; new stuff gets 
-added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all 
-the needed functions if tablesize <= sizeof its own jump table. If tablesize is
-bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
-if it's smaller, we know we can provide the entire API that the caller needs.
-
-The version variable is a failsafe switch. 
-Right now it's always 1. This number changes when there are major API changes 
-(so we know if the tablesize might be smaller, or entries in it have changed). 
-Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not 
-inconceivable to have a small dispatch library that only supplies this one 
-function and loads different, otherwise-incompatible SDL libraries and has the
-right one initialize the jump table based on the version. For something that 
-must generically catch lots of different versions of SDL over time, like the 
-Steam Client, this isn't a bad option.
-
-Finally, I'm sure some people are reading this and thinking,
-"I don't want that overhead in my project!"  
-To which I would point out that the extra function call through the jump table 
-probably wouldn't even show up in a profile, but lucky you: this can all be 
-disabled. You can build SDL without this if you absolutely must, but we would 
-encourage you not to do that. However, on heavily locked down platforms like 
-iOS, or maybe when debugging, it makes sense to disable it. The way this is
-designed in SDL, you just have to change one #define, and the entire system 
-vaporizes out, and SDL functions exactly like it always did. Most of it is 
-macro magic, so the system is contained to one C file and a few headers. 
-However, this is on by default and you have to edit a header file to turn it 
-off. Our hopes is that if we make it easy to disable, but not too easy, 
-everyone will ultimately be able to get what they want, but we've gently 
-nudged everyone towards what we think is the best solution.
+Dynamic API
+================================================================================
+Originally posted by Ryan at:
+  https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U
+
+Background:
+
+- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, 
+  but developers are shipping their own SDL2 with individual Steam games. 
+  These games might stop getting updates, but a newer SDL2 might be needed later. 
+  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't 
+  ever needed, and these fixes won't make it to a game shipping its own SDL.
+- Even if we replace the SDL2 in those games with a compatible one, that is to 
+  say, edit a developer's Steam depot (yuck!), there are developers that are 
+  statically linking SDL2 that we can't do this for. We can't even force the 
+  dynamic loader to ignore their SDL2 in this case, of course.
+- If you don't ship an SDL2 with the game in some form, people that disabled the
+  Steam Runtime, or just tried to run the game from the command line instead of 
+  Steam might find themselves unable to run the game, due to a missing dependency.
+- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
+  generic Linux boxes that may or may not have SDL2 installed, you have to ship 
+  the library or risk a total failure to launch. So now, you might have to have 
+  a non-Steam build plus a Steam build (that is, one with and one without SDL2 
+  included), which is inconvenient if you could have had one universal build 
+  that works everywhere.
+- We like the zlib license, but the biggest complaint from the open source 
+  community about the license change is the static linking. The LGPL forced this 
+  as a legal, not technical issue, but zlib doesn't care. Even those that aren't
+  concerned about the GNU freedoms found themselves solving the same problems: 
+  swapping in a newer SDL to an older game often times can save the day. 
+  Static linking stops this dead.
+
+So here's what we did:
+
+SDL now has, internally, a table of function pointers. So, this is what SDL_Init
+now looks like:
+
+    UInt32 SDL_Init(Uint32 flags)
+    {
+        return jump_table.SDL_Init(flags);
+    }
+
+Except that is all done with a bunch of macro magic so we don't have to maintain
+every one of these.
+
+What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
+SDL_Init() that you've been calling all this time. But at startup, it looks more 
+like this:
+
+    Uint32 SDL_Init_DEFAULT(Uint32 flags)
+    {
+        SDL_InitDynamicAPI();
+        return jump_table.SDL_Init(flags);
+    }
+
+SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function 
+pointers, which means that this _DEFAULT function never gets called again. 
+First call to any SDL function sets the whole thing up.
+
+So you might be asking, what was the value in that? Isn't this what the operating
+system's dynamic loader was supposed to do for us? Yes, but now we've got this 
+level of indirection, we can do things like this:
+
+    export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
+    ./MyGameThatIsStaticallyLinkedToSDL2
+
+And now, this game that is staticallly linked to SDL, can still be overridden 
+with a newer, or better, SDL. The statically linked one will only be used as 
+far as calling into the jump table in this case. But in cases where no override
+is desired, the statically linked version will provide its own jump table, 
+and everyone is happy.
+
+So now:
+- Developers can statically link SDL, and users can still replace it. 
+  (We'd still rather you ship a shared library, though!)
+- Developers can ship an SDL with their game, Valve can override it for, say, 
+  new features on SteamOS, or distros can override it for their own needs, 
+  but it'll also just work in the default case.
+- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), 
+  and it'll do the right thing.
+- End users (and Valve) can update a game's SDL in almost any case, 
+  to keep abandoned games running on newer platforms.
+- Everyone develops with SDL exactly as they have been doing all along. 
+  Same headers, same ABI. Just get the latest version to enable this magic.
+
+
+A little more about SDL_InitDynamicAPI():
+
+Internally, InitAPI does some locking to make sure everything waits until a 
+single thread initializes everything (although even SDL_CreateThread() goes 
+through here before spinning a thread, too), and then decides if it should use
+an external SDL library. If not, it sets up the jump table using the current 
+SDL's function pointers (which might be statically linked into a program, or in
+a shared library of its own). If so, it loads that library and looks for and 
+calls a single function:
+
+    SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
+
+That function takes a version number (more on that in a moment), the address of
+the jump table, and the size, in bytes, of the table. 
+Now, we've got policy here: this table's layout never changes; new stuff gets 
+added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all 
+the needed functions if tablesize <= sizeof its own jump table. If tablesize is
+bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
+if it's smaller, we know we can provide the entire API that the caller needs.
+
+The version variable is a failsafe switch. 
+Right now it's always 1. This number changes when there are major API changes 
+(so we know if the tablesize might be smaller, or entries in it have changed). 
+Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not 
+inconceivable to have a small dispatch library that only supplies this one 
+function and loads different, otherwise-incompatible SDL libraries and has the
+right one initialize the jump table based on the version. For something that 
+must generically catch lots of different versions of SDL over time, like the 
+Steam Client, this isn't a bad option.
+
+Finally, I'm sure some people are reading this and thinking,
+"I don't want that overhead in my project!"  
+To which I would point out that the extra function call through the jump table 
+probably wouldn't even show up in a profile, but lucky you: this can all be 
+disabled. You can build SDL without this if you absolutely must, but we would 
+encourage you not to do that. However, on heavily locked down platforms like 
+iOS, or maybe when debugging, it makes sense to disable it. The way this is
+designed in SDL, you just have to change one #define, and the entire system 
+vaporizes out, and SDL functions exactly like it always did. Most of it is 
+macro magic, so the system is contained to one C file and a few headers. 
+However, this is on by default and you have to edit a header file to turn it 
+off. Our hopes is that if we make it easy to disable, but not too easy, 
+everyone will ultimately be able to get what they want, but we've gently 
+nudged everyone towards what we think is the best solution.
diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md
index 62012db..1f445f5 100644
--- a/docs/README-emscripten.md
+++ b/docs/README-emscripten.md
@@ -1,37 +1,37 @@
-Emscripten
-================================================================================
-
-Build:
-
-    $ mkdir build
-    $ cd build
-    $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2"
-    $ emmake make
-
-Or with cmake:
-
-    $ mkdir build
-    $ cd build
-    $ emcmake cmake ..
-    $ emmake make
-
-To build one of the tests:
-
-    $ cd test/
-    $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
-
-Uses GLES2 renderer or software
-
-tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html
-
-Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
-
-SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
-
-    $ EMCONFIGURE_JS=1 emconfigure ../configure
-    build as usual...
-
-SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
-
-    $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
-    build as usual...
+Emscripten
+================================================================================
+
+Build:
+
+    $ mkdir build
+    $ cd build
+    $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2"
+    $ emmake make
+
+Or with cmake:
+
+    $ mkdir build
+    $ cd build
+    $ emcmake cmake ..
+    $ emmake make
+
+To build one of the tests:
+
+    $ cd test/
+    $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
+
+Uses GLES2 renderer or software
+
+tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html
+
+Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
+
+SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
+
+    $ EMCONFIGURE_JS=1 emconfigure ../configure
+    build as usual...
+
+SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
+
+    $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
+    build as usual...
diff --git a/docs/README-hg.md b/docs/README-hg.md
index 6e18bab..67bf98f 100644
--- a/docs/README-hg.md
+++ b/docs/README-hg.md
@@ -1,6 +1,6 @@
-Mercurial
-=========
-
+Mercurial
+=========
+
 The latest development version of SDL is available via Mercurial.
 Mercurial allows you to get up-to-the-minute fixes and enhancements;
 as a developer works on a source tree, you can use "hg" to mirror that
diff --git a/docs/README-linux.md b/docs/README-linux.md
index 8408e36..f676727 100644
--- a/docs/README-linux.md
+++ b/docs/README-linux.md
@@ -1,85 +1,85 @@
-Linux
-================================================================================
-
-By default SDL will only link against glibc, the rest of the features will be
-enabled dynamically at runtime depending on the available features on the target
-system. So, for example if you built SDL with Xinerama support and the target
-system does not have the Xinerama libraries installed, it will be disabled
-at runtime, and you won't get a missing library error, at least with the 
-default configuration parameters.
-
-
-================================================================================
-Build Dependencies
-================================================================================
-    
-Ubuntu 13.04, all available features enabled:
-
-sudo apt-get install build-essential mercurial make cmake autoconf automake \
-libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
-libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
-libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
-libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev
-
-Ubuntu 16.04 can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
-to that command line for Wayland support.
-
-Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
-line for Mir support.
-
-NOTES:
-- This includes all the audio targets except arts, because Ubuntu pulled the 
-  artsc0-dev package, but in theory SDL still supports it.
-- DirectFB isn't included because the configure script (currently) fails to find
-  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
-  configure script to include DirectFB support. Send patches.  :)
-
-
-================================================================================
-Joystick does not work
-================================================================================
-
-If you compiled or are using a version of SDL with udev support (and you should!)
-there's a few issues that may cause SDL to fail to detect your joystick. To
-debug this, start by installing the evtest utility. On Ubuntu/Debian:
-
-    sudo apt-get install evtest
-    
-Then run:
-    
-    sudo evtest
-    
-You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
-Now run:
-    
-    cat /dev/input/event/XX
-
-If you get a permission error, you need to set a udev rule to change the mode of
-your device (see below)    
-    
-Also, try:
-    
-    sudo udevadm info --query=all --name=input/eventXX
-    
-If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
-you need to set up an udev rule to force this variable.
-
-A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
-like:
-    
-   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-   
-You can set up similar rules for your device by changing the values listed in
-idProduct and idVendor. To obtain these values, try:
-    
-    sudo udevadm info -a --name=input/eventXX | grep idVendor
-    sudo udevadm info -a --name=input/eventXX | grep idProduct
-    
-If multiple values come up for each of these, the one you want is the first one of each.    
-
-On other systems which ship with an older udev (such as CentOS), you may need
-to set up a rule such as:
-    
-    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
-
+Linux
+================================================================================
+
+By default SDL will only link against glibc, the rest of the features will be
+enabled dynamically at runtime depending on the available features on the target
+system. So, for example if you built SDL with Xinerama support and the target
+system does not have the Xinerama libraries installed, it will be disabled
+at runtime, and you won't get a missing library error, at least with the 
+default configuration parameters.
+
+
+================================================================================
+Build Dependencies
+================================================================================
+    
+Ubuntu 13.04, all available features enabled:
+
+sudo apt-get install build-essential mercurial make cmake autoconf automake \
+libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
+libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
+libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
+libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev
+
+Ubuntu 16.04 can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
+to that command line for Wayland support.
+
+Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
+line for Mir support.
+
+NOTES:
+- This includes all the audio targets except arts, because Ubuntu pulled the 
+  artsc0-dev package, but in theory SDL still supports it.
+- DirectFB isn't included because the configure script (currently) fails to find
+  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
+  configure script to include DirectFB support. Send patches.  :)
+
+
+================================================================================
+Joystick does not work
+================================================================================
+
+If you compiled or are using a version of SDL with udev support (and you should!)
+there's a few issues that may cause SDL to fail to detect your joystick. To
+debug this, start by installing the evtest utility. On Ubuntu/Debian:
+
+    sudo apt-get install evtest
+    
+Then run:
+    
+    sudo evtest
+    
+You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
+Now run:
+    
+    cat /dev/input/event/XX
+
+If you get a permission error, you need to set a udev rule to change the mode of
+your device (see below)    
+    
+Also, try:
+    
+    sudo udevadm info --query=all --name=input/eventXX
+    
+If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
+you need to set up an udev rule to force this variable.
+
+A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
+like:
+    
+   SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+   SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
+   
+You can set up similar rules for your device by changing the values listed in
+idProduct and idVendor. To obtain these values, try:
+    
+    sudo udevadm info -a --name=input/eventXX | grep idVendor
+    sudo udevadm info -a --name=input/eventXX | grep idProduct
+    
+If multiple values come up for each of these, the one you want is the first one of each.    
+
+On other systems which ship with an older udev (such as CentOS), you may need
+to set up a rule such as:
+    
+    SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
+
diff --git a/docs/README-nacl.md b/docs/README-nacl.md
index 4c9432b..53ada33 100644
--- a/docs/README-nacl.md
+++ b/docs/README-nacl.md
@@ -1,103 +1,103 @@
-Native Client
-================================================================================
-
-Requirements: 
-
-* Native Client SDK (https://developer.chrome.com/native-client), 
-  (tested with Pepper version 33 or higher).
-
-The SDL backend for Chrome's Native Client has been tested only with the PNaCl
-toolchain, which generates binaries designed to run on ARM and x86_32/64 
-platforms. This does not mean it won't work with the other toolchains!
-
-================================================================================
-Building SDL for NaCl
-================================================================================
-
-Set up the right environment variables (see naclbuild.sh), then configure SDL with:
-
-    configure --host=pnacl --prefix some/install/destination
-    
-Then "make". 
-
-As an example of how to create a deployable app a Makefile project is provided 
-in test/nacl/Makefile, which includes some monkey patching of the common.mk file 
-provided by NaCl, without which linking properly to SDL won't work (the search 
-path can't be modified externally, so the linker won't find SDL's binaries unless 
-you dump them into the SDK path, which is inconvenient).
-Also provided in test/nacl is the required support file, such as index.html, 
-manifest.json, etc.
-SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
-This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
-hiding the asynchronous nature of the browser behind the scenes...which is not the
-same as making it disappear!
-
-
-================================================================================
-Running tests
-================================================================================
-
-Due to the nature of NaCl programs, building and running SDL tests is not as
-straightforward as one would hope. The script naclbuild.sh in build-scripts 
-automates the process and should serve as a guide for users of SDL trying to build 
-their own applications.
-
-Basic usage:
-    
-    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
-    
-This will build testgles2.c by default.
-
-If you want to build a different test, for example testrendercopyex.c:
-    
-    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
-    
-Once the build finishes, you have to serve the contents with a web server (the
-script will give you instructions on how to do that with Python).
-
-================================================================================
-RWops and nacl_io
-================================================================================
-
-SDL_RWops work transparently with nacl_io. Two functions control the mount points:
-    
-    int mount(const char* source, const char* target, 
-                      const char* filesystemtype, 
-                      unsigned long mountflags, const void *data);
-    int umount(const char *target);
-    
-    For convenience, SDL will by default mount an httpfs tree at / before calling 
-the app's main function. Such setting can be overridden by calling:
-    
-    umount("/");
-
-And then mounting a different filesystem at /
-
-It's important to consider that the asynchronous nature of file operations on a
-browser is hidden from the application, effectively providing the developer with
-a set of blocking file operations just like you get in a regular desktop 
-environment, which eases the job of porting to Native Client, but also introduces 
-a set of challenges of its own, in particular when big file sizes and slow 
-connections are involved.
-
-For more information on how nacl_io and mount points work, see:
-    
-    https://developer.chrome.com/native-client/devguide/coding/nacl_io
-    https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
-
-To be able to save into the directory "/save/" (like backup of game) :
-
-    mount("", "/save", "html5fs", 0, "type=PERSISTENT");
-
-And add to manifest.json :
-
-    "permissions": [
-        "unlimitedStorage"
-    ]
-
-================================================================================
-TODO - Known Issues
-================================================================================
-* Testing of all systems with a real application (something other than SDL's tests)
-* Key events don't seem to work properly
-
+Native Client
+================================================================================
+
+Requirements: 
+
+* Native Client SDK (https://developer.chrome.com/native-client), 
+  (tested with Pepper version 33 or higher).
+
+The SDL backend for Chrome's Native Client has been tested only with the PNaCl
+toolchain, which generates binaries designed to run on ARM and x86_32/64 
+platforms. This does not mean it won't work with the other toolchains!
+
+================================================================================
+Building SDL for NaCl
+================================================================================
+
+Set up the right environment variables (see naclbuild.sh), then configure SDL with:
+
+    configure --host=pnacl --prefix some/install/destination
+    
+Then "make". 
+
+As an example of how to create a deployable app a Makefile project is provided 
+in test/nacl/Makefile, which includes some monkey patching of the common.mk file 
+provided by NaCl, without which linking properly to SDL won't work (the search 
+path can't be modified externally, so the linker won't find SDL's binaries unless 
+you dump them into the SDK path, which is inconvenient).
+Also provided in test/nacl is the required support file, such as index.html, 
+manifest.json, etc.
+SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
+This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
+hiding the asynchronous nature of the browser behind the scenes...which is not the
+same as making it disappear!
+
+
+================================================================================
+Running tests
+================================================================================
+
+Due to the nature of NaCl programs, building and running SDL tests is not as
+straightforward as one would hope. The script naclbuild.sh in build-scripts 
+automates the process and should serve as a guide for users of SDL trying to build 
+their own applications.
+
+Basic usage:
+    
+    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
+    
+This will build testgles2.c by default.
+
+If you want to build a different test, for example testrendercopyex.c:
+    
+    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
+    
+Once the build finishes, you have to serve the contents with a web server (the
+script will give you instructions on how to do that with Python).
+
+================================================================================
+RWops and nacl_io
+================================================================================
+
+SDL_RWops work transparently with nacl_io. Two functions control the mount points:
+    
+    int mount(const char* source, const char* target, 
+                      const char* filesystemtype, 
+                      unsigned long mountflags, const void *data);
+    int umount(const char *target);
+    
+    For convenience, SDL will by default mount an httpfs tree at / before calling 
+the app's main function. Such setting can be overridden by calling:
+    
+    umount("/");
+
+And then mounting a different filesystem at /
+
+It's important to consider that the asynchronous nature of file operations on a
+browser is hidden from the application, effectively providing the developer with
+a set of blocking file operations just like you get in a regular desktop 
+environment, which eases the job of porting to Native Client, but also introduces 
+a set of challenges of its own, in particular when big file sizes and slow 
+connections are involved.
+
+For more information on how nacl_io and mount points work, see:
+    
+    https://developer.chrome.com/native-client/devguide/coding/nacl_io
+    https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
+
+To be able to save into the directory "/save/" (like backup of game) :
+
+    mount("", "/save", "html5fs", 0, "type=PERSISTENT");
+
+And add to manifest.json :
+
+    "permissions": [
+        "unlimitedStorage"
+    ]
+
+================================================================================
+TODO - Known Issues
+================================================================================
+* Testing of all systems with a real application (something other than SDL's tests)
+* Key events don't seem to work properly
+
diff --git a/docs/README-pandora.md b/docs/README-pandora.md
index e50e0c2..a027763 100644
--- a/docs/README-pandora.md
+++ b/docs/README-pandora.md
@@ -1,7 +1,7 @@
-Pandora 
+Pandora 
 =====================================================================
-
-( http://openpandora.org/ )
+
+( http://openpandora.org/ )
 - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
 support to work on the pandora under the framebuffer. This driver do not have
 input support for now, so if you use it you will have to add your own control code.
diff --git a/docs/README-platforms.md b/docs/README-platforms.md
index 14454ec..711557d 100644
--- a/docs/README-platforms.md
+++ b/docs/README-platforms.md
@@ -1,8 +1,8 @@
-Platforms
-=========
-
-We maintain the list of supported platforms on our wiki now, and how to
-build and install SDL for those platforms:
-
-    https://wiki.libsdl.org/Installation
-
+Platforms
+=========
+
+We maintain the list of supported platforms on our wiki now, and how to
+build and install SDL for those platforms:
+
+    https://wiki.libsdl.org/Installation
+
diff --git a/docs/README-psp.md b/docs/README-psp.md
index 41fc904..e891136 100644
--- a/docs/README-psp.md
+++ b/docs/README-psp.md
@@ -1,5 +1,5 @@
-PSP
-======
+PSP
+======
 SDL port for the Sony PSP contributed by 
    Captian Lex 
 
diff --git a/docs/README-touch.md b/docs/README-touch.md
index da78125..09188b8 100644
--- a/docs/README-touch.md
+++ b/docs/README-touch.md
@@ -1,4 +1,4 @@
-Touch
+Touch
 ===========================================================================
 System Specific Notes
 ===========================================================================
diff --git a/docs/README-wince.md b/docs/README-wince.md
index c543ed6..d5fb64f 100644
--- a/docs/README-wince.md
+++ b/docs/README-wince.md
@@ -1,5 +1,5 @@
-WinCE
-=====
+WinCE
+=====
 
 Windows CE is no longer supported by SDL.
 
diff --git a/docs/README-windows.md b/docs/README-windows.md
index 076b155..de6e606 100644
--- a/docs/README-windows.md
+++ b/docs/README-windows.md
@@ -1,41 +1,41 @@
-Windows
-================================================================================
-
-================================================================================
-OpenGL ES 2.x support
-================================================================================
-
-SDL has support for OpenGL ES 2.x under Windows via two alternative 
-implementations. 
-The most straightforward method consists in running your app in a system with 
-a graphic card paired with a relatively recent (as of November of 2013) driver 
-which supports the WGL_EXT_create_context_es2_profile extension. Vendors known 
-to ship said extension on Windows currently include nVidia and Intel.
-
-The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
-If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
-extension is found, SDL will try to load the libEGL.dll library provided by
-ANGLE.
-To obtain the ANGLE binaries, you can either compile from source from
-https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
-a recent Chrome/Chromium install for Windows. The files you need are:
-    
-    * libEGL.dll
-    * libGLESv2.dll
-    * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
-    or...
-    * d3dcompiler_43.dll (supports Windows XP or later)
-    
-If you compile ANGLE from source, you can configure it so it does not need the
-d3dcompiler_* DLL at all (for details on this, see their documentation). 
-However, by default SDL will try to preload the d3dcompiler_46.dll to
-comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
-support Windows XP) or to skip this step at all, you can use the 
-SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
-
-Known Bugs:
-    
-    * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
-      that there's a bug in the library which prevents the window contents from
-      refreshing if this is set to anything other than the default value.
-      
+Windows
+================================================================================
+
+================================================================================
+OpenGL ES 2.x support
+================================================================================
+
+SDL has support for OpenGL ES 2.x under Windows via two alternative 
+implementations. 
+The most straightforward method consists in running your app in a system with 
+a graphic card paired with a relatively recent (as of November of 2013) driver 
+which supports the WGL_EXT_create_context_es2_profile extension. Vendors known 
+to ship said extension on Windows currently include nVidia and Intel.
+
+The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
+If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
+extension is found, SDL will try to load the libEGL.dll library provided by
+ANGLE.
+To obtain the ANGLE binaries, you can either compile from source from
+https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
+a recent Chrome/Chromium install for Windows. The files you need are:
+    
+    * libEGL.dll
+    * libGLESv2.dll
+    * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
+    or...
+    * d3dcompiler_43.dll (supports Windows XP or later)
+    
+If you compile ANGLE from source, you can configure it so it does not need the
+d3dcompiler_* DLL at all (for details on this, see their documentation). 
+However, by default SDL will try to preload the d3dcompiler_46.dll to
+comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
+support Windows XP) or to skip this step at all, you can use the 
+SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
+
+Known Bugs:
+    
+    * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
+      that there's a bug in the library which prevents the window contents from
+      refreshing if this is set to anything other than the default value.
+      
diff --git a/docs/README-winrt.md b/docs/README-winrt.md
index cccbbea..8c92d7d 100644
--- a/docs/README-winrt.md
+++ b/docs/README-winrt.md
@@ -1,478 +1,478 @@
-WinRT
-=====
-
-This port allows SDL applications to run on Microsoft's platforms that require
-use of "Windows Runtime", aka. "WinRT", APIs.  Microsoft may, in some cases,
-refer to them as either "Windows Store", or for Windows 10, "UWP" apps.
-
-Some of the operating systems that include WinRT, are:
-
-* Windows 10, via its Universal Windows Platform (UWP) APIs
-* Windows 8.x
-* Windows RT 8.x (aka. Windows 8.x for ARM processors)
-* Windows Phone 8.x
-
-
-Requirements
-------------
-
-* Microsoft Visual C++ (aka Visual Studio), either 2015, 2013, or 2012
-  - Free, "Community" or "Express" editions may be used, so long as they
-    include  support for either "Windows Store" or "Windows Phone" apps.
-    "Express" versions marked as supporting "Windows Desktop" development
-    typically do not include support for creating WinRT apps, to note.
-    (The "Community" editions of Visual C++ do, however, support both
-    desktop/Win32 and WinRT development).
-  - Visual C++ 2012 can only build apps that target versions 8.0 of Windows,
-    or  Windows Phone.  8.0-targetted apps will run on devices running 8.1
-    editions of Windows, however they will not be able to take advantage of
-    8.1-specific features.
-  - Visual C++ 2013 cannot create app projects that target Windows 8.0.
-    Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0,
-    Windows Phone 8.1, and Windows 8.1, but not Windows 8.0.  An optional
-    Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8",
-    allows Visual C++ 2013 to load and build Windows 8.0 projects that were
-    created with Visual C++ 2012, so long as Visual C++ 2012 is installed
-    on the same machine.  More details on targeting different versions of
-    Windows can found at the following web pages:
-      - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx)
-      - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools)
-* A valid Microsoft account - This requirement is not imposed by SDL, but
-  rather by Microsoft's Visual C++ toolchain.  This is required to launch or 
-  debug apps.
-
-
-Status
-------
-
-Here is a rough list of what works, and what doens't:
-
-* What works:
-  * compilation via Visual C++ 2012 through 2015
-  * compile-time platform detection for SDL programs.  The C/C++ #define,
-    `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
-  * GPU-accelerated 2D rendering, via SDL_Renderer.
-  * OpenGL ES 2, via the ANGLE library (included separately from SDL)
-  * software rendering, via either SDL_Surface (optionally in conjunction with
-    SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
-    SDL_Renderer APIs
-  * threads
-  * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
-    SDL_GetPerformanceFrequency(), etc.)
-  * file I/O via SDL_RWops
-  * mouse input  (unsupported on Windows Phone)
-  * audio, via a modified version of SDL's XAudio2 backend
-  * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
-    anything outside of the app is not supported.
-  * system path retrieval via SDL's filesystem APIs
-  * game controllers.  Support is provided via the SDL_Joystick and
-    SDL_GameController APIs, and is backed by Microsoft's XInput API.
-  * multi-touch input
-  * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
-    appropriate.
-  * window events
-  * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can
-    choose to render content directly via Direct3D, using SDL to manage the
-    internal WinRT window, as well as input and audio.  (Use
-    SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
-    IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
-
-* What partially works:
-  * keyboard input.  Most of WinRT's documented virtual keys are supported, as
-    well as many keys with documented hardware scancodes.  Converting
-    SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
-    (MapVirualKey()) in Microsoft's Windows Store / UWP APIs.
-  * SDLmain.  WinRT uses a different signature for each app's main() function.
-    SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
-    (in `SDL\src\main\winrt\`) directly in order for their C-style main()
-    functions to be called.
-
-* What doesn't work:
-  * compilation with anything other than Visual C++
-  * programmatically-created custom cursors.  These don't appear to be supported
-    by WinRT.  Different OS-provided cursors can, however, be created via
-    SDL_CreateSystemCursor() (unsupported on Windows Phone)
-  * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal().  This are not currently
-    supported by WinRT itself.
-  * joysticks and game controllers that aren't supported by Microsoft's XInput
-    API.
-  * turning off VSync when rendering on Windows Phone.  Attempts to turn VSync
-    off on Windows Phone result either in Direct3D not drawing anything, or it
-    forcing VSync back on.  As such, SDL_RENDERER_PRESENTVSYNC will always get
-    turned-on on Windows Phone.  This limitation is not present in non-Phone
-    WinRT (such as Windows 8.x), where turning off VSync appears to work.
-  * probably anything else that's not listed as supported
-
-
-
-Upgrade Notes
--------------
-
-#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3
-
-SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().
-The fixes may affect older, SDL 2.0.3-based apps' save data.  Please note
-that these changes only apply to SDL-based WinRT apps, and not to apps for
-any other platform.
-
-1. SDL_GetPrefPath() would return an invalid path, one in which the path's
-   directory had not been created.  Attempts to create files there
-   (via fopen(), for example), would fail, unless that directory was
-   explicitly created beforehand.
-
-2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside
-   a WinRT 'Roaming' folder, the contents of which get automatically
-   synchronized across multiple devices.  This process can occur while an
-   application runs, and can cause existing save-data to be overwritten
-   at unexpected times, with data from other devices.  (Windows Phone apps
-   written with SDL 2.0.3 did not utilize a Roaming folder, due to API
-   restrictions in Windows Phone 8.0).
-
-
-SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
-
-1. making sure that SDL_GetPrefPath() returns a directory in which data
-   can be written to immediately, without first needing to create directories.
-
-2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the
-   contents of which do not automatically get synchronized across devices
-   (and which require less work to use safely, in terms of data integrity).
-
-Apps that wish to get their Roaming folder's path can do so either by using
-SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
-UCS-2/wide-char string), or directly through the WinRT class,
-Windows.Storage.ApplicationData.
-
-
-
-Setup, High-Level Steps
------------------------
-
-The steps for setting up a project for an SDL/WinRT app looks like the
-following, at a high-level:
-
-1. create a new Visual C++ project using Microsoft's template for a,
-   "Direct3D App".
-2. remove most of the files from the project.
-3. make your app's project directly reference SDL/WinRT's own Visual C++
-   project file, via use of Visual C++'s "References" dialog.  This will setup
-   the linker, and will copy SDL's .dll files to your app's final output.
-4. adjust your app's build settings, at minimum, telling it where to find SDL's
-   header files.
-5. add files that contains a WinRT-appropriate main function, along with some
-   data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)
-   work properly.
-6. add SDL-specific app code.
-7. build and run your app.
-
-
-Setup, Detailed Steps
----------------------
-
-### 1. Create a new project ###
-
-Create a new project using one of Visual C++'s templates for a plain, non-XAML,
-"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use).  If you
-don't see one of these templates, in Visual C++'s 'New Project' dialog, try
-using the textbox titled, 'Search Installed Templates' to look for one.
-
-
-### 2. Remove unneeded files from the project ###
-
-In the new project, delete any file that has one of the following extensions:
-
-- .cpp
-- .h
-- .hlsl
-
-When you are done, you should be left with a few files, each of which will be a
-necessary part of your app's project.  These files will consist of:
-
-- an .appxmanifest file, which contains metadata on your WinRT app.  This is
-  similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.
-- a few .png files, one of which is a splash screen (displayed when your app
-  launches), others are app icons.
-- a .pfx file, used for code signing purposes.
-
-
-### 3. Add references to SDL's project files ###
-
-SDL/WinRT can be built in multiple variations, spanning across three different
-CPU architectures (x86, x64, and ARM) and two different configurations
-(Debug and Release).  WinRT and Visual C++ do not currently provide a means
-for combining multiple variations of one library into a single file.
-Furthermore, it does not provide an easy means for copying pre-built .dll files
-into your app's final output (via Post-Build steps, for example).  It does,
-however, provide a system whereby an app can reference the MSVC projects of
-libraries such that, when the app is built:
-
-1. each library gets built for the appropriate CPU architecture(s) and WinRT
-   platform(s).
-2. each library's output, such as .dll files, get copied to the app's build 
-   output.
-
-To set this up for SDL/WinRT, you'll need to run through the following steps:
-
-1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then
-   "Solution Explorer")
-2. right click on your app's solution.
-3. navigate to "Add", then to "Existing Project..."
-4. find SDL/WinRT's Visual C++ project file and open it.  Different project
-   files exist for different WinRT platforms.  All of them are in SDL's
-   source distribution, in the following directories:
-    * `VisualC-WinRT/UWP_VS2015/`        - for Windows 10 / UWP apps
-    * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps
-    * `VisualC-WinRT/WinRT80_VS2012/`    - for Windows 8.0 apps
-    * `VisualC-WinRT/WinRT81_VS2013/`    - for Windows 8.1 apps
-5. once the project has been added, right-click on your app's project and
-   select, "References..."
-6. click on the button titled, "Add New Reference..."
-7. check the box next to SDL
-8. click OK to close the dialog
-9. SDL will now show up in the list of references.  Click OK to close that
-   dialog.
-
-Your project is now linked to SDL's project, insofar that when the app is
-built, SDL will be built as well, with its build output getting included with
-your app.
-
-
-### 4. Adjust Your App's Build Settings ###
-
-Some build settings need to be changed in your app's project.  This guide will
-outline the following:
-
-- making sure that the compiler knows where to find SDL's header files
-- **Optional for C++, but NECESSARY for compiling C code:** telling the
-  compiler not to use Microsoft's C++ extensions for WinRT development.
-- **Optional:** telling the compiler not generate errors due to missing
-  precompiled header files.
-
-To change these settings:
-
-1. right-click on the project
-2. choose "Properties"
-3. in the drop-down box next to "Configuration", choose, "All Configurations"
-4. in the drop-down box next to "Platform", choose, "All Platforms"
-5. in the left-hand list, expand the "C/C++" section
-6. select "General"
-7. edit the "Additional Include Directories" setting, and add a path to SDL's
-   "include" directory
-8. **Optional: to enable compilation of C code:** change the setting for
-   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're 
-   working with a completely C++ based project, this step can usually be 
-   omitted.
-9. **Optional: to disable precompiled headers (which can produce 
-   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand 
-   list, select "Precompiled Headers", then change the setting for "Precompiled 
-   Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
-10. close the dialog, saving settings, by clicking the "OK" button
-
-
-### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###
-
-A few files should be included directly in your app's MSVC project, specifically:
-1. a WinRT-appropriate main function (which is different than main() functions on
-   other platforms)
-2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor
-   (if and when the app needs to do so).  *If this cursor resource is not
-   included, mouse-position reporting may fail if and when the cursor is
-   hidden, due to possible bugs/design-oddities in Windows itself.*
-
-To include these files:
-
-1. right-click on your project (again, in Visual C++'s Solution Explorer), 
-   navigate to "Add", then choose "Existing Item...".
-2. navigate to the directory containing SDL's source code, then into its
-   subdirectory, 'src/main/winrt/'.  Select, then add, the following files:
-   - `SDL_winrt_main_NonXAML.cpp`
-   - `SDL2-WinRTResources.rc`
-   - `SDL2-WinRTResource_BlankCursor.cur`
-3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
-   project), then click on "Properties...".
-4. in the drop-down box next to "Configuration", choose, "All Configurations"
-5. in the drop-down box next to "Platform", choose, "All Platforms"
-6. in the left-hand list, click on "C/C++"
-7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
-8. click the OK button.  This will close the dialog.
-
-
-**NOTE: C++/CX compilation is currently required in at least one file of your 
-app's project.  This is to make sure that Visual C++'s linker builds a 'Windows 
-Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**
-
-
-### 6. Add app code and assets ###
-
-At this point, you can add in SDL-specific source code.  Be sure to include a 
-C-style main function (ie: `int main(int argc, char *argv[])`).  From there you 
-should be able to create a single `SDL_Window` (WinRT apps can only have one 
-window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to 
-draw content.  Events are received via SDL's usual event functions 
-(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets, 
-you can start adding them to the project now.  If not, or if you would like to 
-make sure that you're setup correctly, some short and simple sample code is 
-provided below.
-
-
-#### 6.A. ... when creating a new app ####
-
-If you are creating a new app (rather than porting an existing SDL-based app), 
-or if you would just like a simple app to test SDL/WinRT with before trying to 
-get existing code working, some working SDL/WinRT code is provided below.  To 
-set this up:
-
-1. right click on your app's project
-2. select Add, then New Item.  An "Add New Item" dialog will show up.
-3. from the left-hand list, choose "Visual C++"
-4. from the middle/main list, choose "C++ File (.cpp)"
-5. near the bottom of the dialog, next to "Name:", type in a name for your 
-source file, such as, "main.cpp".
-6. click on the Add button.  This will close the dialog, add the new file to 
-your project, and open the file in Visual C++'s text editor.
-7. Copy and paste the following code into the new file, then save it.
-
-
-    #include <SDL.h>
-    
-    int main(int argc, char **argv)
-    {
-        SDL_DisplayMode mode;
-        SDL_Window * window = NULL;
-        SDL_Renderer * renderer = NULL;
-        SDL_Event evt;
-    
-        if (SDL_Init(SDL_INIT_VIDEO) != 0) {
-            return 1;
-        }
-    
-        if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
-            return 1;
-        }
-    
-        if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
-            return 1;
-        }
-    
-        while (1) {
-            while (SDL_PollEvent(&evt)) {
-            }
-    
-            SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
-            SDL_RenderClear(renderer);
-            SDL_RenderPresent(renderer);
-        }
-    }
-
-
-#### 6.B. Adding code and assets ####
-
-If you have existing code and assets that you'd like to add, you should be able 
-to add them now.  The process for adding a set of files is as such.
-
-1. right click on the app's project
-2. select Add, then click on "New Item..."
-3. open any source, header, or asset files as appropriate.  Support for C and 
-C++ is available.
-
-Do note that WinRT only supports a subset of the APIs that are available to 
-Win32-based apps.  Many portions of the Win32 API and the C runtime are not 
-available.
-
-A list of unsupported C APIs can be found at 
-<http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
-
-General information on using the C runtime in WinRT can be found at 
-<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
-
-A list of supported Win32 APIs for WinRT apps can be found at 
-<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note, 
-the list of supported Win32 APIs for Windows Phone 8.0 is different.  
-That list can be found at 
-<http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
-
-
-### 7. Build and run your app ###
-
-Your app project should now be setup, and you should be ready to build your app.  
-To run it on the local machine, open the Debug menu and choose "Start 
-Debugging".  This will build your app, then run your app full-screen.  To switch 
-out of your app, press the Windows key.  Alternatively, you can choose to run 
-your app in a window.  To do this, before building and running your app, find 
-the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand 
-this by clicking on the arrow on the right side of the list, then click on 
-Simulator.  Once you do that, any time you build and run the app, the app will 
-launch in window, rather than full-screen.
-
-
-#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
-
-**These instructions do not include Windows Phone, despite Windows Phone
-typically running on ARM processors.**  They are specifically for devices
-that use the "Windows RT" operating system, which was a modified version of
-Windows 8.x that ran primarily on ARM-based tablet computers.
-
-To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
-
-- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and 
-  debugs ARM-based apps via IP networks.
-- change a few options on the development machine, both to make sure it builds 
-  for ARM (rather than x86 or x64), and to make sure it knows how to find the 
-  Windows RT device (on the network).
-
-Microsoft's Remote Debugger can be found at 
-<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note 
-that separate versions of this debugger exist for different versions of Visual 
-C++, one each for MSVC 2015, 2013, and 2012.
-
-To setup Visual C++ to launch your app on an ARM device:
-
-1. make sure the Remote Debugger is running on your ARM device, and that it's on 
-   the same IP network as your development machine.
-2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click 
-   it, then change the value to "ARM".
-3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To 
-   do this:
-    1. open the app project's properties
-    2. select "Debugging"
-    3. next to "Machine Name", enter the hostname or IP address of the ARM 
-       device
-    4. if, and only if, you've turned off authentication in the Remote Debugger,
-       then change the setting for "Require Authentication" to No
-    5. click "OK"
-4. build and run the app (from Visual C++).  The first time you do this, a 
-   prompt will show up on the ARM device, asking for a Microsoft Account.  You 
-   do, unfortunately, need to log in here, and will need to follow the 
-   subsequent registration steps in order to launch the app.  After you do so, 
-   if the app didn't already launch, try relaunching it again from within Visual 
-   C++.
-
-
-Troubleshooting
----------------
-
-#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"
-
-Try adding the following to your linker flags.  In MSVC, this can be done by
-right-clicking on the app project, navigating to Configuration Properties ->
-Linker -> Command Line, then adding them to the Additional Options
-section.
-
-* For Release builds / MSVC-Configurations, add:
-
-    /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib
-
-* For Debug builds / MSVC-Configurations, add:
-
-    /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
-
-
-#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values
-
-This may be caused by a bug in Windows itself, whereby hiding the mouse
-cursor can cause mouse-position reporting to fail.
-
-SDL provides a workaround for this, but it requires that an app links to a
-set of Win32-style cursor image-resource files.  A copy of suitable resource
-files can be found in `src/main/winrt/`.  Adding them to an app's Visual C++
-project file should be sufficient to get the app to use them.
+WinRT
+=====
+
+This port allows SDL applications to run on Microsoft's platforms that require
+use of "Windows Runtime", aka. "WinRT", APIs.  Microsoft may, in some cases,
+refer to them as either "Windows Store", or for Windows 10, "UWP" apps.
+
+Some of the operating systems that include WinRT, are:
+
+* Windows 10, via its Universal Windows Platform (UWP) APIs
+* Windows 8.x
+* Windows RT 8.x (aka. Windows 8.x for ARM processors)
+* Windows Phone 8.x
+
+
+Requirements
+------------
+
+* Microsoft Visual C++ (aka Visual Studio), either 2015, 2013, or 2012
+  - Free, "Community" or "Express" editions may be used, so long as they
+    include  support for either "Windows Store" or "Windows Phone" apps.
+    "Express" versions marked as supporting "Windows Desktop" development
+    typically do not include support for creating WinRT apps, to note.
+    (The "Community" editions of Visual C++ do, however, support both
+    desktop/Win32 and WinRT development).
+  - Visual C++ 2012 can only build apps that target versions 8.0 of Windows,
+    or  Windows Phone.  8.0-targetted apps will run on devices running 8.1
+    editions of Windows, however they will not be able to take advantage of
+    8.1-specific features.
+  - Visual C++ 2013 cannot create app projects that target Windows 8.0.
+    Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0,
+    Windows Phone 8.1, and Windows 8.1, but not Windows 8.0.  An optional
+    Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8",
+    allows Visual C++ 2013 to load and build Windows 8.0 projects that were
+    created with Visual C++ 2012, so long as Visual C++ 2012 is installed
+    on the same machine.  More details on targeting different versions of
+    Windows can found at the following web pages:
+      - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx)
+      - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools)
+* A valid Microsoft account - This requirement is not imposed by SDL, but
+  rather by Microsoft's Visual C++ toolchain.  This is required to launch or 
+  debug apps.
+
+
+Status
+------
+
+Here is a rough list of what works, and what doens't:
+
+* What works:
+  * compilation via Visual C++ 2012 through 2015
+  * compile-time platform detection for SDL programs.  The C/C++ #define,
+    `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
+  * GPU-accelerated 2D rendering, via SDL_Renderer.
+  * OpenGL ES 2, via the ANGLE library (included separately from SDL)
+  * software rendering, via either SDL_Surface (optionally in conjunction with
+    SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
+    SDL_Renderer APIs
+  * threads
+  * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
+    SDL_GetPerformanceFrequency(), etc.)
+  * file I/O via SDL_RWops
+  * mouse input  (unsupported on Windows Phone)
+  * audio, via a modified version of SDL's XAudio2 backend
+  * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
+    anything outside of the app is not supported.
+  * system path retrieval via SDL's filesystem APIs
+  * game controllers.  Support is provided via the SDL_Joystick and
+    SDL_GameController APIs, and is backed by Microsoft's XInput API.
+  * multi-touch input
+  * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
+    appropriate.
+  * window events
+  * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can
+    choose to render content directly via Direct3D, using SDL to manage the
+    internal WinRT window, as well as input and audio.  (Use
+    SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
+    IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
+
+* What partially works:
+  * keyboard input.  Most of WinRT's documented virtual keys are supported, as
+    well as many keys with documented hardware scancodes.  Converting
+    SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
+    (MapVirualKey()) in Microsoft's Windows Store / UWP APIs.
+  * SDLmain.  WinRT uses a different signature for each app's main() function.
+    SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
+    (in `SDL\src\main\winrt\`) directly in order for their C-style main()
+    functions to be called.
+
+* What doesn't work:
+  * compilation with anything other than Visual C++
+  * programmatically-created custom cursors.  These don't appear to be supported
+    by WinRT.  Different OS-provided cursors can, however, be created via
+    SDL_CreateSystemCursor() (unsupported on Windows Phone)
+  * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal().  This are not currently
+    supported by WinRT itself.
+  * joysticks and game controllers that aren't supported by Microsoft's XInput
+    API.
+  * turning off VSync when rendering on Windows Phone.  Attempts to turn VSync
+    off on Windows Phone result either in Direct3D not drawing anything, or it
+    forcing VSync back on.  As such, SDL_RENDERER_PRESENTVSYNC will always get
+    turned-on on Windows Phone.  This limitation is not present in non-Phone
+    WinRT (such as Windows 8.x), where turning off VSync appears to work.
+  * probably anything else that's not listed as supported
+
+
+
+Upgrade Notes
+-------------
+
+#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3
+
+SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().
+The fixes may affect older, SDL 2.0.3-based apps' save data.  Please note
+that these changes only apply to SDL-based WinRT apps, and not to apps for
+any other platform.
+
+1. SDL_GetPrefPath() would return an invalid path, one in which the path's
+   directory had not been created.  Attempts to create files there
+   (via fopen(), for example), would fail, unless that directory was
+   explicitly created beforehand.
+
+2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside
+   a WinRT 'Roaming' folder, the contents of which get automatically
+   synchronized across multiple devices.  This process can occur while an
+   application runs, and can cause existing save-data to be overwritten
+   at unexpected times, with data from other devices.  (Windows Phone apps
+   written with SDL 2.0.3 did not utilize a Roaming folder, due to API
+   restrictions in Windows Phone 8.0).
+
+
+SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
+
+1. making sure that SDL_GetPrefPath() returns a directory in which data
+   can be written to immediately, without first needing to create directories.
+
+2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the
+   contents of which do not automatically get synchronized across devices
+   (and which require less work to use safely, in terms of data integrity).
+
+Apps that wish to get their Roaming folder's path can do so either by using
+SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
+UCS-2/wide-char string), or directly through the WinRT class,
+Windows.Storage.ApplicationData.
+
+
+
+Setup, High-Level Steps
+-----------------------
+
+The steps for setting up a project for an SDL/WinRT app looks like the
+following, at a high-level:
+
+1. create a new Visual C++ project using Microsoft's template for a,
+   "Direct3D App".
+2. remove most of the files from the project.
+3. make your app's project directly reference SDL/WinRT's own Visual C++
+   project file, via use of Visual C++'s "References" dialog.  This will setup
+   the linker, and will copy SDL's .dll files to your app's final output.
+4. adjust your app's build settings, at minimum, telling it where to find SDL's
+   header files.
+5. add files that contains a WinRT-appropriate main function, along with some
+   data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)
+   work properly.
+6. add SDL-specific app code.
+7. build and run your app.
+
+
+Setup, Detailed Steps
+---------------------
+
+### 1. Create a new project ###
+
+Create a new project using one of Visual C++'s templates for a plain, non-XAML,
+"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use).  If you
+don't see one of these templates, in Visual C++'s 'New Project' dialog, try
+using the textbox titled, 'Search Installed Templates' to look for one.
+
+
+### 2. Remove unneeded files from the project ###
+
+In the new project, delete any file that has one of the following extensions:
+
+- .cpp
+- .h
+- .hlsl
+
+When you are done, you should be left with a few files, each of which will be a
+necessary part of your app's project.  These files will consist of:
+
+- an .appxmanifest file, which contains metadata on your WinRT app.  This is
+  similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.
+- a few .png files, one of which is a splash screen (displayed when your app
+  launches), others are app icons.
+- a .pfx file, used for code signing purposes.
+
+
+### 3. Add references to SDL's project files ###
+
+SDL/WinRT can be built in multiple variations, spanning across three different
+CPU architectures (x86, x64, and ARM) and two different configurations
+(Debug and Release).  WinRT and Visual C++ do not currently provide a means
+for combining multiple variations of one library into a single file.
+Furthermore, it does not provide an easy means for copying pre-built .dll files
+into your app's final output (via Post-Build steps, for example).  It does,
+however, provide a system whereby an app can reference the MSVC projects of
+libraries such that, when the app is built:
+
+1. each library gets built for the appropriate CPU architecture(s) and WinRT
+   platform(s).
+2. each library's output, such as .dll files, get copied to the app's build 
+   output.
+
+To set this up for SDL/WinRT, you'll need to run through the following steps:
+
+1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then
+   "Solution Explorer")
+2. right click on your app's solution.
+3. navigate to "Add", then to "Existing Project..."
+4. find SDL/WinRT's Visual C++ project file and open it.  Different project
+   files exist for different WinRT platforms.  All of them are in SDL's
+   source distribution, in the following directories:
+    * `VisualC-WinRT/UWP_VS2015/`        - for Windows 10 / UWP apps
+    * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps
+    * `VisualC-WinRT/WinRT80_VS2012/`    - for Windows 8.0 apps
+    * `VisualC-WinRT/WinRT81_VS2013/`    - for Windows 8.1 apps
+5. once the project has been added, right-click on your app's project and
+   select, "References..."
+6. click on the button titled, "Add New Reference..."
+7. check the box next to SDL
+8. click OK to close the dialog
+9. SDL will now show up in the list of references.  Click OK to close that
+   dialog.
+
+Your project is now linked to SDL's project, insofar that when the app is
+built, SDL will be built as well, with its build output getting included with
+your app.
+
+
+### 4. Adjust Your App's Build Settings ###
+
+Some build settings need to be changed in your app's project.  This guide will
+outline the following:
+
+- making sure that the compiler knows where to find SDL's header files
+- **Optional for C++, but NECESSARY for compiling C code:** telling the
+  compiler not to use Microsoft's C++ extensions for WinRT development.
+- **Optional:** telling the compiler not generate errors due to missing
+  precompiled header files.
+
+To change these settings:
+
+1. right-click on the project
+2. choose "Properties"
+3. in the drop-down box next to "Configuration", choose, "All Configurations"
+4. in the drop-down box next to "Platform", choose, "All Platforms"
+5. in the left-hand list, expand the "C/C++" section
+6. select "General"
+7. edit the "Additional Include Directories" setting, and add a path to SDL's
+   "include" directory
+8. **Optional: to enable compilation of C code:** change the setting for
+   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're 
+   working with a completely C++ based project, this step can usually be 
+   omitted.
+9. **Optional: to disable precompiled headers (which can produce 
+   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand 
+   list, select "Precompiled Headers", then change the setting for "Precompiled 
+   Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
+10. close the dialog, saving settings, by clicking the "OK" button
+
+
+### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###
+
+A few files should be included directly in your app's MSVC project, specifically:
+1. a WinRT-appropriate main function (which is different than main() functions on
+   other platforms)
+2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor
+   (if and when the app needs to do so).  *If this cursor resource is not
+   included, mouse-position reporting may fail if and when the cursor is
+   hidden, due to possible bugs/design-oddities in Windows itself.*
+
+To include these files:
+
+1. right-click on your project (again, in Visual C++'s Solution Explorer), 
+   navigate to "Add", then choose "Existing Item...".
+2. navigate to the directory containing SDL's source code, then into its
+   subdirectory, 'src/main/winrt/'.  Select, then add, the following files:
+   - `SDL_winrt_main_NonXAML.cpp`
+   - `SDL2-WinRTResources.rc`
+   - `SDL2-WinRTResource_BlankCursor.cur`
+3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
+   project), then click on "Properties...".
+4. in the drop-down box next to "Configuration", choose, "All Configurations"
+5. in the drop-down box next to "Platform", choose, "All Platforms"
+6. in the left-hand list, click on "C/C++"
+7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
+8. click the OK button.  This will close the dialog.
+
+
+**NOTE: C++/CX compilation is currently required in at least one file of your 
+app's project.  This is to make sure that Visual C++'s linker builds a 'Windows 
+Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**
+
+
+### 6. Add app code and assets ###
+
+At this point, you can add in SDL-specific source code.  Be sure to include a 
+C-style main function (ie: `int main(int argc, char *argv[])`).  From there you 
+should be able to create a single `SDL_Window` (WinRT apps can only have one 
+window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to 
+draw content.  Events are received via SDL's usual event functions 
+(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets, 
+you can start adding them to the project now.  If not, or if you would like to 
+make sure that you're setup correctly, some short and simple sample code is 
+provided below.
+
+
+#### 6.A. ... when creating a new app ####
+
+If you are creating a new app (rather than porting an existing SDL-based app), 
+or if you would just like a simple app to test SDL/WinRT with before trying to 
+get existing code working, some working SDL/WinRT code is provided below.  To 
+set this up:
+
+1. right click on your app's project
+2. select Add, then New Item.  An "Add New Item" dialog will show up.
+3. from the left-hand list, choose "Visual C++"
+4. from the middle/main list, choose "C++ File (.cpp)"
+5. near the bottom of the dialog, next to "Name:", type in a name for your 
+source file, such as, "main.cpp".
+6. click on the Add button.  This will close the dialog, add the new file to 
+your project, and open the file in Visual C++'s text editor.
+7. Copy and paste the following code into the new file, then save it.
+
+
+    #include <SDL.h>
+    
+    int main(int argc, char **argv)
+    {
+        SDL_DisplayMode mode;
+        SDL_Window * window = NULL;
+        SDL_Renderer * renderer = NULL;
+        SDL_Event evt;
+    
+        if (SDL_Init(SDL_INIT_VIDEO) != 0) {
+            return 1;
+        }
+    
+        if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
+            return 1;
+        }
+    
+        if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
+            return 1;
+        }
+    
+        while (1) {
+            while (SDL_PollEvent(&evt)) {
+            }
+    
+            SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
+            SDL_RenderClear(renderer);
+            SDL_RenderPresent(renderer);
+        }
+    }
+
+
+#### 6.B. Adding code and assets ####
+
+If you have existing code and assets that you'd like to add, you should be able 
+to add them now.  The process for adding a set of files is as such.
+
+1. right click on the app's project
+2. select Add, then click on "New Item..."
+3. open any source, header, or asset files as appropriate.  Support for C and 
+C++ is available.
+
+Do note that WinRT only supports a subset of the APIs that are available to 
+Win32-based apps.  Many portions of the Win32 API and the C runtime are not 
+available.
+
+A list of unsupported C APIs can be found at 
+<http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
+
+General information on using the C runtime in WinRT can be found at 
+<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
+
+A list of supported Win32 APIs for WinRT apps can be found at 
+<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note, 
+the list of supported Win32 APIs for Windows Phone 8.0 is different.  
+That list can be found at 
+<http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
+
+
+### 7. Build and run your app ###
+
+Your app project should now be setup, and you should be ready to build your app.  
+To run it on the local machine, open the Debug menu and choose "Start 
+Debugging".  This will build your app, then run your app full-screen.  To switch 
+out of your app, press the Windows key.  Alternatively, you can choose to run 
+your app in a window.  To do this, before building and running your app, find 
+the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand 
+this by clicking on the arrow on the right side of the list, then click on 
+Simulator.  Once you do that, any time you build and run the app, the app will 
+launch in window, rather than full-screen.
+
+
+#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
+
+**These instructions do not include Windows Phone, despite Windows Phone
+typically running on ARM processors.**  They are specifically for devices
+that use the "Windows RT" operating system, which was a modified version of
+Windows 8.x that ran primarily on ARM-based tablet computers.
+
+To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
+
+- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and 
+  debugs ARM-based apps via IP networks.
+- change a few options on the development machine, both to make sure it builds 
+  for ARM (rather than x86 or x64), and to make sure it knows how to find the 
+  Windows RT device (on the network).
+
+Microsoft's Remote Debugger can be found at 
+<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note 
+that separate versions of this debugger exist for different versions of Visual 
+C++, one each for MSVC 2015, 2013, and 2012.
+
+To setup Visual C++ to launch your app on an ARM device:
+
+1. make sure the Remote Debugger is running on your ARM device, and that it's on 
+   the same IP network as your development machine.
+2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click 
+   it, then change the value to "ARM".
+3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To 
+   do this:
+    1. open the app project's properties
+    2. select "Debugging"
+    3. next to "Machine Name", enter the hostname or IP address of the ARM 
+       device
+    4. if, and only if, you've turned off authentication in the Remote Debugger,
+       then change the setting for "Require Authentication" to No
+    5. click "OK"
+4. build and run the app (from Visual C++).  The first time you do this, a 
+   prompt will show up on the ARM device, asking for a Microsoft Account.  You 
+   do, unfortunately, need to log in here, and will need to follow the 
+   subsequent registration steps in order to launch the app.  After you do so, 
+   if the app didn't already launch, try relaunching it again from within Visual 
+   C++.
+
+
+Troubleshooting
+---------------
+
+#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"
+
+Try adding the following to your linker flags.  In MSVC, this can be done by
+right-clicking on the app project, navigating to Configuration Properties ->
+Linker -> Command Line, then adding them to the Additional Options
+section.
+
+* For Release builds / MSVC-Configurations, add:
+
+    /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib
+
+* For Debug builds / MSVC-Configurations, add:
+
+    /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
+
+
+#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values
+
+This may be caused by a bug in Windows itself, whereby hiding the mouse
+cursor can cause mouse-position reporting to fail.
+
+SDL provides a workaround for this, but it requires that an app links to a
+set of Win32-style cursor image-resource files.  A copy of suitable resource
+files can be found in `src/main/winrt/`.  Adding them to an app's Visual C++
+project file should be sufficient to get the app to use them.
diff --git a/docs/README.md b/docs/README.md
index 4e31069..e0aa33f 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,63 +1,63 @@
-Simple DirectMedia Layer {#mainpage}
-========================
-
-                                  (SDL)
-
-                                Version 2.0
-
----
-http://www.libsdl.org/
-
-Simple DirectMedia Layer is a cross-platform development library designed
-to provide low level access to audio, keyboard, mouse, joystick, and graphics
-hardware via OpenGL and Direct3D. It is used by video playback software,
-emulators, and popular games including Valve's award winning catalog
-and many Humble Bundle games.
-
-SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
-Support for other platforms may be found in the source code.
-
-SDL is written in C, works natively with C++, and there are bindings 
-available for several other languages, including C# and Python.
-
-This library is distributed under the zlib license, which can be found
-in the file "COPYING.txt".
-
-The best way to learn how to use SDL is to check out the header files in
-the "include" subdirectory and the programs in the "test" subdirectory.
-The header files and test programs are well commented and always up to date.
-
-More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
-
-- [Android](README-android.md)
-- [CMake](README-cmake.md)
-- [DirectFB](README-directfb.md)
-- [DynAPI](README-dynapi.md)
-- [Emscripten](README-emscripten.md)
-- [Gesture](README-gesture.md)
-- [Mercurial](README-hg.md)
-- [iOS](README-ios.md)
-- [Linux](README-linux.md)
-- [OS X](README-macosx.md)
-- [Native Client](README-nacl.md)
-- [Pandora](README-pandora.md)
-- [Supported Platforms](README-platforms.md)
-- [Porting information](README-porting.md)
-- [PSP](README-psp.md)
-- [Raspberry Pi](README-raspberrypi.md)
-- [Touch](README-touch.md)
-- [WinCE](README-wince.md)
-- [Windows](README-windows.md)
-- [WinRT](README-winrt.md)
-
-If you need help with the library, or just want to discuss SDL related
-issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php)
-
-If you want to report bugs or contribute patches, please submit them to
-[bugzilla](http://bugzilla.libsdl.org/)
-
-Enjoy!
-
-
-Sam Lantinga <mailto:slouken@libsdl.org>
-
+Simple DirectMedia Layer {#mainpage}
+========================
+
+                                  (SDL)
+
+                                Version 2.0
+
+---
+http://www.libsdl.org/
+
+Simple DirectMedia Layer is a cross-platform development library designed
+to provide low level access to audio, keyboard, mouse, joystick, and graphics
+hardware via OpenGL and Direct3D. It is used by video playback software,
+emulators, and popular games including Valve's award winning catalog
+and many Humble Bundle games.
+
+SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
+Support for other platforms may be found in the source code.
+
+SDL is written in C, works natively with C++, and there are bindings 
+available for several other languages, including C# and Python.
+
+This library is distributed under the zlib license, which can be found
+in the file "COPYING.txt".
+
+The best way to learn how to use SDL is to check out the header files in
+the "include" subdirectory and the programs in the "test" subdirectory.
+The header files and test programs are well commented and always up to date.
+
+More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
+
+- [Android](README-android.md)
+- [CMake](README-cmake.md)
+- [DirectFB](README-directfb.md)
+- [DynAPI](README-dynapi.md)
+- [Emscripten](README-emscripten.md)
+- [Gesture](README-gesture.md)
+- [Mercurial](README-hg.md)
+- [iOS](README-ios.md)
+- [Linux](README-linux.md)
+- [OS X](README-macosx.md)
+- [Native Client](README-nacl.md)
+- [Pandora](README-pandora.md)
+- [Supported Platforms](README-platforms.md)
+- [Porting information](README-porting.md)
+- [PSP](README-psp.md)
+- [Raspberry Pi](README-raspberrypi.md)
+- [Touch](README-touch.md)
+- [WinCE](README-wince.md)
+- [Windows](README-windows.md)
+- [WinRT](README-winrt.md)
+
+If you need help with the library, or just want to discuss SDL related
+issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php)
+
+If you want to report bugs or contribute patches, please submit them to
+[bugzilla](http://bugzilla.libsdl.org/)
+
+Enjoy!
+
+
+Sam Lantinga <mailto:slouken@libsdl.org>
+