Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ endif
# You generally shouldn't change this unless you are making forked
# versions (or test versions)
# Version numbers must be of the form x.x.x
VERSION = 1.0.6
VERSION = 1.0.7

# Define this if you want a standalone, statically linked, no dependency binary
#STANDALONE_BINARY = 1
Expand Down
1 change: 1 addition & 0 deletions host-src/tool/dc-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ int send_uint(unsigned int value);
unsigned int recv_uint(void);
void recv_data(void *data, unsigned int total, unsigned int verbose);
void send_data(unsigned char *addr, unsigned int size, unsigned int verbose);
void finish_serial(void);

#endif /* __DC_IO_H__ */
24 changes: 14 additions & 10 deletions host-src/tool/dc-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,6 @@ void usage(void) {
printf("-g Start a GDB server\n");
printf("-h Usage information (you\'re looking at it)\n\n");
cleanup();

exit(0);
}

/* Got to make sure WinSock is initalized */
Expand Down Expand Up @@ -1209,11 +1207,14 @@ void do_console(unsigned char *path, unsigned char *isofile) {
case 21:
dc_rewinddir();
break;
case 22:
dc_exit();
break;
default:
printf("Unimplemented command (%d) \n", command);
printf("Assuming program has exited, or something...\n");
finish_serial();
exit(0);
exit(-1);
break;
}
}
Expand Down Expand Up @@ -1263,16 +1264,17 @@ int main(int argc, char *argv[]) {
unsigned char *isofile = 0;
int someopt;

if(argc < 2)
if (argc < 2) {
usage();

exit(-1);
}
someopt = getopt(argc, argv, AVAILABLE_OPTIONS);
while(someopt > 0) {
switch(someopt) {
case 'x':
if(command) {
printf("You can only specify one of -x, -u, and -d\n");
exit(0);
exit(-1);
}
command = 'x';
filename = malloc(strlen(optarg) + 1);
Expand All @@ -1281,7 +1283,7 @@ int main(int argc, char *argv[]) {
case 'u':
if(command) {
printf("You can only specify one of -x, -u, and -d\n");
exit(0);
exit(-1);
}
command = 'u';
filename = malloc(strlen(optarg) + 1);
Expand All @@ -1290,7 +1292,7 @@ int main(int argc, char *argv[]) {
case 'd':
if(command) {
printf("You can only specify one of -x, -u, and -d\n");
exit(0);
exit(-1);
}
command = 'd';
filename = malloc(strlen(optarg) + 1);
Expand Down Expand Up @@ -1332,6 +1334,7 @@ int main(int argc, char *argv[]) {
break;
case 'h':
usage();
exit(0);
break;
case 'e':
speedhack = 1;
Expand Down Expand Up @@ -1359,7 +1362,7 @@ int main(int argc, char *argv[]) {
struct stat statbuf;
if(stat((char *)filename, &statbuf)) {
perror((char *)filename);
exit(1);
exit(-1);
}
}

Expand Down Expand Up @@ -1427,7 +1430,7 @@ int main(int argc, char *argv[]) {
if(!size) {
printf("You must specify a size (-s <size>) with download (-d <filename>)\n");
cleanup();
exit(0);
exit(-1);
}
printf("Download %d bytes at <0x%x> to <%s>\n", size, address,
filename);
Expand All @@ -1439,6 +1442,7 @@ int main(int argc, char *argv[]) {
do_dumbterm();
else
usage();
exit(-1);
break;
}

Expand Down
8 changes: 8 additions & 0 deletions host-src/tool/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,11 @@ void dc_gdbpacket(void) {
if(retval > 0)
send_data((unsigned char *)gdb_buf, retval, 0);
}

void dc_exit(void) {
int exit_code = (int32_t) recv_uint();
printf("Program returned %d\n", exit_code);
finish_serial();
exit(exit_code);
}

2 changes: 2 additions & 0 deletions host-src/tool/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ void dc_cdfs_redir_read_sectors(int isofd);

void dc_gdbpacket(void);

_Noreturn void dc_exit(void);

#endif
5 changes: 3 additions & 2 deletions target-src/dcload/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ int strlen(const char *s) {
return c;
}

void dcexit(void) {
scif_putchar(0);
void dcexit(int ret_code) {
scif_putchar(22);
put_uint(ret_code);
scif_flush();
}

Expand Down