From 7ae303dfa29d3d63b1ce7f7cf3a8beebfd5478a8 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 21 Aug 2014 22:46:12 -0700 Subject: [PATCH] alloy-sandbox running on osx (ivm only). --- docs/building.md | 11 +++++++++++ src/alloy/runtime/raw_module.cc | 12 +++++++----- src/alloy/runtime/raw_module.h | 2 +- tools/alloy-sandbox/alloy-sandbox.cc | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/building.md b/docs/building.md index 6e797a74e..eaeec0100 100644 --- a/docs/building.md +++ b/docs/building.md @@ -22,6 +22,17 @@ 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`). +### OSX + +* Mac OSX 10.9+ +* Xcode 5.1+ + +#### Debugging + +Choose `Product > Scheme > Edit Scheme`. For xenia-run, alloy-sandbox, and the +other executables select the Run action on the left and set +`Options > Working Directory` to your root xenia/ git path. + ## xenia-build A simple build script is included to manage basic tasks such as building diff --git a/src/alloy/runtime/raw_module.cc b/src/alloy/runtime/raw_module.cc index 86eda6c2e..2750a724e 100644 --- a/src/alloy/runtime/raw_module.cc +++ b/src/alloy/runtime/raw_module.cc @@ -10,6 +10,7 @@ #include #include +#include namespace alloy { namespace runtime { @@ -19,8 +20,9 @@ RawModule::RawModule(Runtime* runtime) RawModule::~RawModule() {} -int RawModule::LoadFile(uint64_t base_address, const std::string& path) { - FILE* file = fopen(path.c_str(), "rb"); +int RawModule::LoadFile(uint64_t base_address, const std::wstring& path) { + auto fixed_path = poly::to_string(poly::fix_path_separators(path)); + FILE* file = fopen(fixed_path.c_str(), "rb"); fseek(file, 0, SEEK_END); size_t file_length = ftell(file); fseek(file, 0, SEEK_SET); @@ -37,11 +39,11 @@ int RawModule::LoadFile(uint64_t base_address, const std::string& path) { fclose(file); // Setup debug info. - auto last_slash = path.find_last_of(poly::path_separator); + auto last_slash = fixed_path.find_last_of(poly::path_separator); if (last_slash != std::string::npos) { - name_ = path.substr(last_slash + 1); + name_ = fixed_path.substr(last_slash + 1); } else { - name_ = path; + name_ = fixed_path; } // TODO(benvanik): debug info diff --git a/src/alloy/runtime/raw_module.h b/src/alloy/runtime/raw_module.h index 37723119b..c40359f1e 100644 --- a/src/alloy/runtime/raw_module.h +++ b/src/alloy/runtime/raw_module.h @@ -22,7 +22,7 @@ class RawModule : public Module { RawModule(Runtime* runtime); ~RawModule() override; - int LoadFile(uint64_t base_address, const std::string& path); + int LoadFile(uint64_t base_address, const std::wstring& path); const std::string& name() const override { return name_; } diff --git a/tools/alloy-sandbox/alloy-sandbox.cc b/tools/alloy-sandbox/alloy-sandbox.cc index e09030db1..69ffa4d0a 100644 --- a/tools/alloy-sandbox/alloy-sandbox.cc +++ b/tools/alloy-sandbox/alloy-sandbox.cc @@ -94,7 +94,7 @@ int main(std::vector& args) { runtime->Initialize(std::move(frontend), std::move(backend)); auto module = std::make_unique(runtime.get()); - module->LoadFile(0x00001000, "test\\codegen\\instr_add.bin"); + module->LoadFile(0x00001000, L"test\\codegen\\instr_add.bin"); runtime->AddModule(std::move(module)); {