2013-01-11 09:23:08 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
******************************************************************************
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <xenia/xenia.h>
|
|
|
|
|
2013-01-13 07:25:41 +00:00
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
using namespace xe;
|
|
|
|
using namespace xe::cpu;
|
|
|
|
using namespace xe::kernel;
|
|
|
|
|
|
|
|
|
2013-01-13 07:25:41 +00:00
|
|
|
int xenia_info(int argc, xechar_t **argv) {
|
|
|
|
int result_code = 1;
|
|
|
|
|
|
|
|
xe_pal_ref pal = NULL;
|
|
|
|
xe_memory_ref memory = NULL;
|
2013-01-20 09:13:59 +00:00
|
|
|
shared_ptr<Processor> processor;
|
|
|
|
shared_ptr<Runtime> runtime;
|
2013-01-13 07:25:41 +00:00
|
|
|
|
|
|
|
// TODO(benvanik): real command line parsing.
|
|
|
|
if (argc < 2) {
|
|
|
|
printf("usage: xenia-info some.xex\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
const xechar_t *path = argv[1];
|
|
|
|
|
|
|
|
xe_pal_options_t pal_options;
|
2013-01-13 08:34:08 +00:00
|
|
|
xe_zero_struct(&pal_options, sizeof(pal_options));
|
2013-01-13 07:25:41 +00:00
|
|
|
pal = xe_pal_create(pal_options);
|
|
|
|
XEEXPECTNOTNULL(pal);
|
|
|
|
|
|
|
|
xe_memory_options_t memory_options;
|
2013-01-13 08:34:08 +00:00
|
|
|
xe_zero_struct(&memory_options, sizeof(memory_options));
|
2013-01-13 07:25:41 +00:00
|
|
|
memory = xe_memory_create(pal, memory_options);
|
|
|
|
XEEXPECTNOTNULL(memory);
|
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
processor = shared_ptr<Processor>(new Processor(pal, memory));
|
|
|
|
XEEXPECTZERO(processor->Setup());
|
2013-01-13 07:25:41 +00:00
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
runtime = shared_ptr<Runtime>(new Runtime(pal, processor, XT("")));
|
2013-01-13 07:25:41 +00:00
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
XEEXPECTZERO(runtime->LoadModule(path));
|
2013-01-13 07:25:41 +00:00
|
|
|
|
|
|
|
result_code = 0;
|
|
|
|
XECLEANUP:
|
|
|
|
xe_memory_release(memory);
|
|
|
|
xe_pal_release(pal);
|
|
|
|
return result_code;
|
2013-01-11 09:23:08 +00:00
|
|
|
}
|
2013-01-13 07:25:41 +00:00
|
|
|
XE_MAIN_THUNK(xenia_info);
|