-
Notifications
You must be signed in to change notification settings - Fork 4
/
padtest.c
60 lines (45 loc) · 1.17 KB
/
padtest.c
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
#include <psx.h>
#include <stdio.h>
#include <string.h>
#include "include/text.h"
#include "include/controllers.h"
#include "include/graphics.h"
#define SOFTWARE_TITLE "PadTest 1.1\n2022-12-05"
#define SOFTWARE_COPYRIGHT "Authors: Shendo, ggrtk.\nPSXSDK by Tails92."
//#define DEBUG
/*Controller for each port*/
Controller Controllers[2];
int main()
{
InitGraphics();
InitPad();
/*Set default values for both controllers*/
ResetPad(&Controllers[0]);
ResetPad(&Controllers[1]);
/*Main loop of the application*/
while(1)
{
/*Flip main and back buffer*/
FlipBuffer();
GsSortCls(0,0,0);
DrawTitle(SOFTWARE_TITLE, SOFTWARE_COPYRIGHT);
ReadPad(&Controllers[0], 0);
ReadPad(&Controllers[1], 1);
/*Draw controllers on the screen*/
DrawController(10, 65, 0, &Controllers[0]);
DrawController(170, 65, 1, &Controllers[1]);
/*Draw primitives from the list*/
GsDrawList();
/*Wait for GPU to finish drawing*/
while(GsIsDrawing());
/*Wait for vertical sync*/
VSync();
#ifdef DEBUG
/*Return to loader (unirom) if 'x' is sent trough serial port*/
if(SIOCheckInBuffer()){
if(SIOReadByte() == 'x') __asm__("j 0x801B0000");
}
#endif
}
return 0;
}