diff --git a/README.md b/README.md index 8c5dfef97..7e8ffafec 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Xenia - Xbox 360 Emulator Research Project Xenia is an experimental emulator for the Xbox 360. It does not run games (yet), and if you are unable to understand that please leave now. -Come chat with us in #xenia on freenode. +Come chat with us in [#xenia @ irc.freenode.net](http://webchat.freenode.net?channels=%23xenia&uio=MTE9NzIaa). Currently supported features: @@ -24,35 +24,29 @@ legally purchased devices and games and information made public on the internet ## Quickstart +Windows: + + # install python 2.7 and VS2010/2012/2013 + git clone https://github.com/benvanik/xenia.git + cd xenia + xb setup + # open build\xenia\xenia.sln and start xenia-run + +Linux/OSX: + + # install clang/xcode/etc git clone https://github.com/benvanik/xenia.git cd xenia && source xeniarc xb setup xb build ./bin/xenia-run some.xex +When fetching updates use `xb pull` to automatically fetch everything and +update gyp files/etc. + ## Building See [building](docs/building.md) for setup and information about the `xenia-build` script. ## Known Issues - -### asmjit bug - -asmjit has an issue with removing unreachable code that will cause assertion -failures/exiting when running. Until it is patched you must go and modify -a file after checking out the project. - -``` ---- a/third_party/asmjit/src/asmjit/x86/x86compileritem.cpp -+++ b/third_party/asmjit/src/asmjit/x86/x86compileritem.cpp -@@ -114,7 +114,7 @@ CompilerItem* X86CompilerTarget::translate(CompilerContext& cc) - return NULL; - } - -- if (x86Context._isUnreachable) -+ if (0)//x86Context._isUnreachable) - { - // If the context has "isUnreachable" flag set and there is no state then - // it means that this code will be never called. This is a problem, because -``` diff --git a/docs/building.md b/docs/building.md index 208a57366..6aff43c78 100644 --- a/docs/building.md +++ b/docs/building.md @@ -6,6 +6,30 @@ video drivers for your card. ## Setup +### Windows + +* [Python 2.7](http://www.python.org/download/releases/2.7.5/) + +Install and add Python to your PATH (`C:\Python27\`). + +#### Visual Studio 2013 + +Should work out of the box - just load the sln. + +#### Visual Studio 2012 (Express) + +Basic testing has been done with 2012 Express (all I have access to). + +* [Windows 8 SDK](http://msdn.microsoft.com/en-us/windows/desktop/aa904949.aspx) +* [Visual Studio 2012 Express for Desktop](http://go.microsoft.com/?linkid=9816758) + +#### Debugging + +VS behaves oddly with the debug paths. Open the xenia-run project properties +and set the 'Command' to `$(SolutionDir)$(TargetPath)` and the +'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and +the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`). + ### OS X Only tested on OS X 10.8 (Mountain Lion). @@ -23,27 +47,6 @@ Only tested on Ubuntu 12.10. Pretty much just install what's asked for as you try to `xb setup` or `xb build`. -### Windows - -* [Python 2.7](http://www.python.org/download/releases/2.7.3/) - -Install both and add Python to your PATH (`C:\Python27\`). -Depending on your Visual Studio version you'll need to use one of the provided -command prompts (until I write my own) to perform all `xenia-build` tasks. - -#### Visual Studio 2012 (Express) - -Basic testing has been done with 2012 Express (all I have access to). -Use the `VS2012 x64 Cross Tools Command Prompt` as your shell. - -* [Windows 8 SDK](http://msdn.microsoft.com/en-us/windows/desktop/aa904949.aspx) -* [Visual Studio 2012 Express for Desktop](http://go.microsoft.com/?linkid=9816758) - -VS2012 behaves oddly with the debug paths. Open the xenia-run project properties -and set the 'Command' to `$(ProjectDir)$(OutputPath)$(TargetFileName)` and the -'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and -the file to run in the 'Command Arguments' field. - ## xenia-build A simple build script is included to manage basic tasks such as building @@ -51,7 +54,11 @@ dependencies. ./xenia-build.py --help -The `xeniarc` bash file has some aliases that save some keypresses. +On Windows the `xb.bat` file enables you to issue all commands by just typing +`xb`. Note that you should run everything from the root `xenia\` folder. + +On Linux/OSX the `xeniarc` bash file has some aliases that save some +keypresses: source xeniarc xb -> python xenia-build.py @@ -110,6 +117,9 @@ Use the wrapper shell scripts under `bin/` to run tools. They will ensure the tools are built (but not that they are up to date) before running and allow switching between the debug and release variants with `--debug`. +To make life easier you can use `--flagfile=myflags.txt` to specify all +arguments, including using `--target=my.xex` to pick an executable. + ### xenia-info Dumps information about a xex file. diff --git a/src/xenia/gpu/d3d11/d3d11_shader.cc b/src/xenia/gpu/d3d11/d3d11_shader.cc index 2aa36027e..5437b0b31 100644 --- a/src/xenia/gpu/d3d11/d3d11_shader.cc +++ b/src/xenia/gpu/d3d11/d3d11_shader.cc @@ -11,7 +11,7 @@ #include -#include +#include using namespace xe; @@ -97,7 +97,7 @@ ID3D10Blob* D3D11Shader::Compile(const char* shader_source) { // Compile shader to bytecode blob. ID3D10Blob* shader_blob = 0; ID3D10Blob* error_blob = 0; - HRESULT hr = D3DX11CompileFromMemory( + HRESULT hr = D3DCompile( shader_source, strlen(shader_source), file_name, defines, NULL, @@ -105,8 +105,7 @@ ID3D10Blob* D3D11Shader::Compile(const char* shader_source) { type_ == XE_GPU_SHADER_TYPE_VERTEX ? "vs_5_0" : "ps_5_0", flags1, flags2, - NULL, - &shader_blob, &error_blob, NULL); + &shader_blob, &error_blob); if (error_blob) { char* msg = (char*)error_blob->GetBufferPointer(); XELOGE("D3D11: shader compile failed with %s", msg); diff --git a/third_party/gflags.gypi b/third_party/gflags.gypi index a5984c2ff..202d2f1e3 100644 --- a/third_party/gflags.gypi +++ b/third_party/gflags.gypi @@ -47,6 +47,7 @@ 'gflags/src/windows/port.cc', ], 'defines': [ + 'PATH_SEPARATOR=\'\\\\\'', 'GFLAGS_DLL_DECL=', 'GFLAGS_DLL_DEFINE_FLAG=', 'GFLAGS_DLL_DECLARE_FLAG=', diff --git a/third_party/gyp b/third_party/gyp index 12d97efcb..96c481840 160000 --- a/third_party/gyp +++ b/third_party/gyp @@ -1 +1 @@ -Subproject commit 12d97efcb0d2cbe321ab6f050c2b2311e7048429 +Subproject commit 96c481840d532630a2828132a6e8f16a01504a53 diff --git a/xb.bat b/xb.bat new file mode 100644 index 000000000..30f587349 --- /dev/null +++ b/xb.bat @@ -0,0 +1,6 @@ +@ECHO OFF +REM Copyright 2013 Ben Vanik. All Rights Reserved. + +SET DIR=%~dp0 + +python xenia-build.py %* diff --git a/xenia-build.py b/xenia-build.py index b726fcbc1..2c51f7e81 100755 --- a/xenia-build.py +++ b/xenia-build.py @@ -9,6 +9,7 @@ __author__ = 'ben.vanik@gmail.com (Ben Vanik)' import os +import re import shutil import subprocess import sys @@ -31,6 +32,15 @@ def main(): sys.exit(1) return + # Grab Visual Studio version and execute shell to set up environment. + if sys.platform == 'win32': + vs_version = import_vs_environment() + if not vs_version: + print('ERROR: Visual Studio not found!') + print('Ensure you have a VS1XXCOMNTOOLS environment variable!') + sys.exit(1) + return + # Grab all commands. commands = discover_commands() @@ -56,6 +66,57 @@ def main(): sys.exit(return_code) +def import_vs_environment(): + """Finds the installed Visual Studio version and imports + interesting environment variables into os.environ. + + Returns: + A version such as 2010, 2012, or 2013 or None if no VS is found. + """ + version = 0 + tools_path = '' + if 'VS120COMNTOOLS' in os.environ: + version = 2013 + tools_path = os.environ['VS120COMNTOOLS'] + elif 'VS110COMNTOOLS' in os.environ: + version = 2012 + tools_path = os.environ['VS110COMNTOOLS'] + elif 'VS100COMNTOOLS' in os.environ: + version = 2010 + tools_path = os.environ['VS100COMNTOOLS'] + if version == 0: + return None + tools_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat') + + args = [tools_path, '&&', 'set'] + popen = subprocess.Popen( + args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + variables, _ = popen.communicate() + envvars_to_save = ( + 'devenvdir', + 'include', + 'lib', + 'libpath', + 'path', + 'pathext', + 'systemroot', + 'temp', + 'tmp', + 'windowssdkdir', + ) + for line in variables.splitlines(): + for envvar in envvars_to_save: + if re.match(envvar + '=', line.lower()): + var, setting = line.split('=', 1) + if envvar == 'path': + setting = os.path.dirname(sys.executable) + os.pathsep + setting + os.environ[var.upper()] = setting + break + + os.environ['VSVERSION'] = str(version) + return version + + def discover_commands(): """Looks for all commands and returns a dictionary of them. In the future commands could be discovered on disk. @@ -298,13 +359,15 @@ def run_gyp(format): 'gyp', '--include=common.gypi', '-f %s' % (format), - # Set the VS version. - # TODO(benvanik): allow user to set? - '-G msvs_version=2010', # Removes the out/ from ninja builds. '-G output_dir=.', '--depth=.', + '--toplevel-dir=.', '--generator-output=build/xenia/', + # Set the VS version. + '-G msvs_version=%s' % (os.environ['VSVERSION'] or 2013), + #'-D windows_sdk_dir=%s' % (os.environ['WINDOWSSDKDIR']), + '-D windows_sdk_dir="C:\\Program Files (x86)\\Windows Kits\\8.1"', 'xenia.gyp', ])) diff --git a/xenia.gyp b/xenia.gyp index 66e55cd8e..aa4702fda 100644 --- a/xenia.gyp +++ b/xenia.gyp @@ -39,10 +39,13 @@ 'conditions': [ ['OS == "win"', { 'libraries': [ + 'kernel32', + 'user32', + 'ole32', 'wsock32', 'dxgi', 'd3d11', - 'd3dx11', + 'd3dcompiler', ], }], ['OS == "mac"', { @@ -61,6 +64,20 @@ }], ], }, + 'conditions': [ + ['OS == "win"', { + 'copies': [ + { + 'files': [ + # Depending on which SDK you have... + '<(windows_sdk_dir)/redist/d3d/x64/d3dcompiler_46.dll', + '<(windows_sdk_dir)/redist/d3d/x64/d3dcompiler_47.dll', + ], + 'destination': '<(PRODUCT_DIR)', + }, + ], + }], + ], 'cflags': [ ],