mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-12 17:28:14 +03:00
tools: fix iconv issues on Windows
Need to use libiconv on Windows. libiconv doesn't accept all of the same encoding names as the glibc iconv. In particular, CP932 needs to be used instead of SJIS-WIN.
This commit is contained in:
@@ -115,7 +115,7 @@ static void usage(void)
|
||||
puts(" -d, --decrypt Dump decrypted AIN file");
|
||||
puts(" --map Dump AIN file map");
|
||||
puts(" --inline-strings Dump code in inline-strings mode");
|
||||
puts(" --input-encoding <enc> Specify the text encoding of the AIN file (default: SJIS-WIN)");
|
||||
puts(" --input-encoding <enc> Specify the text encoding of the AIN file (default: CP932)");
|
||||
puts(" --output-encoding <enc> Specify the text encoding of the output file (default: UTF-8)");
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ int main(int argc, char *argv[])
|
||||
bool decrypt = false;
|
||||
char *output_file = NULL;
|
||||
FILE *output = stdout;
|
||||
char *input_encoding = "SJIS-WIN";
|
||||
char *input_encoding = "CP932";
|
||||
char *output_encoding = "UTF-8";
|
||||
int err = AIN_SUCCESS;
|
||||
unsigned int flags = DASM_NO_STRINGS;
|
||||
@@ -672,7 +672,7 @@ int main(int argc, char *argv[])
|
||||
if ((output_conv = iconv_open(output_encoding, input_encoding)) == (iconv_t)-1) {
|
||||
ERROR("iconv_open: %s", strerror(errno));
|
||||
}
|
||||
if ((utf8_conv = iconv_open("utf8", input_encoding)) == (iconv_t)-1) {
|
||||
if ((utf8_conv = iconv_open("UTF-8", input_encoding)) == (iconv_t)-1) {
|
||||
ERROR("iconv_open: %s", strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@ aindump = ['../../cJSON.c',
|
||||
]
|
||||
|
||||
executable('aindump', aindump,
|
||||
dependencies : [libm, zlib],
|
||||
dependencies : tool_deps,
|
||||
include_directories : incdir,
|
||||
link_with : libsys4)
|
||||
|
||||
@@ -39,7 +39,7 @@ static void usage(void)
|
||||
puts(" --raw Read code in raw mode");
|
||||
puts(" --inline-strings Read code in inline-strings mode");
|
||||
puts(" --input-encoding <enc> Specify the text encoding of the input file(s) (default: UTF-8)");
|
||||
puts(" --output-encoding <enc> Specify the text encoding of the output file (default: SJIS-WIN)");
|
||||
puts(" --output-encoding <enc> Specify the text encoding of the output file (default: CP932)");
|
||||
//puts(" -p,--project <pje-file> Build AIN from project file");
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
|
||||
const char *text_file = NULL;
|
||||
const char *output_file = NULL;
|
||||
const char *input_encoding = "UTF-8";
|
||||
const char *output_encoding = "SJIS-WIN";
|
||||
const char *output_encoding = "CP932";
|
||||
bool transcode = false;
|
||||
uint32_t flags = ASM_NO_STRINGS;
|
||||
while (1) {
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
case LOPT_TRANSCODE:
|
||||
transcode = true;
|
||||
input_encoding = "SJIS-WIN";
|
||||
input_encoding = "CP932";
|
||||
output_encoding = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
||||
if ((ain_conv = iconv_open(output_encoding, input_encoding)) == (iconv_t)-1) {
|
||||
ERROR("iconv_open: %s", strerror(errno));
|
||||
}
|
||||
if ((print_conv = iconv_open("utf8", output_encoding)) == (iconv_t)-1) {
|
||||
if ((print_conv = iconv_open("UTF-8", output_encoding)) == (iconv_t)-1) {
|
||||
ERROR("iconv_open: %s", strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ endif
|
||||
|
||||
|
||||
executable('ainedit', ainedit, lfiles, pfiles,
|
||||
dependencies : [libm, zlib],
|
||||
dependencies : tool_deps,
|
||||
c_args : ['-Wno-unused-parameter'],
|
||||
include_directories : incdir,
|
||||
link_with : libsys4)
|
||||
|
||||
@@ -2,7 +2,7 @@ alicear = ['alice-ar.c',
|
||||
]
|
||||
|
||||
executable('alice-ar', alicear,
|
||||
dependencies: [libm, zlib],
|
||||
dependencies: tool_deps,
|
||||
c_args : ['-Wno-unused-parameter'],
|
||||
include_directories : incdir,
|
||||
link_with : libsys4)
|
||||
|
||||
@@ -46,7 +46,7 @@ static void usage(void)
|
||||
puts(" -o, --output Set the output file path");
|
||||
puts(" --old Use this for pre-Evenicle .ex files");
|
||||
puts(" --input-encoding <enc> Specify the encoding of the input file (default: UTF-8)");
|
||||
puts(" --output-encoding <enc> Specify the encoding of the output file (default: SJIS-WIN)");
|
||||
puts(" --output-encoding <enc> Specify the encoding of the output file (default: CP932)");
|
||||
}
|
||||
|
||||
enum {
|
||||
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const char *output_file = NULL;
|
||||
const char *input_encoding = "UTF-8";
|
||||
const char *output_encoding = "SJIS-WIN";
|
||||
const char *output_encoding = "CP932";
|
||||
|
||||
while (1) {
|
||||
static struct option long_options[] = {
|
||||
|
||||
@@ -55,7 +55,7 @@ static void usage(void)
|
||||
puts(" -d, --decrypt Decrypt the EX file only");
|
||||
puts(" -o, --output Set the output file path");
|
||||
puts(" -s, --split Split output into multiple files");
|
||||
puts(" --input-encoding <enc> Specify the encoding of the EX file (default: SJIS-WIN)");
|
||||
puts(" --input-encoding <enc> Specify the encoding of the EX file (default: CP932)");
|
||||
puts(" --output-encoding <enc> Specify the encoding of the output file (default UTF-8)");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
||||
bool decrypt = false;
|
||||
bool split = false;
|
||||
char *output_file = NULL;
|
||||
char *input_encoding = "SJIS-WIN";
|
||||
char *input_encoding = "CP932";
|
||||
char *output_encoding = "UTF-8";
|
||||
|
||||
while (1) {
|
||||
|
||||
@@ -13,13 +13,13 @@ exbuild = ['../conv.c',
|
||||
]
|
||||
|
||||
executable('exdump', exdump,
|
||||
dependencies : [libm, zlib],
|
||||
dependencies : tool_deps,
|
||||
c_args : ['-Wno-unused-parameter'],
|
||||
include_directories : incdir,
|
||||
link_with : libsys4)
|
||||
|
||||
executable('exbuild', exbuild, lfiles, pfiles,
|
||||
dependencies : [libm, zlib],
|
||||
dependencies : tool_deps,
|
||||
c_args : ['-Wno-unused-parameter'],
|
||||
include_directories : incdir,
|
||||
link_with : libsys4)
|
||||
|
||||
@@ -14,6 +14,13 @@ if bison.found()
|
||||
arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
|
||||
endif
|
||||
|
||||
if build_machine.system() == 'windows'
|
||||
iconv = dependency('iconv')
|
||||
tool_deps = [libm, zlib, iconv]
|
||||
else
|
||||
tool_deps = [libm, zlib]
|
||||
endif
|
||||
|
||||
subdir('aindump')
|
||||
subdir('ainedit')
|
||||
subdir('ar')
|
||||
|
||||
Reference in New Issue
Block a user