summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/sdl
diff options
context:
space:
mode:
author npwoods <npwoods@alumni.cmu.edu>2017-09-18 20:28:53 -0400
committer R. Belmont <rb6502@users.noreply.github.com>2017-09-18 20:28:53 -0400
commit3d553eda60e1c5657b195154d2d6623e3c50ba70 (patch)
tree9f42e91558c87f4897d349bf85243a07d46ce5f2 /src/osd/sdl
parenta7d79f96457f769deb43c36638293604f36320f0 (diff)
Attempted to sanitize/rationalize how we access UTF-8 command line arguments (#2532)
Specifically, this creates a call osd_get_command_line() that returns UTF-8 command line arguments as std::vector<std::string>. On non-Windows platforms, this does nothing more than build the vector. On Windows, this invokes GetCommandLineW() and CommandLineToArgvW(). This also attempts to unwind usage of wmain()/_tmain() on Windows, which is not standard. Related to this, this fixes a bug in Imgtool; specifically, non-7 bit ASCII was not being handled correctly in Windows. This is really an admission that the way that Windows handles Unicode and command line arguments sucks, and it is my belief that having a wmain() or _tmain() declaration specific for Windows is a worse solution. C'est la vie. I'm very open to the idea that src/osd/osdcore.[cpp|h] is not the best place to do this. Let me know if I should move it.
Diffstat (limited to 'src/osd/sdl')
-rw-r--r--src/osd/sdl/sdlmain.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp
index 3f4b3815359..4fa78bbed38 100644
--- a/src/osd/sdl/sdlmain.cpp
+++ b/src/osd/sdl/sdlmain.cpp
@@ -183,15 +183,9 @@ sdl_options::sdl_options()
extern "C" DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
#endif
-// translated to utf8_main
-#if defined(SDLMAME_WIN32)
-int main(std::vector<std::string> &args)
-{
-#else
int main(int argc, char** argv)
{
- std::vector<std::string> args(argv, argv+argc);
-#endif
+ std::vector<std::string> args = osd_get_command_line(argc, argv);
int res = 0;
// disable I/O buffering