|
link to this page:
http://pastebin.antiyes.com/pastebin/index281.html
download this file: click here
|
description/question: How To Pause The Game Thread In C PSP
|
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
|
|
static void gamePause(SceUID thid);
static void gameResume(SceUID thid);
//pause game
static void gamePause(SceUID thid){
if(pauseuid >= 0)
return;
pauseuid = thid;
sceKernelGetThreadmanIdList(SCE_KERNEL_TMID_Thread, thread_buf_now, MAX_THREAD, &thread_count_now);
int x, y, match;
for(x = 0; x < thread_count_now; x++){
match = 0;
SceUID tmp_thid = thread_buf_now[x];
for(y = 0; y < thread_count_start; y++){
if((tmp_thid == thread_buf_start[y]) || (tmp_thid == thid)){
match = 1;
break;
}
}
if(match == 0)
sceKernelSuspendThread(tmp_thid);
}
}
//resume game
static void gameResume(SceUID thid){
if(pauseuid != thid)
return;
pauseuid = -1;
int x, y, match;
for(x = 0; x < thread_count_now; x++){
match = 0;
SceUID tmp_thid = thread_buf_now[x];
for(y = 0; y < thread_count_start; y++){
if((tmp_thid == thread_buf_start[y]) || (tmp_thid == thid)){
match = 1;
break;
}
}
if(match == 0)
sceKernelResumeThread(tmp_thid);
}
}
//call to pause
gamePause(thid);
//call to unpause
gameResume(thid);
|
|
|
|
|