Skip to content

Commit bc3ecb3

Browse files
committed
v0.5
Added 'Press SEL for DriveState()' Added SCECdStatRead and SCECdStatSeek detection to DriveState() Removed sceCdTrayReq(2) & sceCdTrayReq(3) More specific menu, Eject/Insert specified. Now clears the screen instead of overwriting.
1 parent 1c45bfb commit bc3ecb3

File tree

2 files changed

+54
-35
lines changed

2 files changed

+54
-35
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
<img src="https://i.gyazo.com/b0daa39d7cebbb593ac8be7571540538.png">
1+
<img src="https://i.gyazo.com/d1a4967c824f22cdc84329edbffed363.png">
22

33
# PS2Eject
44
A simple homebrew to eject the disc tray of a PS2
55

6+
v0.5 12/20/2019 1:44:27 PM
7+
Added 'Press SEL for DriveState()'
8+
Added SCECdStatRead and SCECdStatSeek detection to DriveState()
9+
Removed sceCdTrayReq(2) & sceCdTrayReq(3)
10+
More specific menu, Eject/Insert specified.
11+
Now clears the screen instead of overwriting.
12+
613
v0.4 12/20/2019 1:00:17 PM
714
Can now select multiple commands
815
Sends sceCdTrayReq(0) and exits in 10s if no controller present/ready

eject.c

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
// A simple homebrew to eject the disc tray of a PS2
22
// PS2Eject v0.4 Written by VTSTech ([email protected])
33

4+
// v0.5 12/20/2019 1:44:27 PM
5+
// Added 'Press SEL for DriveState()'
6+
// Added SCECdStatRead and SCECdStatSeek
7+
// detection to DriveState()
8+
9+
// v0.4 12/20/2019 1:00:17 PM
10+
// Can now select multiple commands
11+
// Sends sceCdTrayReq(0) and exits in 10s if no controller present/ready
12+
// Makefile improvements
13+
414
// v0.3 12/6/2019 5:33:45 PM
515
// Now waits for button press to exit
616
// Otherwise exits in 10s if no controller present/ready
@@ -54,7 +64,7 @@ void InitPS2()
5464
//cdInitAdd();
5565
sleep(1);
5666
}
57-
int DriveState()
67+
void DriveState()
5868
{
5969
int CdStatus;
6070
sleep(1);
@@ -63,36 +73,44 @@ int DriveState()
6373
scr_printf("* sceCdvdDriveState: (00) SCECdStatStop \n");
6474
} else if (CdStatus == 1) {
6575
scr_printf("* sceCdvdDriveState: (01) SCECdStatShellOpen \n");
76+
} else if (CdStatus == 6) {
77+
scr_printf("* sceCdvdDriveState: (06) SCECdStatRead \n");
6678
} else if (CdStatus == 10) {
6779
scr_printf("* sceCdvdDriveState: (10) SCECdStatSpin \n");
80+
} else if (CdStatus == 12) {
81+
scr_printf("* sceCdvdDriveState: (12) SCECdStatSeek \n");
6882
} else {
6983
scr_printf("* sceCdvdDriveState: (%d) Unknown \n",CdStatus);
7084
}
71-
return 0;
85+
}
86+
void menu(){
87+
scr_printf(" \n* Press X for OPEN/EJECT ... \n");
88+
scr_printf(" \n* Press O for CLOSE/INSERT ... \n");
89+
scr_printf(" \n* Press SEL for DriveState() \n");
90+
scr_printf(" \n* Press START to exit \n \n");
7291
}
7392

93+
void banner(){
94+
scr_printf("PS2Eject v0.5 by VTSTech (12.20.2019) \n");
95+
scr_printf("===================www.vts-tech.org== \n \n");
96+
}
7497
int main()
7598
{
7699
int TrayCheck;
100+
int YCheck;
77101
InitPS2();
78102
setupPad();
79103
WaitTime = Timer();
80104
sleep(1);
81105
int state = padGetState(0,0);
82-
scr_printf("PS2Eject v0.4 by VTSTech (12.20.2019) \n");
83-
scr_printf("===================www.vts-tech.org== \n \n");
84-
106+
banner();
85107
if (sceCdInit(SCECdINoD) == 1) {
86108
scr_printf("* libcdvd initalized...\n\n");
87109
}
88110
DriveState();
89111
//scr_printf("padGetState() %d", state);
90112
if (state == 6) {
91-
scr_printf(" \n* Press X for sceCdTrayReq(0) ... \n");
92-
scr_printf(" \n* Press O for sceCdTrayReq(1) ... \n");
93-
scr_printf(" \n* Press [] for sceCdTrayReq(2) ... \n");
94-
scr_printf(" \n* Press /\\ for sceCdTrayReq(3) ... \n");
95-
scr_printf(" \n* Press START to exit \n \n");
113+
menu();
96114
while(1){
97115
state = readpad();
98116
//SEL = 1
@@ -111,36 +129,30 @@ int main()
111129
// O = 8192
112130
// X = 16384
113131
//[ ] = 32768
132+
YCheck = scr_getY();
133+
if (YCheck >=25) {
134+
scr_clear();
135+
banner();
136+
menu();
137+
}
114138
if (new_pad == 16384) {
115139
if (sceCdTrayReq(0,&TrayCheck) == 1) {
116140
scr_printf("* X sceCdTrayReq(0,SCECdTrayCheck): %d \n",TrayCheck);
117141
} else {
118-
scr_printf("! sceCdTrayReq() failed");
119-
}
120-
DriveState();
121-
} else if (new_pad == 8192) {
122-
if (sceCdTrayReq(1,&TrayCheck) == 1) {
123-
scr_printf("* O sceCdTrayReq(1,SCECdTrayCheck): %d \n",TrayCheck);
124-
} else {
125-
scr_printf("! sceCdTrayReq() failed");
126-
}
127-
DriveState();
128-
} else if (new_pad == 32768) {
129-
if (sceCdTrayReq(2,&TrayCheck) == 1) {
130-
scr_printf("* [] sceCdTrayReq(2,SCECdTrayCheck): %d \n",TrayCheck);
131-
} else {
132-
scr_printf("! sceCdTrayReq() failed");
133-
}
134-
DriveState();
135-
} else if (new_pad == 4096) {
136-
if (sceCdTrayReq(3,&TrayCheck) == 1) {
137-
scr_printf("* /\\ sceCdTrayReq(3,SCECdTrayCheck): %d \n",TrayCheck);
142+
scr_printf("! sceCdTrayReq() failed \n");
143+
}
144+
DriveState();
145+
} else if (new_pad == 8192) {
146+
if (sceCdTrayReq(1,&TrayCheck) == 1) {
147+
scr_printf("* O sceCdTrayReq(1,SCECdTrayCheck): %d \n",TrayCheck);
138148
} else {
139-
scr_printf("! sceCdTrayReq() failed");
140-
}
149+
scr_printf("! sceCdTrayReq() failed \n");
150+
}
151+
DriveState();
152+
} else if (new_pad == 8) {
153+
return 0;
154+
} else if (new_pad == 1) {
141155
DriveState();
142-
} else if (new_pad == 8) {
143-
return 0;
144156
}
145157
}
146158
} else {

0 commit comments

Comments
 (0)