1 /*---------------------------------------------------------------------------* 2 Project: RevolutionDWC Demos 3 File: ./common/include/common.h 4 5 Copyright 2005-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 *---------------------------------------------------------------------------*/ 14 15 #ifndef _COMMON_H_ 16 #define _COMMON_H_ 17 18 #ifdef _WIN32 19 20 #include <dwc.h> 21 #include <windows.h> 22 #include <conio.h> 23 #include <ghttp/ghttp.h> 24 25 #ifndef DWC_NOGS 26 #pragma comment(lib, "gamespy.lib") 27 #endif 28 29 #pragma comment(lib, "NintendoWC.lib") 30 #pragma comment(lib, "nwc_core.lib") 31 32 #pragma comment(lib, "wininet.lib") 33 #pragma comment(lib, "Ws2_32.lib") 34 #pragma comment(lib, "Advapi32.lib") 35 36 #elif defined(RVL) 37 38 #include <dwc.h> 39 #include <revolution/kpad.h> 40 #include <revolution/mem.h> 41 #include <revolution/nand.h> 42 43 /* 44 #define htonl(l) DWCi_HtoLEl((u32)l) 45 #define ntohl(l) DWCi_LEtoHl((u32)l) 46 #define htons(s) DWCi_HtoLEs((u16)s) 47 #define ntohs(s) DWCi_LEtoHs((u16)s) 48 */ 49 #define htonl(l) (l) 50 #define ntohl(l) (l) 51 #define htons(s) (s) 52 #define ntohs(s) (s) 53 54 #elif defined(_LINUX) 55 56 #include <dwc.h> 57 #include <ghttp/ghttp.h> 58 59 #else 60 61 #error "not supported" 62 63 #endif 64 65 /// Key identification flags 66 enum{ 67 DWCDEMO_KEY_LEFT = 0x00000001, ///< Left 68 DWCDEMO_KEY_RIGHT = 0x00000002, ///< Right 69 DWCDEMO_KEY_UP = 0x00000004, ///< Up 70 DWCDEMO_KEY_DOWN = 0x00000008, ///< Down 71 DWCDEMO_KEY_A = 0x00000010, ///< A 72 DWCDEMO_KEY_B = 0x00000020, ///< B 73 DWCDEMO_KEY_X = 0x00000040, ///< X 74 DWCDEMO_KEY_Y = 0x00000080, ///< Y 75 DWCDEMO_KEY_Z = 0x00000100, ///< Z 76 DWCDEMO_KEY_L = 0x00000400, ///< L 77 DWCDEMO_KEY_R = 0x00000800, ///< R 78 DWCDEMO_KEY_START = 0x00000200 ///< START 79 }; 80 81 // Game information 82 #define GAME_NAME "dwctest" // The game name used by this sample. 83 #define GAME_SECRET_KEY "d4q9GZ" // Secret key used in this sample. 84 #define GAME_PRODUCTID 10824 // Product ID used in this sample. 85 #define GAME_SVLID "" // SVLID used in this sample. 86 // # Unnecessary when an independent server is not used. 87 88 #define INITIAL_CODE 'NTRJ' // Game code 89 #define FRIEND_LIST_LEN 64 // Maximum number of friends 90 91 #define FILTER_STRING "rvldwc_demo" // Filter string for matchmaking 92 93 // File name of save data 94 #define SAVEDATA_FILENAME "playerinfo" 95 96 97 // Externally-defined functions 98 #ifdef __cplusplus 99 extern "C" 100 { 101 #endif // __cplusplus 102 103 void DWCDemoMain( void ); 104 u32 DWCDemoPadRead(); 105 void DWCDemoSleep(u32 millisec); 106 void DWCDemoPrintf(const char* format, ...); 107 void DWCDemoPrintfToFixedRow(const char* format, ... ); 108 void DWCDemoPanic(const char* msg); 109 void DWCDemoLoadNAND( const char* filename, s32 seek, u8* buf, u32 bufsize); 110 void DWCDemoSaveNAND( const char* filename, s32 seek, u8* buf, u32 bufsize); 111 void DWCDemoUpdate( void ); 112 #ifndef DWC_NOGS 113 const char* DWCDemoGetFriendStatusString(const DWCFriendData* param); 114 #endif 115 #ifdef _WIN32 116 void DWCViewInfoToTitle(void); 117 #endif 118 119 #ifdef __cplusplus 120 } 121 #endif // __cplusplus 122 123 124 #endif 125