aboutsummaryrefslogtreecommitdiff
path: root/examples/system/childexec
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-05-11 23:42:43 +0200
committerGitHub <noreply@github.com>2023-05-11 23:42:43 +0200
commit04d7728350cbd04dd86cd894e906c98673e3f9a7 (patch)
tree08e8c7dd495d1c4c6fcf5f7ba6b4b10693dc42f6 /examples/system/childexec
parenteaec942f56ceec9c14de5c4185a02602abadd50a (diff)
parent58a8306d24fe29d965aa8b40ddc37c3163c0a2f9 (diff)
downloadpsn00bsdk-04d7728350cbd04dd86cd894e906c98673e3f9a7.tar.gz
Merge pull request #70 from Lameguy64/v0.23-wip
Header cleanups, PCDRV, more safety checks, libc and mkpsxiso fixes (v0.23)
Diffstat (limited to 'examples/system/childexec')
-rw-r--r--examples/system/childexec/child/child.c8
-rw-r--r--examples/system/childexec/parent.c24
2 files changed, 15 insertions, 17 deletions
diff --git a/examples/system/childexec/child/child.c b/examples/system/childexec/child/child.c
index dcfbfaf..e5e16b9 100644
--- a/examples/system/childexec/child/child.c
+++ b/examples/system/childexec/child/child.c
@@ -1,5 +1,6 @@
#include <stdint.h>
#include <stdio.h>
+#include <psxetc.h>
#include <psxapi.h>
#include <psxgpu.h>
#include <psxgte.h>
@@ -238,11 +239,12 @@ int main(int argc, const char *argv[]) {
display();
}
-
+
+ DrawSync(0);
StopPAD();
-
+ StopCallback();
+
return 0;
-
}
void init(void) {
diff --git a/examples/system/childexec/parent.c b/examples/system/childexec/parent.c
index 83d964c..cfed11c 100644
--- a/examples/system/childexec/parent.c
+++ b/examples/system/childexec/parent.c
@@ -273,7 +273,7 @@ extern char child_exe[];
void run_child(void) {
// Arguments for the child program
- char *args[] =
+ const char *args[] =
{
"SAMPLE=0",
"SESSION=1",
@@ -285,31 +285,27 @@ void run_child(void) {
// Copy child executable to its intended adddress
memcpy((void*)exe->param.t_addr, child_exe+2048, exe->param.t_size);
-
- // Prepare for program execution and disable interrupts
- //EnterCriticalSection();
- StopCallback();
- // Stop pads, enable auto acknowledge
+ // Prepare for program execution and disable interrupts
+ DrawSync(0);
StopPAD();
- ChangeClearPAD(1);
- ChangeClearRCnt(3, 1);
+ StopCallback();
+ FlushCache();
// Execute child
- printf("Child exec!\n");
+ printf("Executing child...\n");
Exec(&exe->param, 3, args);
-
+
// Restore interrupts for this PS-EXE
RestartCallback();
- //ExitCriticalSection();
-
+ printf("Child returned\n");
+
// Re-init and re-enable pads
InitPAD(pad_buff[0], 34, pad_buff[1], 34);
StartPAD();
ChangeClearPAD(0);
-
+
// Set this program's display mode
SetDispMask(0);
PutDispEnv(&disp);
-
}