Skip to content

Commit f2bb1f1

Browse files
WinterMutefincs
authored andcommitted
rework syscalls for devkitARM r57
1 parent 154a21c commit f2bb1f1

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

source/arm9/system/initSystem.c

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
initSystem.c -- Code for initialising the DS
44
5-
Copyright (C) 2007 - 2010
5+
Copyright (C) 2007 - 2021
66
Dave Murphy (WinterMute)
77
88
This software is provided 'as-is', without any express or implied
@@ -44,9 +44,32 @@ distribution.
4444

4545
void __libnds_exit(int rc);
4646
bool __dsimode; // set in crt0
47-
extern time_t *punixTime;
4847

49-
int __libnds_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz);
48+
time_t *punixTime;
49+
50+
//---------------------------------------------------------------------------------
51+
int __SYSCALL(gettod_r)(struct _reent *ptr, struct timeval *tp, struct timezone *tz) {
52+
//---------------------------------------------------------------------------------
53+
54+
if (tp != NULL) {
55+
tp->tv_sec = *punixTime;
56+
tp->tv_usec = 0;
57+
}
58+
if (tz != NULL) {
59+
tz->tz_minuteswest = 0;
60+
tz->tz_dsttime = 0;
61+
}
62+
63+
return 0;
64+
}
65+
66+
67+
//---------------------------------------------------------------------------------
68+
void __SYSCALL(exit)(int rc) {
69+
//---------------------------------------------------------------------------------
70+
__libnds_exit(rc);
71+
}
72+
5073

5174
//---------------------------------------------------------------------------------
5275
// Reset the DS registers to sensible defaults
@@ -93,9 +116,6 @@ void __attribute__((weak)) initSystem(void) {
93116

94117
punixTime = (time_t*)memUncached((void *)&__transferRegion()->unixTime);
95118

96-
__syscalls.exit = __libnds_exit;
97-
__syscalls.gettod_r = __libnds_gtod;
98-
99119
extern char *fake_heap_end;
100120
__transferRegion()->bootcode = (struct __bootstub *)fake_heap_end;
101121
irqEnable(IRQ_VBLANK);

source/arm9/system/timeSupport.c

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)