mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-11 08:48:11 +03:00
Imported SJIS -> Unicode converter from xsystem35
This commit is contained in:
@@ -25,7 +25,6 @@ OBJS = src/fileio.o \
|
||||
src/sys/nact_sys3.o \
|
||||
src/win/nact_win.o \
|
||||
src/win/mako_win.o \
|
||||
src/win/unicode.o \
|
||||
src/res3/Script1.o
|
||||
|
||||
DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
+1
-2
@@ -25,8 +25,7 @@ OBJS = src/fileio.o \
|
||||
src/sys/nact_input.o \
|
||||
src/sys/nact_sys3.o \
|
||||
src/linux/nact_linux.o \
|
||||
src/linux/mako_linux.o \
|
||||
src/linux/unicode.o
|
||||
src/linux/mako_linux.o
|
||||
|
||||
DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
|
||||
+9
-4
@@ -28,14 +28,19 @@ typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed long int32;
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#define _MAX_PATH PATH_MAX
|
||||
#define sscanf_s sscanf
|
||||
#define sprintf_s snprintf
|
||||
void strcpy_s(char* dst, size_t n, const char* src);
|
||||
#endif
|
||||
|
||||
// utilities
|
||||
uint16 sjis_to_unicode(uint16 sjis);
|
||||
inline void strcpy_s(char* dst, size_t n, const char* src)
|
||||
{
|
||||
strncpy(dst, src, n);
|
||||
dst[n - 1] = '\0';
|
||||
}
|
||||
|
||||
#endif // !WIN32
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "common.h"
|
||||
|
||||
uint16 sjis_to_unicode(uint16 code)
|
||||
{
|
||||
// TODO: correct impl
|
||||
return code;
|
||||
}
|
||||
|
||||
void strcpy_s(char* dst, size_t n, const char* src)
|
||||
{
|
||||
strncpy(dst, src, n);
|
||||
dst[n - 1] = '\0';
|
||||
}
|
||||
@@ -5,6 +5,16 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include "s2utbl.h"
|
||||
|
||||
inline uint16 sjis_to_unicode(uint16 code)
|
||||
{
|
||||
if (code >= 0xa0 && code <= 0xdf)
|
||||
return 0xff60 + code - 0xa0;
|
||||
if (code < 0x100)
|
||||
return code;
|
||||
return s2u[(code >> 8) - 0x80][(code & 0xff) - 0x40];
|
||||
}
|
||||
|
||||
void AGS::draw_text(char string[])
|
||||
{
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "common.h"
|
||||
#include <windows.h>
|
||||
|
||||
uint16 sjis_to_unicode(uint16 code)
|
||||
{
|
||||
char string[3];
|
||||
int length;
|
||||
|
||||
if(code > 0xff) {
|
||||
string[0] = code >> 8;
|
||||
string[1] = code & 0xff;
|
||||
string[2] = '\0';
|
||||
length = 2;
|
||||
} else {
|
||||
string[0] = code & 0xff;
|
||||
string[1] = '\0';
|
||||
length = 1;
|
||||
}
|
||||
uint16 buf[2];
|
||||
MultiByteToWideChar(CP_ACP, 0, string, length, (LPWSTR)buf, 2);
|
||||
return buf[0];
|
||||
}
|
||||
Reference in New Issue
Block a user