diff options
author | 2008-01-03 10:19:41 +0000 | |
---|---|---|
committer | 2008-01-03 10:19:41 +0000 | |
commit | eafea6095095ee14ef47a61ba4c9249a5ffa8a6d (patch) | |
tree | 555633fd52faefa3d06abf5edcbfc5cf80e23f86 | |
parent | eb52ade3c8a5c1eb843898a53a5b65074df825ab (diff) |
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.)
-rw-r--r-- | src/osd/windows/debugwin.c | 8 | ||||
-rw-r--r-- | src/osd/windows/ledutil.c | 2 | ||||
-rw-r--r-- | src/osd/windows/main.c | 1 | ||||
-rw-r--r-- | src/osd/windows/windows.mak | 39 | ||||
-rw-r--r-- | src/osd/windows/winmain.c | 2 |
5 files changed, 37 insertions, 15 deletions
diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 60c4df80cf5..a65d6228fc8 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -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); } diff --git a/src/osd/windows/ledutil.c b/src/osd/windows/ledutil.c index c8caaaa01ae..c707f636930 100644 --- a/src/osd/windows/ledutil.c +++ b/src/osd/windows/ledutil.c @@ -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; diff --git a/src/osd/windows/main.c b/src/osd/windows/main.c index 0f4898b8104..e0e9132c363 100644 --- a/src/osd/windows/main.c +++ b/src/osd/windows/main.c @@ -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__ diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index 6212c9ba5e5..e9d2211a3b3 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -42,6 +42,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) diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 2879f328d3f..01e63150360 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -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; |