Enabled UNICODE by default for 64-bit builds.

Fixed several issues with building for Unicode on MSVC.
Almost certainly broke things for MESS/MAMEUI. (Sorry.)
This commit is contained in:
Aaron Giles 2008-01-03 10:19:41 +00:00
parent eb52ade3c8
commit eafea60950
5 changed files with 37 additions and 15 deletions

View File

@ -1738,7 +1738,7 @@ static void memory_determine_combo_items(void)
ci->prefsize = MIN(cpuinfo->space[spacenum].databytes, 8);
t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum));
t_address_space_names = tstring_from_utf8(address_space_names[spacenum]);
_stprintf(ci->name, TEXT("CPU #%d (%s) %s memory"), cpunum, t_cpunum_name, t_address_space_names);
_sntprintf(ci->name, ARRAY_LENGTH(ci->name), TEXT("CPU #%d (%s) %s memory"), cpunum, t_cpunum_name, t_address_space_names);
free(t_address_space_names),
t_address_space_names = NULL;
free(t_cpunum_name);
@ -1808,7 +1808,7 @@ static void memory_determine_combo_items(void)
ci->prefsize = MIN(valsize, 8);
ci->little_endian = TRUE;
t_name = tstring_from_utf8(name);
_tcscpy(ci->name, _tcsrchr(t_name, TEXT('/')) + sizeof(t_name[0]));
_tcscpy(ci->name, _tcsrchr(t_name, TEXT('/')) + 1);
free(t_name);
t_name = NULL;
*tail = ci;
@ -2240,7 +2240,7 @@ static void disasm_create_window(void)
TCHAR name[100];
int item;
t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum));
_stprintf(name, TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name);
_sntprintf(name, ARRAY_LENGTH(name), TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name);
free(t_cpunum_name);
t_cpunum_name = NULL;
item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)name);
@ -2770,7 +2770,7 @@ static void console_set_cpunum(int cpunum)
// then update the caption
snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU %d (%s)", Machine->gamedrv->name, cpu_getactivecpu(), activecpu_name());
win_get_window_text_utf8(main_console->wnd, curtitle, sizeof(curtitle) / sizeof(curtitle[0]));
win_get_window_text_utf8(main_console->wnd, curtitle, ARRAY_LENGTH(curtitle));
if (strcmp(title, curtitle))
win_set_window_text_utf8(main_console->wnd, title);
}

View File

@ -171,7 +171,7 @@ static void led_set_state(int state);
// main
//============================================================
int utf8_main(int argc, char *argv[])
int main(int argc, char *argv[])
{
const char *arg = (argc > 1) ? argv[1] : "";
int exitcode = 1;

View File

@ -27,6 +27,7 @@ extern int utf8_main(int argc, char **argv);
// undo the command-line #define that maps main to utf8_main in all other cases
#ifndef WINUI
#undef main
#undef wmain
#endif
#ifdef __GNUC__

View File

@ -41,6 +41,19 @@
###########################################################################
#-------------------------------------------------
# overrides
#-------------------------------------------------
# turn on unicode for all 64-bit builds regardless
ifndef UNICODE
ifdef PTR64
UNICODE = 1
endif
endif
#-------------------------------------------------
# object and source roots
#-------------------------------------------------
@ -111,6 +124,11 @@ ifdef PTR64
CC += /wd4267
endif
# explicitly set the entry point for UNICODE builds
ifdef UNICODE
LD += /ENTRY:wmainCRTStartup
endif
# add some VC++-specific defines
DEFS += -D_CRT_SECURE_NO_DEPRECATE -DXML_STATIC -D__inline__=__inline -Dsnprintf=_snprintf
@ -122,11 +140,7 @@ BUILD += $(VCONV)
$(VCONV): $(WINOBJ)/vconv.o
@echo Linking $@...
ifdef PTR64
@link.exe /nologo $^ version.lib bufferoverflowu.lib /out:$@
else
@link.exe /nologo $^ version.lib /out:$@
endif
$(WINOBJ)/vconv.o: $(WINSRC)/vconv.c
@echo Compiling $<...
@ -259,12 +273,16 @@ $(LIBOSD): $(OSDOBJS)
# rule for making the ledutil sample
#-------------------------------------------------
ledutil$(EXE): $(WINOBJ)/ledutil.o $(LIBOCORE)
LEDUTIL = ledutil$(EXE)
TOOLS += $(LEDUTIL)
LEDUTILOBJS = \
$(WINOBJ)/ledutil.o
$(LEDUTIL): $(LEDUTILOBJS) $(LIBOCORE)
@echo Linking $@...
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
TOOLS += ledutil$(EXE)
#-------------------------------------------------
@ -272,12 +290,15 @@ TOOLS += ledutil$(EXE)
#-------------------------------------------------
VERINFO = $(WINOBJ)/verinfo$(EXE)
BUILD += $(VERINFO)
$(VERINFO): $(WINOBJ)/verinfo.o $(LIBOCORE)
VERINFOOBJS = \
$(WINOBJ)/verinfo.o
$(VERINFO): $(VERINFOOBJS) $(LIBOCORE)
@echo Linking $@...
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
BUILD += $(VERINFO)

View File

@ -217,7 +217,7 @@ static void winui_output_error(void *param, const char *format, va_list argptr)
// utf8_main
//============================================================
int utf8_main(int argc, char **argv)
int main(int argc, char **argv)
{
char *ext;