2013-12-07 06:57:16 +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. *
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XENIA_CPU_XEX_MODULE_H_
|
|
|
|
#define XENIA_CPU_XEX_MODULE_H_
|
|
|
|
|
2014-07-14 04:15:37 +00:00
|
|
|
#include <string>
|
|
|
|
|
2013-12-07 06:57:16 +00:00
|
|
|
#include <alloy/runtime/module.h>
|
2014-12-20 06:04:57 +00:00
|
|
|
#include <xenia/common.h>
|
2014-01-05 01:12:46 +00:00
|
|
|
#include <xenia/kernel/util/xex2.h>
|
2013-12-07 06:57:16 +00:00
|
|
|
|
|
|
|
namespace xe {
|
|
|
|
namespace cpu {
|
|
|
|
|
|
|
|
class XenonRuntime;
|
|
|
|
|
|
|
|
class XexModule : public alloy::runtime::Module {
|
|
|
|
public:
|
|
|
|
XexModule(XenonRuntime* runtime);
|
|
|
|
virtual ~XexModule();
|
|
|
|
|
2013-12-25 01:25:29 +00:00
|
|
|
xe_xex2_ref xex() const { return xex_; }
|
|
|
|
|
2014-07-14 04:15:37 +00:00
|
|
|
int Load(const std::string& name, const std::string& path, xe_xex2_ref xex);
|
2013-12-07 06:57:16 +00:00
|
|
|
|
2014-07-14 04:15:37 +00:00
|
|
|
const std::string& name() const override { return name_; }
|
2013-12-07 06:57:16 +00:00
|
|
|
|
2014-07-14 04:15:37 +00:00
|
|
|
bool ContainsAddress(uint64_t address) override;
|
2013-12-07 06:57:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
int SetupImports(xe_xex2_ref xex);
|
|
|
|
int SetupLibraryImports(const xe_xex2_import_library_t* library);
|
|
|
|
int FindSaveRest();
|
|
|
|
|
|
|
|
private:
|
|
|
|
XenonRuntime* runtime_;
|
2014-07-14 04:15:37 +00:00
|
|
|
std::string name_;
|
|
|
|
std::string path_;
|
|
|
|
xe_xex2_ref xex_;
|
2013-12-07 06:57:16 +00:00
|
|
|
|
2014-07-14 04:15:37 +00:00
|
|
|
uint64_t base_address_;
|
|
|
|
uint64_t low_address_;
|
|
|
|
uint64_t high_address_;
|
2013-12-07 06:57:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace cpu
|
|
|
|
} // namespace xe
|
|
|
|
|
|
|
|
#endif // XENIA_CPU_XEX_MODULE_H_
|