Commit a4ddb175f1f1d832960c830191daaab7eb25638f

Ivan Epifanov 2021-03-08T19:28:58

Formatting

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
diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c
index 810b5f4..de2611b 100644
--- a/src/audio/vita/SDL_vitaaudio.c
+++ b/src/audio/vita/SDL_vitaaudio.c
@@ -172,10 +172,6 @@ VITAAUD_Init(SDL_AudioDriverImpl * impl)
 
     impl->OnlyHasDefaultInputDevice = 1;
 */
-    /*
-    impl->DetectDevices = DSOUND_DetectDevices;
-    impl->Deinitialize = DSOUND_Deinitialize;
-    */
     return 1;   /* this audio target is available. */
 }
 
diff --git a/src/audio/vita/SDL_vitaaudio.h b/src/audio/vita/SDL_vitaaudio.h
index 0c1ad52..610a719 100644
--- a/src/audio/vita/SDL_vitaaudio.h
+++ b/src/audio/vita/SDL_vitaaudio.h
@@ -41,5 +41,5 @@ struct SDL_PrivateAudioData {
 };
 
 #endif /* _SDL_vitaaudio_h */
-/* vim: ts=4 sw=4
- */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/joystick/vita/SDL_sysjoystick.c b/src/joystick/vita/SDL_sysjoystick.c
index efa78f1..13439ca 100644
--- a/src/joystick/vita/SDL_sysjoystick.c
+++ b/src/joystick/vita/SDL_sysjoystick.c
@@ -208,7 +208,6 @@ VITA_JoystickSetDevicePlayerIndex(int device_index, int player_index)
 {
 }
 
-
 /* Function to open a joystick for use.
    The joystick to open is specified by the device index.
    This should fill the nbuttons and naxes fields of the joystick structure.
@@ -388,7 +387,6 @@ VITA_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
     return SDL_Unsupported();
 }
 
-
 SDL_JoystickDriver SDL_VITA_JoystickDriver =
 {
     VITA_JoystickInit,
@@ -414,8 +412,6 @@ SDL_JoystickDriver SDL_VITA_JoystickDriver =
     VITA_JoystickQuit,
 };
 
-
 #endif /* SDL_JOYSTICK_VITA */
 
-/* vim: ts=4 sw=4
- */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/vita/SDL_sysmutex_c.h b/src/thread/vita/SDL_sysmutex_c.h
index 7481b66..a05be0b 100644
--- a/src/thread/vita/SDL_sysmutex_c.h
+++ b/src/thread/vita/SDL_sysmutex_c.h
@@ -19,4 +19,5 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "../../SDL_internal.h"
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/vita/SDL_syssem.c b/src/thread/vita/SDL_syssem.c
index 466c5b1..e419465 100644
--- a/src/thread/vita/SDL_syssem.c
+++ b/src/thread/vita/SDL_syssem.c
@@ -159,5 +159,4 @@ int SDL_SemPost(SDL_sem *sem)
 
 #endif /* SDL_THREAD_VITA */
 
-/* vim: ts=4 sw=4
- */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/vita/SDL_systhread.c b/src/thread/vita/SDL_systhread.c
index da8588c..1664fbc 100644
--- a/src/thread/vita/SDL_systhread.c
+++ b/src/thread/vita/SDL_systhread.c
@@ -108,5 +108,4 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
 
 #endif /* SDL_THREAD_VITA */
 
-/* vim: ts=4 sw=4
- */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/thread/vita/SDL_systhread_c.h b/src/thread/vita/SDL_systhread_c.h
index 80bf49d..7084615 100644
--- a/src/thread/vita/SDL_systhread_c.h
+++ b/src/thread/vita/SDL_systhread_c.h
@@ -22,3 +22,5 @@
 #include <psp2/types.h>
 
 typedef SceUID SYS_ThreadHandle;
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/timer/vita/SDL_systimer.c b/src/timer/vita/SDL_systimer.c
index a9009f7..b7cbb22 100644
--- a/src/timer/vita/SDL_systimer.c
+++ b/src/timer/vita/SDL_systimer.c
@@ -87,5 +87,4 @@ void SDL_Delay(Uint32 ms)
 
 #endif /* SDL_TIMER_VITA */
 
-/* vim: ts=4 sw=4
- */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/vita/SDL_vitakeyboard.c b/src/video/vita/SDL_vitakeyboard.c
index f196e33..ed8d769 100644
--- a/src/video/vita/SDL_vitakeyboard.c
+++ b/src/video/vita/SDL_vitakeyboard.c
@@ -42,157 +42,157 @@ Uint8 lock_key_down = 0;
 void 
 VITA_InitKeyboard(void)
 {
-	sceHidKeyboardEnumerate(&keyboard_hid_handle, 1);
+    sceHidKeyboardEnumerate(&keyboard_hid_handle, 1);
 }
 
 void 
 VITA_PollKeyboard(void)
 {
-	// We skip polling keyboard if no window is created
-	if (Vita_Window == NULL)
-		return;
-
-	if (keyboard_hid_handle > 0)
-	{
-		int numReports = sceHidKeyboardRead(keyboard_hid_handle, (SceHidKeyboardReport**)&k_reports, SCE_HID_MAX_REPORT);
-
-		if (numReports < 0) {
-			keyboard_hid_handle = 0;
-		}
-		else if (numReports) {
-			// Numlock and Capslock state changes only on a SDL_PRESSED event
-			// The k_report only reports the state of the LED
-			if (k_reports[numReports - 1].modifiers[1] & 0x1) {
-				if (!(locks & 0x1)) {
-					SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
-					locks |= 0x1;
-				}
-			}
-			else {
-				if (locks & 0x1) {
-					SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
-					SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
-					SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
-					locks &= ~0x1;
-				}
-			}
-
-			if (k_reports[numReports - 1].modifiers[1] & 0x2) {
-				if (!(locks & 0x2)) {
-					SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
-					locks |= 0x2;
-				}
-			}
-			else {
-				if (locks & 0x2) {
-					SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
-					SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
-					SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
-					locks &= ~0x2;
-				}
-			}
-
-			if (k_reports[numReports - 1].modifiers[1] & 0x4) {
-				if (!(locks & 0x4)) {
-					SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_SCROLLLOCK);
-					locks |= 0x4;
-				}
-			}
-			else {
-				if (locks & 0x4) {
-					SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_SCROLLLOCK);
-					locks &= ~0x4;
-				}
-			}
-
-			{
-				Uint8 changed_modifiers = k_reports[numReports - 1].modifiers[0] ^ prev_modifiers;
-
-				if (changed_modifiers & 0x01) {
-					if (prev_modifiers & 0x01) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LCTRL);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LCTRL);
-					}
-				}
-				if (changed_modifiers & 0x02) {
-					if (prev_modifiers & 0x02) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
-					}
-				else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
-					}
-				}
-				if (changed_modifiers & 0x04) {
-					if (prev_modifiers & 0x04) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LALT);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LALT);
-					}
-				}
-				if (changed_modifiers & 0x08) {
-					if (prev_modifiers & 0x08) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LGUI);
-					}
-				}
-				if (changed_modifiers & 0x10) {
-					if (prev_modifiers & 0x10) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RCTRL);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RCTRL);
-					}
-			}
-				if (changed_modifiers & 0x20) {
-					if (prev_modifiers & 0x20) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RSHIFT);
-					}
-				}
-				if (changed_modifiers & 0x40) {
-					if (prev_modifiers & 0x40) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RALT);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RALT);
-					}
-				}
-				if (changed_modifiers & 0x80) {
-					if (prev_modifiers & 0x80) {
-						SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RGUI);
-					}
-					else {
-						SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RGUI);
-					}
-				}
-			}
-
-			prev_modifiers = k_reports[numReports - 1].modifiers[0];
-
-			for (int i = 0; i < 6; i++) {
-
-				int keyCode = k_reports[numReports - 1].keycodes[i];
-
-				if (keyCode != prev_keys[i]) {
-
-					if (prev_keys[i]) {
-						SDL_SendKeyboardKey(SDL_RELEASED, prev_keys[i]);
-					}
-					if (keyCode) {
-						SDL_SendKeyboardKey(SDL_PRESSED, keyCode);
-					}
-					prev_keys[i] = keyCode;
-				}
-			}
-		}
-	}
+    // We skip polling keyboard if no window is created
+    if (Vita_Window == NULL)
+        return;
+
+    if (keyboard_hid_handle > 0)
+    {
+        int numReports = sceHidKeyboardRead(keyboard_hid_handle, (SceHidKeyboardReport**)&k_reports, SCE_HID_MAX_REPORT);
+
+        if (numReports < 0) {
+            keyboard_hid_handle = 0;
+        }
+        else if (numReports) {
+            // Numlock and Capslock state changes only on a SDL_PRESSED event
+            // The k_report only reports the state of the LED
+            if (k_reports[numReports - 1].modifiers[1] & 0x1) {
+                if (!(locks & 0x1)) {
+                    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
+                    locks |= 0x1;
+                }
+            }
+            else {
+                if (locks & 0x1) {
+                    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
+                    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
+                    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
+                    locks &= ~0x1;
+                }
+            }
+
+            if (k_reports[numReports - 1].modifiers[1] & 0x2) {
+                if (!(locks & 0x2)) {
+                    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
+                    locks |= 0x2;
+                }
+            }
+            else {
+                if (locks & 0x2) {
+                    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
+                    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
+                    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
+                    locks &= ~0x2;
+                }
+            }
+
+            if (k_reports[numReports - 1].modifiers[1] & 0x4) {
+                if (!(locks & 0x4)) {
+                    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_SCROLLLOCK);
+                    locks |= 0x4;
+                }
+            }
+            else {
+                if (locks & 0x4) {
+                    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_SCROLLLOCK);
+                    locks &= ~0x4;
+                }
+            }
+
+            {
+                Uint8 changed_modifiers = k_reports[numReports - 1].modifiers[0] ^ prev_modifiers;
+
+                if (changed_modifiers & 0x01) {
+                    if (prev_modifiers & 0x01) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LCTRL);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LCTRL);
+                    }
+                }
+                if (changed_modifiers & 0x02) {
+                    if (prev_modifiers & 0x02) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
+                    }
+                else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
+                    }
+                }
+                if (changed_modifiers & 0x04) {
+                    if (prev_modifiers & 0x04) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LALT);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LALT);
+                    }
+                }
+                if (changed_modifiers & 0x08) {
+                    if (prev_modifiers & 0x08) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LGUI);
+                    }
+                }
+                if (changed_modifiers & 0x10) {
+                    if (prev_modifiers & 0x10) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RCTRL);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RCTRL);
+                    }
+            }
+                if (changed_modifiers & 0x20) {
+                    if (prev_modifiers & 0x20) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RSHIFT);
+                    }
+                }
+                if (changed_modifiers & 0x40) {
+                    if (prev_modifiers & 0x40) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RALT);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RALT);
+                    }
+                }
+                if (changed_modifiers & 0x80) {
+                    if (prev_modifiers & 0x80) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RGUI);
+                    }
+                    else {
+                        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RGUI);
+                    }
+                }
+            }
+
+            prev_modifiers = k_reports[numReports - 1].modifiers[0];
+
+            for (int i = 0; i < 6; i++) {
+
+                int keyCode = k_reports[numReports - 1].keycodes[i];
+
+                if (keyCode != prev_keys[i]) {
+
+                    if (prev_keys[i]) {
+                        SDL_SendKeyboardKey(SDL_RELEASED, prev_keys[i]);
+                    }
+                    if (keyCode) {
+                        SDL_SendKeyboardKey(SDL_PRESSED, keyCode);
+                    }
+                    prev_keys[i] = keyCode;
+                }
+            }
+        }
+    }
 }
 
 #endif /* SDL_VIDEO_DRIVER_VITA */
diff --git a/src/video/vita/SDL_vitamessagebox.c b/src/video/vita/SDL_vitamessagebox.c
index 76d0e94..a1807a5 100644
--- a/src/video/vita/SDL_vitamessagebox.c
+++ b/src/video/vita/SDL_vitamessagebox.c
@@ -38,7 +38,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
     SceMsgDialogUserMessageParam msgParam;
     SceMsgDialogButtonsParam buttonParam;
     SceDisplayFrameBuf dispparam;
-    
+
     SceMsgDialogResult dialog_result;
     SceCommonDialogErrorCode init_result;
     SDL_bool setup_minimal_gxm = SDL_FALSE;
@@ -76,7 +76,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
     dispparam.size = sizeof(dispparam);
 
     init_result = sceMsgDialogInit(&param);
-    
+
     // Setup display if it hasn't been initialized before
     if (init_result == SCE_COMMON_DIALOG_ERROR_GXM_IS_UNINITIALIZED)
     {
diff --git a/src/video/vita/SDL_vitamouse.c b/src/video/vita/SDL_vitamouse.c
index d5af6bf..702524d 100644
--- a/src/video/vita/SDL_vitamouse.c
+++ b/src/video/vita/SDL_vitamouse.c
@@ -40,53 +40,53 @@ Uint8 prev_buttons = 0;
 void 
 VITA_InitMouse(void)
 {
-	sceHidMouseEnumerate(&mouse_hid_handle, 1);
+    sceHidMouseEnumerate(&mouse_hid_handle, 1);
 }
 
 void 
 VITA_PollMouse(void)
 {
-	// We skip polling mouse if no window is created
-	if (Vita_Window == NULL)
-		return;
+    // We skip polling mouse if no window is created
+    if (Vita_Window == NULL)
+        return;
 
-	if (mouse_hid_handle > 0)
-	{
-		int numReports = sceHidMouseRead(mouse_hid_handle, (SceHidMouseReport**)&m_reports, SCE_HID_MAX_REPORT);
-		if (numReports > 0)
-		{	
-			for (int i = 0; i <= numReports - 1; i++)
-			{
-				Uint8 changed_buttons = m_reports[i].buttons ^ prev_buttons;
+    if (mouse_hid_handle > 0)
+    {
+        int numReports = sceHidMouseRead(mouse_hid_handle, (SceHidMouseReport**)&m_reports, SCE_HID_MAX_REPORT);
+        if (numReports > 0)
+        {
+            for (int i = 0; i <= numReports - 1; i++)
+            {
+                Uint8 changed_buttons = m_reports[i].buttons ^ prev_buttons;
 
-				if (changed_buttons & 0x1) {
-					if (prev_buttons & 0x1)
-						SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
-					else
-						SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
-				}
-				if (changed_buttons & 0x2) {
-					if (prev_buttons & 0x2)
-						SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_RIGHT);
-					else
-						SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_RIGHT);
-				}
-				if (changed_buttons & 0x4) {
-					if (prev_buttons & 0x4)
-						SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_MIDDLE);
-					else
-						SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_MIDDLE);
-				}
+                if (changed_buttons & 0x1) {
+                    if (prev_buttons & 0x1)
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
+                    else
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
+                }
+                if (changed_buttons & 0x2) {
+                    if (prev_buttons & 0x2)
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_RIGHT);
+                    else
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_RIGHT);
+                }
+                if (changed_buttons & 0x4) {
+                    if (prev_buttons & 0x4)
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_MIDDLE);
+                    else
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_MIDDLE);
+                }
 
-				prev_buttons = m_reports[i].buttons;
+                prev_buttons = m_reports[i].buttons;
 
-				if (m_reports[i].rel_x || m_reports[i].rel_y)
-				{
-					SDL_SendMouseMotion(Vita_Window, 0, 1, m_reports[i].rel_x, m_reports[i].rel_y);
-				}
-			}
-		}
-	}
+                if (m_reports[i].rel_x || m_reports[i].rel_y)
+                {
+                    SDL_SendMouseMotion(Vita_Window, 0, 1, m_reports[i].rel_x, m_reports[i].rel_y);
+                }
+            }
+        }
+    }
 }
 
 #endif /* SDL_VIDEO_DRIVER_VITA */
diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c
index 7399618..ec250a3 100644
--- a/src/video/vita/SDL_vitatouch.c
+++ b/src/video/vita/SDL_vitatouch.c
@@ -45,124 +45,124 @@ struct{
 void 
 VITA_InitTouch(void)
 {
-	sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
-	sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
-	sceTouchEnableTouchForce(SCE_TOUCH_PORT_FRONT);
-	sceTouchEnableTouchForce(SCE_TOUCH_PORT_BACK);
-
-	for(int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
-		SceTouchPanelInfo panelinfo;
-		sceTouchGetPanelInfo(port, &panelinfo);
-
-		area_info[port].x  = (float)panelinfo.minAaX;
-		area_info[port].y  = (float)panelinfo.minAaY;
-		area_info[port].w  = (float)(panelinfo.maxAaX - panelinfo.minAaX);
-		area_info[port].h  = (float)(panelinfo.maxAaY - panelinfo.minAaY);
-
-		force_info[port].min = (float)panelinfo.minForce;
-		force_info[port].range = (float)(panelinfo.maxForce - panelinfo.minForce);
-	}
-
-	// Support passing both front and back touch devices in events
-	SDL_AddTouch((SDL_TouchID)0, SDL_TOUCH_DEVICE_DIRECT, "Front");
-	SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT,  "Back");
+    sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
+    sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
+    sceTouchEnableTouchForce(SCE_TOUCH_PORT_FRONT);
+    sceTouchEnableTouchForce(SCE_TOUCH_PORT_BACK);
+
+    for(int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+        SceTouchPanelInfo panelinfo;
+        sceTouchGetPanelInfo(port, &panelinfo);
+
+        area_info[port].x  = (float)panelinfo.minAaX;
+        area_info[port].y  = (float)panelinfo.minAaY;
+        area_info[port].w  = (float)(panelinfo.maxAaX - panelinfo.minAaX);
+        area_info[port].h  = (float)(panelinfo.maxAaY - panelinfo.minAaY);
+
+        force_info[port].min = (float)panelinfo.minForce;
+        force_info[port].range = (float)(panelinfo.maxForce - panelinfo.minForce);
+    }
+
+    // Support passing both front and back touch devices in events
+    SDL_AddTouch((SDL_TouchID)0, SDL_TOUCH_DEVICE_DIRECT, "Front");
+    SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT,  "Back");
 }
 
 void 
 VITA_QuitTouch(void){
-	sceTouchDisableTouchForce(SCE_TOUCH_PORT_FRONT);
-	sceTouchDisableTouchForce(SCE_TOUCH_PORT_BACK);
+    sceTouchDisableTouchForce(SCE_TOUCH_PORT_FRONT);
+    sceTouchDisableTouchForce(SCE_TOUCH_PORT_BACK);
 }
 
 void 
 VITA_PollTouch(void)
 {
-	SDL_FingerID finger_id = 0;
-	int port;
-
-	// We skip polling touch if no window is created
-	if (Vita_Window == NULL)
-		return;
-
-	memcpy(touch_old, touch, sizeof(touch_old));
-
-	for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
-		sceTouchPeek(port, &touch[port], 1);
-		if (touch[port].reportNum > 0) {
-			for (int i = 0; i < touch[port].reportNum; i++)
-			{
-				// adjust coordinates and forces to return normalized values
-				// for the front, screen area is used as a reference (for direct touch)
-				// e.g. touch_x = 1.0 corresponds to screen_x = 960
-				// for the back panel, the active touch area is used as reference
-				float x = 0;
-				float y = 0;
-				float force = (touch[port].report[i].force - force_info[port].min) / force_info[port].range;
-				VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port);
-				finger_id = (SDL_FingerID) touch[port].report[i].id;
-
-				// Send an initial touch
-				SDL_SendTouch((SDL_TouchID)port,
-					finger_id,
-					Vita_Window,
-					SDL_TRUE,
-					x,
-					y,
-					force);
-
-				// Always send the motion
-				SDL_SendTouchMotion((SDL_TouchID)port,
-					finger_id,
-					Vita_Window,
-					x,
-					y,
-					force);
-			}
-		}
-
-		// some fingers might have been let go
-		if (touch_old[port].reportNum > 0) {
-			for (int i = 0; i < touch_old[port].reportNum; i++) {
-				int finger_up = 1;
-				if (touch[port].reportNum > 0) {
-					for (int j = 0; j < touch[port].reportNum; j++) {
-						if (touch[port].report[j].id == touch_old[port].report[i].id ) {
-							finger_up = 0;
-						}
-					}
-				}
-				if (finger_up == 1) {
-					float x = 0;
-					float y = 0;
-					float force = (touch_old[port].report[i].force - force_info[port].min) / force_info[port].range;
-					VITA_ConvertTouchXYToSDLXY(&x, &y, touch_old[port].report[i].x, touch_old[port].report[i].y, port);
-					finger_id = (SDL_FingerID) touch_old[port].report[i].id;
-					// Finger released from screen
-					SDL_SendTouch((SDL_TouchID)port,
-						finger_id,
-						Vita_Window,
-						SDL_FALSE,
-						x,
-						y,
-						force);
-				}
-			}
-		}
-	}
+    SDL_FingerID finger_id = 0;
+    int port;
+
+    // We skip polling touch if no window is created
+    if (Vita_Window == NULL)
+        return;
+
+    memcpy(touch_old, touch, sizeof(touch_old));
+
+    for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+        sceTouchPeek(port, &touch[port], 1);
+        if (touch[port].reportNum > 0) {
+            for (int i = 0; i < touch[port].reportNum; i++)
+            {
+                // adjust coordinates and forces to return normalized values
+                // for the front, screen area is used as a reference (for direct touch)
+                // e.g. touch_x = 1.0 corresponds to screen_x = 960
+                // for the back panel, the active touch area is used as reference
+                float x = 0;
+                float y = 0;
+                float force = (touch[port].report[i].force - force_info[port].min) / force_info[port].range;
+                VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port);
+                finger_id = (SDL_FingerID) touch[port].report[i].id;
+
+                // Send an initial touch
+                SDL_SendTouch((SDL_TouchID)port,
+                    finger_id,
+                    Vita_Window,
+                    SDL_TRUE,
+                    x,
+                    y,
+                    force);
+
+                // Always send the motion
+                SDL_SendTouchMotion((SDL_TouchID)port,
+                    finger_id,
+                    Vita_Window,
+                    x,
+                    y,
+                    force);
+            }
+        }
+
+        // some fingers might have been let go
+        if (touch_old[port].reportNum > 0) {
+            for (int i = 0; i < touch_old[port].reportNum; i++) {
+                int finger_up = 1;
+                if (touch[port].reportNum > 0) {
+                    for (int j = 0; j < touch[port].reportNum; j++) {
+                        if (touch[port].report[j].id == touch_old[port].report[i].id ) {
+                            finger_up = 0;
+                        }
+                    }
+                }
+                if (finger_up == 1) {
+                    float x = 0;
+                    float y = 0;
+                    float force = (touch_old[port].report[i].force - force_info[port].min) / force_info[port].range;
+                    VITA_ConvertTouchXYToSDLXY(&x, &y, touch_old[port].report[i].x, touch_old[port].report[i].y, port);
+                    finger_id = (SDL_FingerID) touch_old[port].report[i].id;
+                    // Finger released from screen
+                    SDL_SendTouch((SDL_TouchID)port,
+                        finger_id,
+                        Vita_Window,
+                        SDL_FALSE,
+                        x,
+                        y,
+                        force);
+                }
+            }
+        }
+    }
 }
 
 void VITA_ConvertTouchXYToSDLXY(float *sdl_x, float *sdl_y, int vita_x, int vita_y, int port) {
-	float x = (vita_x - area_info[port].x) / area_info[port].w;
-	float y = (vita_y - area_info[port].y) / area_info[port].h;
+    float x = (vita_x - area_info[port].x) / area_info[port].w;
+    float y = (vita_y - area_info[port].y) / area_info[port].h;
 
-	x = SDL_max(x, 0.0);
-	x = SDL_min(x, 1.0);
+    x = SDL_max(x, 0.0);
+    x = SDL_min(x, 1.0);
 
-	y = SDL_max(y, 0.0);
-	y = SDL_min(y, 1.0);
+    y = SDL_max(y, 0.0);
+    y = SDL_min(y, 1.0);
 
-	*sdl_x = x;
-	*sdl_y = y;
+    *sdl_x = x;
+    *sdl_y = y;
 }
 
 
diff --git a/src/video/vita/SDL_vitavideo.h b/src/video/vita/SDL_vitavideo.h
index 63944a3..13ea895 100644
--- a/src/video/vita/SDL_vitavideo.h
+++ b/src/video/vita/SDL_vitavideo.h
@@ -31,11 +31,11 @@
 
 typedef struct SDL_VideoData
 {
-	SDL_bool egl_initialized;   /* OpenGL device initialization status */
-	uint32_t egl_refcount;      /* OpenGL reference count              */
+    SDL_bool egl_initialized;   /* OpenGL device initialization status */
+    uint32_t egl_refcount;      /* OpenGL reference count              */
 
-	SceWChar16 ime_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
-	SDL_bool ime_active;
+    SceWChar16 ime_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
+    SDL_bool ime_active;
 
 } SDL_VideoData;