sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
main.cpp
1
#include <cstdio>
2
#include <cstring>
3
4
extern
"C"
{
5
#include <
kernel.h
>
6
}
7
8
#include <iostream>
9
#include <sstream>
10
11
extern
"C"
int
kputs(
char
*s);
12
13
/* A program must never return from main on the rig: that reboots the console. */
14
static
int
rig_failed;
15
static
int
rig_kputs(
char
*s) {
16
if
(strstr(s,
": FAIL"
)) rig_failed = 1;
17
return
kputs(s);
18
}
19
#define kputs rig_kputs
20
21
static
int
test_main() {
22
std::ostringstream oss;
23
oss <<
"ostringstream: "
<< (1 + 41) <<
" "
<< 3.5 <<
"\n"
;
24
std::string text = oss.str();
25
if
(text !=
"ostringstream: 42 3.5\n"
) {
26
kputs((
char
*)
"cxx-iostream: FAIL ostringstream\n"
);
27
return
1;
28
}
29
30
std::cout <<
"cout line"
<< std::endl;
31
32
kputs((
char
*)
"cxx-iostream: PASS\n"
);
33
return
0;
34
}
35
36
int
main() {
37
int
result = test_main();
38
printf(
"[ps2rig] exit=%d\n"
, (result || rig_failed) ? 1 : 0);
39
SleepThread();
40
return
0;
41
}
kernel.h
tests
cxx-iostream
src
main.cpp
Generated by
1.18.0