1 /*---------------------------------------------------------------------------* 2 Project: Revolution KPR Key Processing library 3 File: kpr.h 4 5 Copyright 2007 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 $Log: kpr.h,v $ 14 Revision 1.6 2007/05/31 00:25:55 carlmu 15 Added KPRRemoveChar. 16 17 Revision 1.5 2007/05/17 22:16:13 carlmu 18 Misc API changes for 0.10. 19 20 Revision 1.4 2007/05/11 23:21:49 carlmu 21 Added extern "C". 22 Added region-specific initializers for dead-code stripping. 23 24 Revision 1.3 2007/05/05 01:58:13 carlmu 25 Changes for 0.8 API 26 27 Revision 1.2 2007/05/01 21:36:27 carlmu 28 Added KPRClearQueue, modified various API return codes, 29 limited Alt+keypad entries to 8 bits, changed overflow to fatal error. 30 31 Revision 1.1 2007/04/25 19:02:01 carlmu 32 Initial version. 33 34 $NoKeywords: $ 35 *---------------------------------------------------------------------------*/ 36 37 #ifndef __KPR_H__ 38 #define __KPR_H__ 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 // KPR_FLUSH_AKP_CHAR is the character used to finish an Alt+keypad sequence. 45 // KPR_FLUSH_ALL_CHAR will "flush" all unprocessed characters in a queue. 46 47 #define KPR_FLUSH_AKP_CHAR 0x0000 48 #define KPR_FLUSH_ALL_CHAR 0xffff 49 50 typedef enum _KPRMode 51 { 52 KPR_MODE_NONE = 0x00, 53 KPR_MODE_ALT_KEYPAD = 0x01, 54 KPR_MODE_DEADKEY = 0x02, 55 KPR_MODE_JP_ROMAJI_HIRAGANA = 0x04, // this and the next 56 KPR_MODE_JP_ROMAJI_KATAKANA = 0x08 // are mutually exclusive 57 } KPRMode; 58 59 // Note: 5 characters is the longest queue length necessary. 60 // Do not make this bigger; KPR is not a general-purpose queue. 61 #define KPR_MAX_QUEUE_LEN 5 62 63 typedef struct _KPRQueue 64 { 65 wchar_t text[ KPR_MAX_QUEUE_LEN ]; 66 KPRMode mode; 67 u8 oCount; // number of characters available for output 68 u8 iCount; // number of characters that are input 69 u32 altVal; // for building up Alt-keypad value 70 } KPRQueue; 71 72 void KPRInitRegionUS ( void ); 73 void KPRInitRegionJP ( void ); 74 void KPRInitRegionEU ( void ); 75 76 void KPRInitQueue ( KPRQueue *queue ); 77 void KPRClearQueue ( KPRQueue *queue ); 78 void KPRSetMode ( KPRQueue *queue, KPRMode mode ); 79 KPRMode KPRGetMode ( KPRQueue *queue ); 80 u8 KPRPutChar ( KPRQueue *queue, wchar_t inChar ); 81 wchar_t KPRGetChar ( KPRQueue *queue ); 82 wchar_t KPRRemoveChar ( KPRQueue *queue ); 83 u8 KPRLookAhead ( KPRQueue *queue, wchar_t *string, u32 maxSize ); 84 85 #ifdef __cplusplus 86 } 87 #endif 88 89 #endif // __KPR_H__ 90