1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> 5<meta http-equiv="Content-Style-Type" content="text/css" /> 6<title>FS_RegisterEventHook</title> 7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 8</head> 9<body> 10 11<h1>FS_RegisterEventHook <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1> 12<h2>Syntax</h2> 13 14<pre><code> 15#include <nitro/fs.h> 16 17typedef u32 FSEvent; 18#define FS_EVENT_MEDIA_INSERTED 0x00000001 19#define FS_EVENT_MEDIA_REMOVED 0x00000002 20 21typedef void (*FSEventFunction)(void *userdata, FSEvent event, void *argument); 22 23void FS_RegisterEventHook(const char *arcname, FSEventHook *hook, FSEventFunction callback, void *userdata); 24</code></pre> 25 26 27<h2>Arguments</h2> 28<table style="width:100%"> 29<tbody> 30<tr> 31<td style="width:13%"><em><strong>arcname</strong></em></td> 32<td style="width:87%">Name of archive to register.</td> 33</tr> 34<tr> 35<td style="width:13%"><em><strong>hook</strong></em></td> 36<td style="width:87%">Pointer to the hook structure to use for registration.</td> 37</tr> 38<tr> 39<td style="width:13%"><em><strong>callback</strong></em></td> 40<td style="width:87%">Callback that should be called when the event occurs.</td> 41</tr> 42<tr> 43<td style="width:13%"><em><strong>userdata</strong></em></td> 44<td style="width:87%">Optional user-defined data that can be passed to the callback arguments (NULL if not required).</td> 45</tr> 46</tbody> 47</table> 48 49<h2>Return Values</h2> 50<p>None.</p> 51 52<h2>Description</h2> 53<p>Registers a hook in response to an event notification for the specified archive. This function is mostly used to monitor events in so-called "removable media" like DS Game Cards or SD Memory Cards. The events that trigger notification are as follows: 54</p> 55<table> 56<tr><td>event</td><td>Description</td><td>arg</td></tr> 57<tr><td>FS_EVENT_MEDIA_INSERTED</td><td>Indicates that media related to the archive was inserted.</td><td>Always NULL.</td></tr> 58<tr><td>FS_EVENT_MEDIA_REMOVED</td><td>Indicates that media related to the archive was removed.</td><td>Always NULL.</td></tr> 59</table> 60 61<h2>Note</h2> 62<ul> 63<li>Registered callback functions will be called from the interrupt handler.</li> 64</ul> 65 66<h2>See Also</h2> 67<p><code><a href="FS_UnregisterEventHook.html">FS_UnregisterEventHook</a></code></p> 68 69<h2>Revision History</h2> 70<p> 712007/12/06 Initial version. 72</p> 73<hr><p>CONFIDENTIAL</p></body> 74</html> 75