From 6d20b0e11321ee36d17889e7a36a8c175aaa197a Mon Sep 17 00:00:00 2001
From: taoenwen <67533945+taoenwen@users.noreply.github.com>
Date: Tue, 29 Jul 2025 11:34:34 +0800
Subject: [PATCH] [TEST] Fix GCC345 compilation for
https://github.com/finalburnneo/FBNeo/commit/5b29d3bd0dc92a665e56a2651b49d524b60048b9
---
makefile.burner_win32_rules | 2 +-
projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj | 1 +
.../visualstudio-2015/fbneo_vs2015.vcxproj.filters | 3 +++
projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj | 1 +
.../visualstudio-2019/fbneo_vs2019.vcxproj.filters | 3 +++
projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj | 1 +
.../visualstudio-2022/fbneo_vs2022.vcxproj.filters | 3 +++
src/burn/burn.cpp | 6 +++---
src/burner/win32/mbtwc.cpp | 8 ++++++++
src/burner/win32/mbtwc.h | 4 ++++
10 files changed, 28 insertions(+), 4 deletions(-)
create mode 100644 src/burner/win32/mbtwc.cpp
create mode 100644 src/burner/win32/mbtwc.h
diff --git a/makefile.burner_win32_rules b/makefile.burner_win32_rules
index 13bc0b38f..dca85a3c5 100644
--- a/makefile.burner_win32_rules
+++ b/makefile.burner_win32_rules
@@ -6,7 +6,7 @@ depobj += about.o bzip.o choose_monitor.o cona.o debugger.o drv.o d3dkmt_sync.o
inpc.o inpcheat.o inpd.o inpdipsw.o inps.o ips_manager.o localise.o localise_download.o localise_gamelist.o main.o \
media.o memcard.o menu.o misc_win32.o neocdlist.o neocdsel.o numdial.o paletteviewer.o placeholder.o popup_win32.o \
progress.o replay.o res.o roms.o run.o scrn.o sel.o sfactd.o splash.o stated.o support_paths.o systeminfo.o wave.o \
- romdata.o \
+ romdata.o mbtwc.o\
\
conc.o cong.o dat.o inputbuf.o gamc.o gami.o image.o ioapi.o misc.o nvram.o sshot.o state.o statec.o unzip.o zipfn.o \
luaconsole.o luaengine.o luasav.o \
diff --git a/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj b/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj
index 4ad375712..275234bd2 100644
--- a/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj
+++ b/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj
@@ -59,6 +59,7 @@
+
diff --git a/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj.filters b/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj.filters
index 4bc2d3f8b..36bba1673 100644
--- a/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj.filters
+++ b/projectfiles/visualstudio-2015/fbneo_vs2015.vcxproj.filters
@@ -3652,6 +3652,9 @@
burn\snd
+
+ burner\win32
+
diff --git a/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj b/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj
index c65b8baf2..e7afd1dc2 100644
--- a/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj
+++ b/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj
@@ -59,6 +59,7 @@
+
diff --git a/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj.filters b/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj.filters
index 4bc2d3f8b..36bba1673 100644
--- a/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj.filters
+++ b/projectfiles/visualstudio-2019/fbneo_vs2019.vcxproj.filters
@@ -3652,6 +3652,9 @@
burn\snd
+
+ burner\win32
+
diff --git a/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj b/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj
index b04b24289..e26a335bd 100644
--- a/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj
+++ b/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj
@@ -59,6 +59,7 @@
+
diff --git a/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj.filters b/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj.filters
index 3a527c576..52280925a 100644
--- a/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj.filters
+++ b/projectfiles/visualstudio-2022/fbneo_vs2022.vcxproj.filters
@@ -3652,6 +3652,9 @@
burn\snd
+
+ burner\win32
+
diff --git a/src/burn/burn.cpp b/src/burn/burn.cpp
index 58bc8d684..81cd7e6a5 100644
--- a/src/burn/burn.cpp
+++ b/src/burn/burn.cpp
@@ -7,7 +7,7 @@
#include "driverlist.h"
#ifdef BUILD_WIN32
-#include
+#include "mbtwc.h"
#endif
#ifndef __LIBRETRO__
@@ -462,11 +462,11 @@ extern "C" TCHAR* BurnDrvGetText(UINT32 i)
if (pszStringW && pszStringA && pszStringA[0]) {
#ifdef BUILD_WIN32
// CP_UTF8 65001
- const int n = MultiByteToWideChar(65001, 0, pszStringA, -1, NULL, 0);
+ const int n = _MultiByteToWideChar(65001, 0, pszStringA, -1, NULL, 0);
if (0 == n)
return NULL;
- if (0 == MultiByteToWideChar(65001, 0, pszStringA, -1, pszStringW, n))
+ if (0 == _MultiByteToWideChar(65001, 0, pszStringA, -1, pszStringW, n))
return NULL;
#else
if (mbstowcs(pszStringW, pszStringA, 256) == -1U) {
diff --git a/src/burner/win32/mbtwc.cpp b/src/burner/win32/mbtwc.cpp
new file mode 100644
index 000000000..30eb4ecc9
--- /dev/null
+++ b/src/burner/win32/mbtwc.cpp
@@ -0,0 +1,8 @@
+#include "mbtwc.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+int _MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char* lpMultiByteStr, int cbMultiByte, wchar_t* lpWideCharStr, int cchWideChar) {
+ return MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar);
+}
\ No newline at end of file
diff --git a/src/burner/win32/mbtwc.h b/src/burner/win32/mbtwc.h
new file mode 100644
index 000000000..5b7cfeb14
--- /dev/null
+++ b/src/burner/win32/mbtwc.h
@@ -0,0 +1,4 @@
+#ifndef _MBTWC_H
+#define _MBTWC_H
+int _MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char* lpMultiByteStr, int cbMultiByte, wchar_t* lpWideCharStr, int cchWideChar);
+#endif