Post: Need some programming help with ioquake3
04-21-2012, 05:03 AM #1
mecenefeaa
I am error
(adsbygoogle = window.adsbygoogle || []).push({}); Quick question, im trying to add this function to ioquake3:
    void Loadexternal ( char *emu, char *rom )
{
pid_t pid;
printf("%s %s \n", emu, rom);
if ((pid = fork()) == 0) {
char * const new_argv[] = { emu, rom, NULL };

if (execv(new_argv[0], new_argv) < 0) {
perror("execv error");
exit(EXIT_FAILURE);
}
} else if (pid < 0) {
perror("fork error");
exit(EXIT_FAILURE);
}

/* You really should use waitpid here so you know when the
* "emu" exits and you can startup the "frontend" again. */
if (waitpid(pid, NULL, 0) == -1) {
perror("waitpid error");
exit(EXIT_FAILURE);
}

printf("Exited successfully\n");
}


But the trick is, it needs to be somewhere out of the way of the vm's because it gives me compiling errors because it includes system files
    #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

so it needs to be in the client code. The reason being is i need to call it from the ui. I did this by putting it in cl_ui.c but it has to go from the ui vm, through the syscalls, then to the client, and its hard to get arguments to pass correctly doing this, is there a better way of doing this? If more info is needed let me know, thank you in advance.
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo