diff --git a/config.h.in b/config.h.in index 7a8d620..b98cc06 100644 --- a/config.h.in +++ b/config.h.in @@ -210,9 +210,6 @@ /* Define this if you have libXxf86vm installed */ #undef HAVE_XF86VMODE -/* Define as const if the declaration of iconv() needs const. */ -#undef ICONV_CONST - /* joystick device */ #undef JOY_DEVICE diff --git a/configure b/configure index 0f02c29..5aa0f64 100755 --- a/configure +++ b/configure @@ -4335,11 +4335,11 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5 -$as_echo "\"yes\"" >&6; };is_emscripten=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; };is_emscripten=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5 -$as_echo "\"no\"" >&6; };is_emscripten=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; };is_emscripten=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -15495,162 +15495,6 @@ fi - - - - - - am_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCICONV; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 -$as_echo_n "checking for iconv... " >&6; } -if ${am_cv_func_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_func_iconv=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_lib_iconv=yes - am_cv_func_iconv=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 -$as_echo "$am_cv_func_iconv" >&6; } - if test "$am_cv_func_iconv" = yes; then - -$as_echo "#define HAVE_ICONV 1" >>confdefs.h - - fi - if test "$am_cv_lib_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 -$as_echo_n "checking how to link with libiconv... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 -$as_echo "$LIBICONV" >&6; } - else - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - - - - if test "$am_cv_func_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 -$as_echo_n "checking for iconv declaration... " >&6; } - if ${am_cv_proto_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - am_cv_proto_iconv_arg1="" -else - am_cv_proto_iconv_arg1="const" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" -fi - - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:- - }$am_cv_proto_iconv" >&5 -$as_echo "${ac_t:- - }$am_cv_proto_iconv" >&6; } - -cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 -_ACEOF - - fi - - # Check whether --enable-gtk was given. if test "${enable_gtk+set}" = set; then : enableval=$enable_gtk; diff --git a/configure.ac b/configure.ac index 63ce57f..0d20a9d 100644 --- a/configure.ac +++ b/configure.ac @@ -140,11 +140,6 @@ dnl [ --enable-pkg-config Enable pkg-config for check glib|gtk [defaul dnl [enable_pkgc=yes]) dnl fi -dnl -dnl check iconv -dnl -AM_ICONV - dnl dnl check for gtk dnl diff --git a/docs/xsystem35.html b/docs/xsystem35.html index 68ea7d7..79398b4 100644 --- a/docs/xsystem35.html +++ b/docs/xsystem35.html @@ -2,7 +2,7 @@ - xsystem35 for web + 鬼畜王 on Web diff --git a/shell/shell.ts b/shell/shell.ts index 51ff3e5..8fd3087 100644 --- a/shell/shell.ts +++ b/shell/shell.ts @@ -80,6 +80,11 @@ namespace xsystem35 { } } Module.print = Module.printErr = console.log.bind(console); + Module.setWindowTitle = (title) => { + let colon = title.indexOf(':'); + if (colon !== -1) + $('.navbar-brand').textContent = title.slice(colon + 1); + }; Module.canvas = document.getElementById('canvas'); Module.noInitialRun = true; Module.setStatus = this.setStatus.bind(this); diff --git a/shell/util.ts b/shell/util.ts index 11d2aea..fe8a300 100644 --- a/shell/util.ts +++ b/shell/util.ts @@ -53,10 +53,11 @@ declare namespace Module { // Undocumented methods / attributes let canvas: HTMLElement; - function setStatus(status: string): void; - function monitorRunDependencies(left: number): void; function callMain(args: string[]): void; function getMemory(size: number): number; + function monitorRunDependencies(left: number): void; + function setStatus(status: string): void; + function setWindowTitle(title: string): void; } declare namespace FS { diff --git a/src/font_freetype2.c b/src/font_freetype2.c index c958769..a052474 100644 --- a/src/font_freetype2.c +++ b/src/font_freetype2.c @@ -34,9 +34,9 @@ #include "system.h" #include "font.h" #include "ags.h" -#include "s2utbl.h" extern int cp932tosjis0213(int code); +extern unsigned short *s2u[]; typedef struct { int size; diff --git a/src/utfsjis.c b/src/utfsjis.c index 9754e7d..3d6525c 100644 --- a/src/utfsjis.c +++ b/src/utfsjis.c @@ -28,48 +28,48 @@ #include #include #include -#ifdef HAVE_ICONV -#include -#endif #include "portab.h" #include "utfsjis.h" - -static char* convert(char* src, const char* tocode, const char* fromcode, int size_multiplier) { -#ifdef HAVE_ICONV - iconv_t cd = iconv_open(tocode, fromcode); - if (cd == (iconv_t)-1) - return NULL; - - size_t srclen = strlen(src); - size_t dstlen = srclen * size_multiplier + 1; - char* dst = malloc(dstlen); - char *srcp = src, *dstp = dst; - if (iconv(cd, &srcp, &srclen, &dstp, &dstlen) == (size_t)-1 || !dstlen) { - free(dst); - iconv_close(cd); - return NULL; - } - *dstp = '\0'; - iconv_close(cd); - return dst; -#else - return NULL; -#endif -} +#include "s2utbl.h" BYTE *sjis2utf(BYTE *src) { - char* dst = convert(src, "utf-8", "shift-jis", 3); - if (!dst) - dst = strdup(src); + BYTE* dst = malloc(strlen(src) * 3 + 1); + BYTE* dstp = dst; + + while (*src) { + if (*src <= 0x7f) { + *dstp++ = *src++; + continue; + } + + int c; + if (*src >= 0xa0 && *src <= 0xdf) { + c = 0xff60 + *src - 0xa0; + src++; + } else { + c = s2u[*src - 0x80][*(src+1) - 0x40]; + src += 2; + } + + if (c <= 0x7f) { + *dstp++ = c; + } else if (c <= 0x7ff) { + *dstp++ = 0xc0 | c >> 6; + *dstp++ = 0x80 | (c & 0x3f); + } else { + *dstp++ = 0xe0 | c >> 12; + *dstp++ = 0x80 | (c >> 6 & 0x3f); + *dstp++ = 0x80 | (c & 0x3f); + } + } + *dstp = '\0'; return dst; } BYTE *utf2sjis(BYTE *src) { - char* dst = convert(src, "shift-jis", "utf-8", 1); - if (!dst) - dst = strdup(src); - return dst; + printf("%s not implemented\n", __func__); + return strdup(src); } /* src 内に半角カナもしくはASCII文字があるかどうか */