attempt something. maybe this worked, maybe not.
This commit is contained in:
commit
3b3a09ed2b
|
@ -1,6 +1,12 @@
|
|||
name: CMake Build (Ubuntu x86-64)
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
name: CMake Build (Windows x86-64)
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
|
|
@ -94,6 +94,7 @@ If everything went well, melonDS and the libraries it needs should now be in the
|
|||
|
||||
* Martin for GBAtek, a good piece of documentation
|
||||
* Cydrak for the extra 3D GPU research
|
||||
* limittox for the icon
|
||||
* All of you comrades who have been testing melonDS, reporting issues, suggesting shit, etc
|
||||
|
||||
## License
|
||||
|
|
294
melonDS.cbp
294
melonDS.cbp
|
@ -1,294 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="melonDS" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="bin/Debug/melonDS" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-m64" />
|
||||
<Add option="-gdwarf-2" />
|
||||
<Add option="-D_FILE_OFFSET_BITS=64" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-m64" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="bin/Release/melonDS" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O3" />
|
||||
<Add option="-m64" />
|
||||
<Add option="-flto" />
|
||||
<Add option="-D_FILE_OFFSET_BITS=64" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add option="-m64" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="DebugFast Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="bin/DebugFast/melonDS" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/DebugFast/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O3" />
|
||||
<Add option="-m64" />
|
||||
<Add option="-D_FILE_OFFSET_BITS=64" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-m64" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="DebugFast-Cap Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="bin/DebugFast_Cap/melonDS" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/DebugFast_Cap/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O3" />
|
||||
<Add option="-m64" />
|
||||
<Add option="-D_FILE_OFFSET_BITS=64" />
|
||||
<Add option="-DMELONCAP" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-m64" />
|
||||
<Add library="winusb" />
|
||||
<Add library="setupapi" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-pipe" />
|
||||
<Add directory="src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="SDL2" />
|
||||
<Add library="shell32" />
|
||||
<Add library="comctl32" />
|
||||
<Add library="comdlg32" />
|
||||
<Add library="advapi32" />
|
||||
<Add library="wsock32" />
|
||||
<Add library="oleacc" />
|
||||
<Add library="ole32" />
|
||||
<Add library="usp10" />
|
||||
<Add library="gdi32" />
|
||||
<Add library="d2d1" />
|
||||
<Add library="dwrite" />
|
||||
<Add library="uxtheme" />
|
||||
<Add library="iphlpapi" />
|
||||
<Add library="user32" />
|
||||
<Add library="ws2_32" />
|
||||
<Add library="opengl32" />
|
||||
</Linker>
|
||||
<Unit filename="melon.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="src/ARCodeList.cpp" />
|
||||
<Unit filename="src/ARCodeList.h" />
|
||||
<Unit filename="src/AREngine.cpp" />
|
||||
<Unit filename="src/AREngine.h" />
|
||||
<Unit filename="src/ARM.cpp" />
|
||||
<Unit filename="src/ARM.h" />
|
||||
<Unit filename="src/ARMInterpreter.cpp" />
|
||||
<Unit filename="src/ARMInterpreter.h" />
|
||||
<Unit filename="src/ARMInterpreter_ALU.cpp" />
|
||||
<Unit filename="src/ARMInterpreter_ALU.h" />
|
||||
<Unit filename="src/ARMInterpreter_Branch.cpp" />
|
||||
<Unit filename="src/ARMInterpreter_Branch.h" />
|
||||
<Unit filename="src/ARMInterpreter_LoadStore.cpp" />
|
||||
<Unit filename="src/ARMInterpreter_LoadStore.h" />
|
||||
<Unit filename="src/ARM_InstrTable.h" />
|
||||
<Unit filename="src/CP15.cpp" />
|
||||
<Unit filename="src/CRC32.cpp" />
|
||||
<Unit filename="src/CRC32.h" />
|
||||
<Unit filename="src/Config.cpp" />
|
||||
<Unit filename="src/Config.h" />
|
||||
<Unit filename="src/DMA.cpp" />
|
||||
<Unit filename="src/DMA.h" />
|
||||
<Unit filename="src/FIFO.h" />
|
||||
<Unit filename="src/GBACart.cpp" />
|
||||
<Unit filename="src/GBACart.h" />
|
||||
<Unit filename="src/GPU.cpp" />
|
||||
<Unit filename="src/GPU.h" />
|
||||
<Unit filename="src/GPU2D.cpp" />
|
||||
<Unit filename="src/GPU2D.h" />
|
||||
<Unit filename="src/GPU3D.cpp" />
|
||||
<Unit filename="src/GPU3D.h" />
|
||||
<Unit filename="src/GPU3D_OpenGL.cpp" />
|
||||
<Unit filename="src/GPU3D_OpenGL_shaders.h" />
|
||||
<Unit filename="src/GPU3D_Soft.cpp" />
|
||||
<Unit filename="src/NDS.cpp" />
|
||||
<Unit filename="src/NDS.h" />
|
||||
<Unit filename="src/NDSCart.cpp" />
|
||||
<Unit filename="src/NDSCart.h" />
|
||||
<Unit filename="src/OpenGLSupport.cpp" />
|
||||
<Unit filename="src/OpenGLSupport.h" />
|
||||
<Unit filename="src/Platform.h" />
|
||||
<Unit filename="src/RTC.cpp" />
|
||||
<Unit filename="src/RTC.h" />
|
||||
<Unit filename="src/SPI.cpp" />
|
||||
<Unit filename="src/SPI.h" />
|
||||
<Unit filename="src/SPU.cpp" />
|
||||
<Unit filename="src/SPU.h" />
|
||||
<Unit filename="src/Savestate.cpp" />
|
||||
<Unit filename="src/Savestate.h" />
|
||||
<Unit filename="src/Wifi.cpp" />
|
||||
<Unit filename="src/Wifi.h" />
|
||||
<Unit filename="src/WifiAP.cpp" />
|
||||
<Unit filename="src/WifiAP.h" />
|
||||
<Unit filename="src/frontend/qt_sdl/main.cpp" />
|
||||
<Unit filename="src/frontend/qt_sdl/main.h" />
|
||||
<Unit filename="src/libui_sdl/DlgAudioSettings.cpp" />
|
||||
<Unit filename="src/libui_sdl/DlgAudioSettings.h" />
|
||||
<Unit filename="src/libui_sdl/DlgEmuSettings.cpp" />
|
||||
<Unit filename="src/libui_sdl/DlgEmuSettings.h" />
|
||||
<Unit filename="src/libui_sdl/DlgInputConfig.cpp" />
|
||||
<Unit filename="src/libui_sdl/DlgInputConfig.h" />
|
||||
<Unit filename="src/libui_sdl/DlgVideoSettings.cpp" />
|
||||
<Unit filename="src/libui_sdl/DlgVideoSettings.h" />
|
||||
<Unit filename="src/libui_sdl/DlgWifiSettings.cpp" />
|
||||
<Unit filename="src/libui_sdl/DlgWifiSettings.h" />
|
||||
<Unit filename="src/libui_sdl/LAN_PCap.cpp" />
|
||||
<Unit filename="src/libui_sdl/LAN_PCap.h" />
|
||||
<Unit filename="src/libui_sdl/LAN_Socket.cpp" />
|
||||
<Unit filename="src/libui_sdl/LAN_Socket.h" />
|
||||
<Unit filename="src/libui_sdl/MelonCap.cpp">
|
||||
<Option target="DebugFast-Cap Windows" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/MelonCap.h">
|
||||
<Option target="DebugFast-Cap Windows" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/OSD.cpp" />
|
||||
<Unit filename="src/libui_sdl/OSD.h" />
|
||||
<Unit filename="src/libui_sdl/Platform.cpp" />
|
||||
<Unit filename="src/libui_sdl/PlatformConfig.cpp" />
|
||||
<Unit filename="src/libui_sdl/PlatformConfig.h" />
|
||||
<Unit filename="src/libui_sdl/font.h" />
|
||||
<Unit filename="src/libui_sdl/libui/common/areaevents.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/common/control.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/common/controlsigs.h" />
|
||||
<Unit filename="src/libui_sdl/libui/common/debug.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/common/matrix.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/common/shouldquit.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/common/uipriv.h" />
|
||||
<Unit filename="src/libui_sdl/libui/common/userbugs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/ui.h" />
|
||||
<Unit filename="src/libui_sdl/libui/ui_windows.h" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/_uipriv_migrate.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/alloc.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/area.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/area.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/areadraw.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/areaevents.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/areascroll.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/areautil.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/box.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/button.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/checkbox.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/colorbutton.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/colordialog.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/combobox.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/compilerver.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/container.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/control.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/d2dscratch.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/datetimepicker.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/debug.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/draw.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/draw.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/drawmatrix.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/drawpath.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/drawtext.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/dwrite.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/editablecombo.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/entry.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/events.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/fontbutton.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/fontdialog.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/form.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/gl.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/graphemes.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/grid.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/group.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/init.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/label.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/main.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/menu.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/multilineentry.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/parent.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/progressbar.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/radiobuttons.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/resources.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/resources.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="src/libui_sdl/libui/windows/separator.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/sizing.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/slider.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/spinbox.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/stddialogs.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/tab.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/tabpage.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/text.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/uipriv_windows.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/utf16.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/utilwin.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/winapi.hpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/window.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/winpublic.cpp" />
|
||||
<Unit filename="src/libui_sdl/libui/windows/winutil.cpp" />
|
||||
<Unit filename="src/libui_sdl/main.cpp" />
|
||||
<Unit filename="src/libui_sdl/main_shaders.h" />
|
||||
<Unit filename="src/pcap/bluetooth.h" />
|
||||
<Unit filename="src/pcap/bpf.h" />
|
||||
<Unit filename="src/pcap/can_socketcan.h" />
|
||||
<Unit filename="src/pcap/compiler-tests.h" />
|
||||
<Unit filename="src/pcap/dlt.h" />
|
||||
<Unit filename="src/pcap/funcattrs.h" />
|
||||
<Unit filename="src/pcap/ipnet.h" />
|
||||
<Unit filename="src/pcap/namedb.h" />
|
||||
<Unit filename="src/pcap/nflog.h" />
|
||||
<Unit filename="src/pcap/pcap-inttypes.h" />
|
||||
<Unit filename="src/pcap/pcap.h" />
|
||||
<Unit filename="src/pcap/sll.h" />
|
||||
<Unit filename="src/pcap/usb.h" />
|
||||
<Unit filename="src/pcap/vlan.h" />
|
||||
<Unit filename="src/types.h" />
|
||||
<Unit filename="src/version.h" />
|
||||
<Unit filename="xp.manifest" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
|
@ -22,10 +22,11 @@
|
|||
#include <string.h>
|
||||
|
||||
// Qt includes and shit here, I guess
|
||||
#include <QtCore/QBitArray>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "../version.h"
|
||||
#include "../../version.h"
|
||||
|
||||
|
||||
//
|
||||
|
@ -43,3 +44,42 @@ int main(int argc, char** argv)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdshow)
|
||||
{
|
||||
int argc = 0;
|
||||
wchar_t** argv_w = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
char* nullarg = "";
|
||||
|
||||
char** argv = new char*[argc];
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL);
|
||||
if (len < 1) return NULL;
|
||||
argv[i] = new char[len];
|
||||
int res = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, argv[i], len, NULL, NULL);
|
||||
if (res != len) { delete[] argv[i]; argv[i] = nullarg; }
|
||||
}
|
||||
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int ret = main(argc, argv);
|
||||
|
||||
printf("\n\n>");
|
||||
|
||||
for (int i = 0; i < argc; i++) if (argv[i] != nullarg) delete[] argv[i];
|
||||
delete[] argv;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,13 +22,12 @@ option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static
|
|||
set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(libui)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
include_directories(${SDL2_INCLUDE_DIR})
|
||||
#string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
|
||||
add_executable(melonDS ${SOURCES_LIBUI})
|
||||
target_link_libraries(melonDS
|
||||
core ${SDL2_LIBRARIES} libui)
|
||||
target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(melonDS core libui ${SDL2_LIBRARIES})
|
||||
|
||||
if (UNIX)
|
||||
option(UNIX_PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
|
||||
|
@ -38,12 +37,9 @@ if (UNIX)
|
|||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
|
||||
target_include_directories(melonDS
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(melonDS ${GTK3_LIBRARIES} ${SDL2_LIBRARIES})
|
||||
target_include_directories(melonDS PRIVATE ${GTK3_INCLUDE_DIRS})
|
||||
target_link_libraries(melonDS ${GTK3_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
|
||||
|
||||
|
@ -63,7 +59,7 @@ if (UNIX)
|
|||
elseif (WIN32)
|
||||
target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
|
||||
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi)
|
||||
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
|
||||
endif ()
|
||||
|
||||
install(FILES ../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
||||
|
|
|
@ -2678,7 +2678,7 @@ void RecreateMainWindow(bool opengl)
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int ___main(int argc, char** argv)
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
|
@ -3026,41 +3026,4 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdshow)
|
||||
{
|
||||
int argc = 0;
|
||||
wchar_t** argv_w = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
char* nullarg = "";
|
||||
|
||||
char** argv = new char*[argc];
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL);
|
||||
if (len < 1) return NULL;
|
||||
argv[i] = new char[len];
|
||||
int res = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, argv[i], len, NULL, NULL);
|
||||
if (res != len) { delete[] argv[i]; argv[i] = nullarg; }
|
||||
}
|
||||
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int ret = main(argc, argv);
|
||||
|
||||
printf("\n\n>");
|
||||
|
||||
for (int i = 0; i < argc; i++) if (argv[i] != nullarg) delete[] argv[i];
|
||||
delete[] argv;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue