Skip to content

Commit

Permalink
rework syscalls for devkitARM r57
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterMute authored and fincs committed Jan 8, 2022
1 parent 154a21c commit f2bb1f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
32 changes: 26 additions & 6 deletions source/arm9/system/initSystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
initSystem.c -- Code for initialising the DS
Copyright (C) 2007 - 2010
Copyright (C) 2007 - 2021
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
Expand Down Expand Up @@ -44,9 +44,32 @@ distribution.

void __libnds_exit(int rc);
bool __dsimode; // set in crt0
extern time_t *punixTime;

int __libnds_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz);
time_t *punixTime;

//---------------------------------------------------------------------------------
int __SYSCALL(gettod_r)(struct _reent *ptr, struct timeval *tp, struct timezone *tz) {
//---------------------------------------------------------------------------------

if (tp != NULL) {
tp->tv_sec = *punixTime;
tp->tv_usec = 0;
}
if (tz != NULL) {
tz->tz_minuteswest = 0;
tz->tz_dsttime = 0;
}

return 0;
}


//---------------------------------------------------------------------------------
void __SYSCALL(exit)(int rc) {
//---------------------------------------------------------------------------------
__libnds_exit(rc);
}


//---------------------------------------------------------------------------------
// Reset the DS registers to sensible defaults
Expand Down Expand Up @@ -93,9 +116,6 @@ void __attribute__((weak)) initSystem(void) {

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

__syscalls.exit = __libnds_exit;
__syscalls.gettod_r = __libnds_gtod;

extern char *fake_heap_end;
__transferRegion()->bootcode = (struct __bootstub *)fake_heap_end;
irqEnable(IRQ_VBLANK);
Expand Down
21 changes: 0 additions & 21 deletions source/arm9/system/timeSupport.c

This file was deleted.

0 comments on commit f2bb1f1

Please sign in to comment.