mirror of
https://github.com/rvtr/twl_wrapsdk.git
synced 2025-10-31 06:11:10 -04:00
add cs library (translator to unicode)
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@195 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
parent
d9fbb9af01
commit
0351a4cfd1
@ -33,6 +33,7 @@ SUBDIRS = \
|
||||
cdc \
|
||||
snd \
|
||||
camera \
|
||||
cs \
|
||||
fatfs \
|
||||
devices \
|
||||
dsp \
|
||||
|
||||
63
build/libraries/cs/ARM7/Makefile
Normal file
63
build/libraries/cs/ARM7/Makefile
Normal file
@ -0,0 +1,63 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - libraries - mi/ARM7
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 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: $
|
||||
# $NoKeywords: $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# build ARM & THUMB libraries
|
||||
TWL_CODEGEN_ALL ?= True
|
||||
|
||||
# Codegen for sub processer
|
||||
TWL_PROC = ARM7
|
||||
|
||||
SRCDIR = ../common .
|
||||
SRCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/cs/common/src \
|
||||
$(TWL_NITROSDK_ROOT)/build/libraries/cs/ARM7/src \
|
||||
|
||||
INCDIR = ../common
|
||||
INCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/cs/common/include \
|
||||
|
||||
SRCS = sjis2utf.c csjistab.c
|
||||
|
||||
TARGET_LIB = libcs_sp$(TWL_LIBSUFFIX).a
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# DEBUG版ビルドの場合、RELEASE版でビルドして
|
||||
# DEBUG版のライブラリを装います。
|
||||
|
||||
ifdef NITRO_DEBUG
|
||||
NITRO_BUILD_TYPE = RELEASE
|
||||
endif
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
INSTALL_TARGETS = $(TARGETS)
|
||||
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
50
build/libraries/cs/ARM9/Makefile
Normal file
50
build/libraries/cs/ARM9/Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - libraries - mi/ARM9
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 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: $
|
||||
# $NoKeywords: $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# build ARM & THUMB libraries
|
||||
TWL_CODEGEN_ALL ?= True
|
||||
|
||||
SRCDIR = ../common .
|
||||
SRCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/cs/common/src \
|
||||
$(TWL_NITROSDK_ROOT)/build/libraries/cs/ARM9/src \
|
||||
|
||||
INCDIR = ../common
|
||||
INCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/cs/common/include \
|
||||
|
||||
SRCS = sjis2utf.c csjistab.c
|
||||
|
||||
TARGET_LIB = libcs$(TWL_LIBSUFFIX).a
|
||||
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
INSTALL_TARGETS = $(TARGETS)
|
||||
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
34
build/libraries/cs/Makefile
Normal file
34
build/libraries/cs/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - libraries - el
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 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: $
|
||||
# $NoKeywords: $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS = ARM9
|
||||
|
||||
#ifdef TWL_WITH_ARM7
|
||||
SUBDIRS += ARM7
|
||||
#endif
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
3972
build/libraries/cs/common/csjistab.c
Normal file
3972
build/libraries/cs/common/csjistab.c
Normal file
File diff suppressed because it is too large
Load Diff
66
build/libraries/cs/common/sjis2utf.c
Normal file
66
build/libraries/cs/common/sjis2utf.c
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
#include <twl.h>
|
||||
#include <twl/cs/cs.h>
|
||||
|
||||
//#define PRINTDEBUG OS_TPrintf
|
||||
#define PRINTDEBUG( ... ) ((void)0)
|
||||
|
||||
|
||||
|
||||
#define iskanji(c) ((c)>=0x81 && (c)<=0x9F || (c)>=0xE0 && (c)<=0xFC)
|
||||
#define iskanji2(c) ((c)>=0x40 && (c)<=0xFC && (c)!=0x7F)
|
||||
|
||||
|
||||
|
||||
extern void jis_to_unicode( void *to, void *p); //csjistab.c
|
||||
|
||||
static int jis_strlen(u8 * string);
|
||||
static int jis_char_length(u8 *p);
|
||||
static u8 *jis_increment(u8 *p);
|
||||
|
||||
|
||||
|
||||
|
||||
void CS_Sjis2Unicode( void* uni_str, void* jis_str)
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
|
||||
len = jis_strlen( jis_str);
|
||||
for( i=0; i<len; i++) {
|
||||
jis_to_unicode( uni_str, jis_str);
|
||||
jis_str = jis_increment( jis_str);
|
||||
(u8*)uni_str+=2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* return number of jis chars in a string */
|
||||
static int jis_strlen(u8 * string) /*__fn__*/
|
||||
{
|
||||
int len=0;
|
||||
while (*string)
|
||||
{
|
||||
string = jis_increment(string);
|
||||
len++;
|
||||
}
|
||||
PRINTDEBUG( "len:%d\n", len);
|
||||
return len;
|
||||
}
|
||||
/* Return the length of a JIS character, 1 or 2 */
|
||||
static int jis_char_length(u8 *p)
|
||||
{
|
||||
if ((*p >= 0x81 && *p <= 0x9f) || (*p >= 0xe0 && *p <= 0xfc))
|
||||
return(2);
|
||||
else
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Advance a pointer to the next JIS character in a string */
|
||||
static u8 *jis_increment(u8 *p)
|
||||
{
|
||||
return(p + jis_char_length(p));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -208,7 +208,6 @@
|
||||
*/
|
||||
#include <twl.h>
|
||||
#include <rtfs_target_os.h> /* twl modified */
|
||||
//#include <ctr/rtc/rtc.h> /* ctr modified */
|
||||
#include <rtfs.h>
|
||||
#include <portconf.h> /* For included devices */
|
||||
|
||||
|
||||
@ -125,6 +125,7 @@ static void i_rtfsInit( DDRIVE* pdr)
|
||||
{
|
||||
byte drname[8]; /* Temp buffer for displaying drive letters as strings */
|
||||
|
||||
|
||||
/* WARMSTART */
|
||||
if( pdr->dev_table_drive_io) {
|
||||
prtfs_cfg->drno_to_dr_map[pdr->driveno] = pdr; /* MAPS DRIVE structure to DRIVE: */
|
||||
|
||||
@ -691,9 +691,9 @@ byte *unicode_make_printable(byte *p)
|
||||
{
|
||||
int i;
|
||||
byte c;
|
||||
int is_unicode;
|
||||
//int is_unicode; //ctr modified
|
||||
|
||||
is_unicode = 0;
|
||||
// is_unicode = 0; //ctr modified
|
||||
|
||||
if (*(p+BYTE_LOW)!=0) /* Most likely it is ascii */
|
||||
{
|
||||
|
||||
21
include/twl/cs/cs.h
Normal file
21
include/twl/cs/cs.h
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#ifndef __CS_H__
|
||||
#define __CS_H__
|
||||
|
||||
#include <twl.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void CS_Sjis2Unicode( void* uni_str, void* sjis_str);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*__CS_H__*/
|
||||
Loading…
Reference in New Issue
Block a user