1
0
mirror of https://github.com/TASVideos/desmume synced 2024-07-03 08:18:44 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Ruben
79c6a728f6
Merge ae627d6847 into 90d0abdae0 2024-05-25 14:32:39 +01:00
zeromus
90d0abdae0
Merge pull request #792 from atsampson/xopen-strdup
libretro-common: fix implicit declarations
2024-05-13 07:59:48 -05:00
Adam Sampson
738298a9e8 libretro-common: fix implicit declarations
strdup and realpath are only declared by glibc's headers if
_XOPEN_SOURCE >= 500.
2024-05-13 12:47:10 +01:00
zeromus
4a53a30b91 winport - fix bug where desmume would create working directory using some wrong locale encoding and produce a Pok魯n directory instead of using the Pokémon that was already there (fixes #791) 2024-05-12 21:33:49 -04:00
rofl0r
9515af82b2
add an issue template for github (#784) 2024-04-12 21:39:12 +02:00
6 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,19 @@
---
name: New Issue, Bug report, Question
about: New Issue, Bug report, Question
title: ''
labels: ''
assignees: ''
---
## State your operating system:
Windows/Mac/Linux. in case of linux, whether you use CLI, gtk2, or gtk3 version.
## DesMuME version
e.g. 0.9.13 or git master
## Isse
type here what's bothering you, in a detailed manner.

View File

@ -87,7 +87,7 @@ void GetINIPath()
}
FCEUD_MakePathDirs(IniName);
wcscpy(IniNameW,mbstowcs(IniName).c_str()); //careful to use locale C-style mbstowcs to get IniName (which is with locale encoding) to unicode
wcscpy(IniNameW,mbstowcs_locale(IniName).c_str());
//write BOM to get unicode
FILE* test = fopen(IniName,"rb");

View File

@ -20,6 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define _XOPEN_SOURCE 500 /* For strdup, realpath */
#include <stdlib.h>
#include <boolean.h>
#include <string.h>

View File

@ -170,7 +170,7 @@ void createDirectoryRecursively(std::wstring path)
void FCEUD_MakePathDirs(const char *fname)
{
createDirectoryRecursively(mbstowcs(fname));
createDirectoryRecursively(mbstowcs_locale(fname));
}
#endif
//------------------------------

View File

@ -284,6 +284,19 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
return answer;
}
std::wstring mbstowcs_locale(std::string str)
{
#ifdef HOST_WINDOWS
int plenty = str.size()*4+1;
wchar_t *wgarbage = new wchar_t[plenty];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str.data(), -1, wgarbage, plenty);
std::wstring ret = wgarbage;
delete[] wgarbage;
return ret;
#endif
return mbstowcs(str);
}
//convert a std::string to std::wstring
std::wstring mbstowcs(std::string str)
{

View File

@ -107,5 +107,7 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
std::wstring mbstowcs(std::string str);
std::string wcstombs(std::wstring str);
std::wstring mbstowcs_locale(std::string str);
#endif