- Move main, wWinMain entrypoints to their own file.
- Fix startup AVX checks.
This commit is contained in:
parent
a296e17f06
commit
4030cff3ec
|
@ -50,18 +50,20 @@ project("xenia-app")
|
||||||
files({
|
files({
|
||||||
"xenia_main.cc",
|
"xenia_main.cc",
|
||||||
"../base/main_"..platform_suffix..".cc",
|
"../base/main_"..platform_suffix..".cc",
|
||||||
|
"../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
|
|
||||||
filter("files:xenia_main.cc or ../base/main_"..platform_suffix..".cc")
|
resincludedirs({
|
||||||
vectorextensions("IA32") -- Disable AVX for main_win.cc so our AVX check/error can happen.
|
project_root,
|
||||||
|
})
|
||||||
|
|
||||||
filter("platforms:Windows")
|
filter("platforms:Windows")
|
||||||
files({
|
files({
|
||||||
"main_resources.rc",
|
"main_resources.rc",
|
||||||
})
|
})
|
||||||
resincludedirs({
|
|
||||||
project_root,
|
filter("files:../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
})
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux")
|
||||||
links({
|
links({
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xenia/base/main.h"
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
|
#include "xenia/base/logging.h"
|
||||||
|
#include "xenia/base/string.h"
|
||||||
|
|
||||||
|
extern "C" int main(int argc, char** argv) {
|
||||||
|
auto entry_info = xe::GetEntryInfo();
|
||||||
|
|
||||||
|
google::SetUsageMessage(std::string("usage: ") +
|
||||||
|
xe::to_string(entry_info.usage));
|
||||||
|
google::SetVersionString("1.0");
|
||||||
|
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
|
||||||
|
std::vector<std::wstring> args;
|
||||||
|
for (int n = 0; n < argc; n++) {
|
||||||
|
args.push_back(xe::to_wstring(argv[n]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize logging. Needs parsed FLAGS.
|
||||||
|
xe::InitializeLogging(entry_info.name);
|
||||||
|
|
||||||
|
// Call app-provided entry point.
|
||||||
|
int result = entry_info.entry_point(args);
|
||||||
|
|
||||||
|
google::ShutDownCommandLineFlags();
|
||||||
|
return result;
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xenia/base/main.h"
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
// Autogenerated by `xb premake`.
|
||||||
|
#include "build/version.h"
|
||||||
|
|
||||||
|
#include "xenia/base/platform_win.h"
|
||||||
|
#include "xenia/base/string.h"
|
||||||
|
|
||||||
|
#include "third_party/xbyak/xbyak/xbyak_util.h"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
void AttachConsole();
|
||||||
|
int Main();
|
||||||
|
}; // namespace xe
|
||||||
|
|
||||||
|
// Used in console mode apps; automatically picked based on subsystem.
|
||||||
|
int main(int, char**) {
|
||||||
|
Xbyak::util::Cpu cpu;
|
||||||
|
if (!cpu.has(Xbyak::util::Cpu::tAVX)) {
|
||||||
|
printf(
|
||||||
|
"Your CPU does not support AVX, which is required by Xenia.\r\nSee the "
|
||||||
|
"FAQ for system requirements at https://xenia.jp\r\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return xe::Main();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used in windowed apps; automatically picked based on subsystem.
|
||||||
|
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) {
|
||||||
|
Xbyak::util::Cpu cpu;
|
||||||
|
if (!cpu.has(Xbyak::util::Cpu::tAVX)) {
|
||||||
|
MessageBoxA(
|
||||||
|
NULL,
|
||||||
|
"Your CPU does not support AVX, which is required by Xenia. See the "
|
||||||
|
"FAQ for system requirements at https://xenia.jp",
|
||||||
|
"Xenia Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach a console so we can write output to stdout. If the user hasn't
|
||||||
|
// redirected output themselves it'll pop up a window.
|
||||||
|
xe::AttachConsole();
|
||||||
|
|
||||||
|
// Run normal entry point.
|
||||||
|
return xe::Main();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined _M_IX86
|
||||||
|
#pragma comment( \
|
||||||
|
linker, \
|
||||||
|
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||||
|
#elif defined _M_IA64
|
||||||
|
#pragma comment( \
|
||||||
|
linker, \
|
||||||
|
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||||
|
#elif defined _M_X64
|
||||||
|
#pragma comment( \
|
||||||
|
linker, \
|
||||||
|
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||||
|
#else
|
||||||
|
#pragma comment( \
|
||||||
|
linker, \
|
||||||
|
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||||
|
#endif
|
|
@ -19,26 +19,3 @@ namespace xe {
|
||||||
bool has_console_attached() { return true; }
|
bool has_console_attached() { return true; }
|
||||||
|
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
extern "C" int main(int argc, char** argv) {
|
|
||||||
auto entry_info = xe::GetEntryInfo();
|
|
||||||
|
|
||||||
google::SetUsageMessage(std::string("usage: ") +
|
|
||||||
xe::to_string(entry_info.usage));
|
|
||||||
google::SetVersionString("1.0");
|
|
||||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
|
||||||
|
|
||||||
std::vector<std::wstring> args;
|
|
||||||
for (int n = 0; n < argc; n++) {
|
|
||||||
args.push_back(xe::to_wstring(argv[n]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize logging. Needs parsed FLAGS.
|
|
||||||
xe::InitializeLogging(entry_info.name);
|
|
||||||
|
|
||||||
// Call app-provided entry point.
|
|
||||||
int result = entry_info.entry_point(args);
|
|
||||||
|
|
||||||
google::ShutDownCommandLineFlags();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
|
@ -129,14 +129,6 @@ int Main() {
|
||||||
// Initialize logging. Needs parsed FLAGS.
|
// Initialize logging. Needs parsed FLAGS.
|
||||||
xe::InitializeLogging(entry_info.name);
|
xe::InitializeLogging(entry_info.name);
|
||||||
|
|
||||||
Xbyak::util::Cpu cpu;
|
|
||||||
if (!cpu.has(Xbyak::util::Cpu::tAVX)) {
|
|
||||||
xe::FatalError(
|
|
||||||
"Your CPU does not support AVX, which is required by Xenia. See the "
|
|
||||||
"FAQ for system requirements at https://xenia.jp");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print version info.
|
// Print version info.
|
||||||
XELOGI("Build: %s / %s on %s", XE_BUILD_BRANCH, XE_BUILD_COMMIT,
|
XELOGI("Build: %s / %s on %s", XE_BUILD_BRANCH, XE_BUILD_COMMIT,
|
||||||
XE_BUILD_DATE);
|
XE_BUILD_DATE);
|
||||||
|
@ -156,34 +148,3 @@ int Main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
// Used in console mode apps; automatically picked based on subsystem.
|
|
||||||
int main(int argc_ignored, char** argv_ignored) { return xe::Main(); }
|
|
||||||
|
|
||||||
// Used in windowed apps; automatically picked based on subsystem.
|
|
||||||
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR command_line, int) {
|
|
||||||
// Attach a console so we can write output to stdout. If the user hasn't
|
|
||||||
// redirected output themselves it'll pop up a window.
|
|
||||||
xe::AttachConsole();
|
|
||||||
|
|
||||||
// Run normal entry point.
|
|
||||||
return xe::Main();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined _M_IX86
|
|
||||||
#pragma comment( \
|
|
||||||
linker, \
|
|
||||||
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
|
||||||
#elif defined _M_IA64
|
|
||||||
#pragma comment( \
|
|
||||||
linker, \
|
|
||||||
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
|
||||||
#elif defined _M_X64
|
|
||||||
#pragma comment( \
|
|
||||||
linker, \
|
|
||||||
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
|
||||||
#else
|
|
||||||
#pragma comment( \
|
|
||||||
linker, \
|
|
||||||
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ project("xenia-cpu-ppc-tests")
|
||||||
files({
|
files({
|
||||||
"ppc_testing_main.cc",
|
"ppc_testing_main.cc",
|
||||||
"../../../base/main_"..platform_suffix..".cc",
|
"../../../base/main_"..platform_suffix..".cc",
|
||||||
|
"../../../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"*.s",
|
"*.s",
|
||||||
|
@ -25,8 +26,11 @@ project("xenia-cpu-ppc-tests")
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
|
|
||||||
filter("files:*.s")
|
filter("files:*.s")
|
||||||
flags({"ExcludeFromBuild"})
|
flags({"ExcludeFromBuild"})
|
||||||
|
filter("files:../../../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
filter("platforms:Windows")
|
filter("platforms:Windows")
|
||||||
debugdir(project_root)
|
debugdir(project_root)
|
||||||
debugargs({
|
debugargs({
|
||||||
|
@ -51,14 +55,12 @@ project("xenia-cpu-ppc-nativetests")
|
||||||
files({
|
files({
|
||||||
"ppc_testing_native_main.cc",
|
"ppc_testing_native_main.cc",
|
||||||
"../../../base/main_"..platform_suffix..".cc",
|
"../../../base/main_"..platform_suffix..".cc",
|
||||||
|
"../../../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
files({
|
files({
|
||||||
"instr_*.s",
|
"instr_*.s",
|
||||||
"seq_*.s",
|
"seq_*.s",
|
||||||
})
|
})
|
||||||
filter("files:instr_*.s", "files:seq_*.s")
|
|
||||||
flags({"ExcludeFromBuild"})
|
|
||||||
filter({})
|
|
||||||
includedirs({
|
includedirs({
|
||||||
project_root.."/third_party/gflags/src",
|
project_root.."/third_party/gflags/src",
|
||||||
})
|
})
|
||||||
|
@ -70,4 +72,9 @@ project("xenia-cpu-ppc-nativetests")
|
||||||
"ppc_testing_native_thunks.s",
|
"ppc_testing_native_thunks.s",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:instr_*.s", "files:seq_*.s")
|
||||||
|
flags({"ExcludeFromBuild"})
|
||||||
|
filter("files:../../../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
end
|
end
|
|
@ -46,8 +46,12 @@ project("xenia-gpu-shader-compiler")
|
||||||
files({
|
files({
|
||||||
"shader_compiler_main.cc",
|
"shader_compiler_main.cc",
|
||||||
"../base/main_"..platform_suffix..".cc",
|
"../base/main_"..platform_suffix..".cc",
|
||||||
|
"../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Windows")
|
filter("platforms:Windows")
|
||||||
-- Only create the .user file if it doesn't already exist.
|
-- Only create the .user file if it doesn't already exist.
|
||||||
local user_file = project_root.."/build/xenia-gpu-shader-compiler.vcxproj.user"
|
local user_file = project_root.."/build/xenia-gpu-shader-compiler.vcxproj.user"
|
||||||
|
|
|
@ -68,8 +68,12 @@ project("xenia-gpu-vulkan-trace-viewer")
|
||||||
files({
|
files({
|
||||||
"vulkan_trace_viewer_main.cc",
|
"vulkan_trace_viewer_main.cc",
|
||||||
"../../base/main_"..platform_suffix..".cc",
|
"../../base/main_"..platform_suffix..".cc",
|
||||||
|
"../../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:../../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux")
|
||||||
links({
|
links({
|
||||||
"X11",
|
"X11",
|
||||||
|
@ -139,8 +143,12 @@ project("xenia-gpu-vulkan-trace-dump")
|
||||||
files({
|
files({
|
||||||
"vulkan_trace_dump_main.cc",
|
"vulkan_trace_dump_main.cc",
|
||||||
"../../base/main_"..platform_suffix..".cc",
|
"../../base/main_"..platform_suffix..".cc",
|
||||||
|
"../../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:../../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux")
|
||||||
links({
|
links({
|
||||||
"X11",
|
"X11",
|
||||||
|
|
|
@ -43,11 +43,15 @@ project("xenia-hid-demo")
|
||||||
files({
|
files({
|
||||||
"hid_demo.cc",
|
"hid_demo.cc",
|
||||||
"../base/main_"..platform_suffix..".cc",
|
"../base/main_"..platform_suffix..".cc",
|
||||||
|
"../base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
resincludedirs({
|
resincludedirs({
|
||||||
project_root,
|
project_root,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:../base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux")
|
||||||
links({
|
links({
|
||||||
"X11",
|
"X11",
|
||||||
|
|
|
@ -47,11 +47,15 @@ project("xenia-ui-window-vulkan-demo")
|
||||||
"../window_demo.cc",
|
"../window_demo.cc",
|
||||||
"vulkan_window_demo.cc",
|
"vulkan_window_demo.cc",
|
||||||
project_root.."/src/xenia/base/main_"..platform_suffix..".cc",
|
project_root.."/src/xenia/base/main_"..platform_suffix..".cc",
|
||||||
|
project_root.."/src/xenia/base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
resincludedirs({
|
resincludedirs({
|
||||||
project_root,
|
project_root,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:"..project_root.."/src/xenia/base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux")
|
||||||
links({
|
links({
|
||||||
"X11",
|
"X11",
|
||||||
|
|
|
@ -34,8 +34,11 @@ project("xenia-vfs-dump")
|
||||||
files({
|
files({
|
||||||
"vfs_dump.cc",
|
"vfs_dump.cc",
|
||||||
project_root.."/src/xenia/base/main_"..platform_suffix..".cc",
|
project_root.."/src/xenia/base/main_"..platform_suffix..".cc",
|
||||||
|
project_root.."/src/xenia/base/main_entrypoint_"..platform_suffix..".cc",
|
||||||
})
|
})
|
||||||
resincludedirs({
|
resincludedirs({
|
||||||
project_root,
|
project_root,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
filter("files:"..project_root.."/src/xenia/base/main_entrypoint_"..platform_suffix..".cc")
|
||||||
|
vectorextensions("IA32") -- Disable AVX so our AVX check/error can happen.
|
||||||
|
|
Loading…
Reference in New Issue