PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
alarm.c
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Licenced under Academic Free License version 2.0
7# Review ps2sdk README & LICENSE files for further details.
8*/
9
18#include <kernel.h>
19#include <timer.h>
20#include <stdio.h>
21
23{
24 int syscall;
25 void *function;
26};
27
28static const struct SyscallData SysEntry[] = {
29 {0x5A, &kCopy},
30 {0x5B, (void *)0x80076000},
31 {0xFC, NULL}, // SetAlarm
32 {0xFD, NULL}, // iSetAlarm
33 {0xFE, NULL}, // ReleaseAlarm
34 {0xFF, NULL}, // iReleaseAlarm
35 {0x12C, NULL}, // Intc12Handler (overwrites INTC 12 handler entry)
36 {0x08, NULL}, // ResumeIntrDispatch (Syscall #8)
37};
38
39extern unsigned char srcfile[];
40extern unsigned int size_srcfile;
41
42extern unsigned char eenull[];
43extern unsigned int size_eenull;
44
45__attribute__((weak))
46void InitAlarm(void)
47{
48 // Only apply the kernel patch if T3 has not already started
49 if (((*T3_MODE) & 0x100) == 0)
50 {
51 int i;
52
53 setup(SysEntry[0].syscall, SysEntry[0].function);
54 Copy((void *)0x80076000, srcfile, size_srcfile);
55 Copy((void *)0x00082000, eenull, size_eenull);
56 FlushCache(0);
57 FlushCache(2);
58 setup(SysEntry[1].syscall, SysEntry[1].function);
59
60 for (i = 2; i < 8; i++)
61 {
62 setup(SysEntry[i].syscall, GetEntryAddress(SysEntry[i].syscall));
63 }
64 }
65}