/*---------------------------------------------------------------------------* Project: Revolution SDK DS-Wireless FileSystem demo File: fsserver.c Copyright 2006, 2007 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: fsserver.c,v $ Revision 1.5 2007/10/26 08:06:33 seiki_masashi Support for REXDEMOGetAnyMixedPadTrigger. Revision 1.4 2007/10/04 09:41:47 seiki_masashi Support for MP_BEACON_PERIOD_AUTO. Revision 1.3 2007/08/01 09:36:29 kitase_hirotake Changed TAB to SPACE. Revision 1.2 2007/02/09 04:30:11 yosizaki Fixed about includes. Revision 1.1 2007/01/16 08:33:30 yosizaki Initial upload. $NoKeywords: $ *---------------------------------------------------------------------------*/ #include #include #include #include "rexdemo/demokpad.h" #include "rexdemo/graphic.h" /*===========================================================================*/ /* Declarations */ void ExecuteWireless(void* (*alloc)(u32), void (*free)(void*), MEMHeapHandle heap, const void *program); /*===========================================================================*/ /* Constants */ #define MY_GGID 0x003fff23 #define MY_PORT 5 /*===========================================================================*/ /* Variables */ /* MP work structure */ static MPConfig mpConfig = { NULL, NULL, 2, // threadPriority MP_MODE_PARENT, // mode MY_GGID, // ggid MP_TGID_AUTO, // tgid MP_CHANNEL_AUTO, // channel MP_LIFETIME_DEFAULT,// lifeTime MP_BEACON_PERIOD_AUTO, // beaconPeriod 4, // maxNodes 128, // parentMaxSize 14, // childMaxSize TRUE, // entryFlag FALSE, // multiBootFlag 0, // frequency 0, // userGameInfoLength { 0, }, // userGameInfo NULL, // indicationCallbackFunction /// ... // port configuration (can be set up using MPSetPortConfig) }; /*===========================================================================*/ /* Functions */ void ExecuteWireless(void* (*alloc)(u32), void (*free)(void*), MEMHeapHandle heap, const void *program) { MPConfig *config = &mpConfig; /* Initialize MPFS */ MPFSInit(config, heap, program); config->alloc = alloc; config->free = free; /* Startup MP */ MPSetPortConfig(config, MY_PORT, MPFSPortCallback, MP_PRIORITY_LOW); (void)MPStartup(config); for (;;) { REXDEMOKPadRead(); /* Update sequence */ { if ((REXDEMOGetAnyMixedPadTrigger() & (KPAD_BUTTON_A | (PAD_BUTTON_A << 16))) != 0) { break; } } /* DrawFrame */ REXDEMOBeginRender(); { REXDEMOSetTextColor(REXDEMO_COLOR_WHITE); REXDEMOPrintf(4, 8, 0, "MPFS simple sample"); REXDEMOSetTextColor(REXDEMO_COLOR_YELLOW); { REXDEMOPrintf(4, 24, 0, "now running as FS server for DS."); REXDEMOPrintf(40, 44, 0, "(press A to restart new MPDL session)"); } } REXDEMOWaitRetrace(); } (void)MPCleanup(); MPFSEnd(); } /*===========================================================================*/