Fixing compile warnings.

This commit is contained in:
Ben Vanik 2015-05-05 18:52:37 -07:00
parent 3f1131c65f
commit b07d5b8ed3
7 changed files with 30 additions and 30 deletions

View File

@ -28,15 +28,15 @@ XKernelModule::XKernelModule(KernelState* kernel_state, const char* path)
XKernelModule::~XKernelModule() {}
void* XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
uint32_t XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
// TODO(benvanik): check export tables.
XELOGE("GetProcAddressByOrdinal not implemented");
return NULL;
return 0;
}
void* XKernelModule::GetProcAddressByName(const char* name) {
uint32_t XKernelModule::GetProcAddressByName(const char* name) {
XELOGE("GetProcAddressByName not implemented");
return NULL;
return 0;
}
} // namespace kernel

View File

@ -21,10 +21,10 @@ class KernelState;
class XKernelModule : public XModule {
public:
XKernelModule(KernelState* kernel_state, const char* path);
virtual ~XKernelModule();
~XKernelModule() override;
virtual void* GetProcAddressByOrdinal(uint16_t ordinal);
virtual void* GetProcAddressByName(const char* name);
uint32_t GetProcAddressByOrdinal(uint16_t ordinal) override;
uint32_t GetProcAddressByName(const char* name) override;
protected:
Emulator* emulator_;

View File

@ -26,8 +26,8 @@ class XModule : public XObject {
const std::string& path() const { return path_; }
const std::string& name() const { return name_; }
virtual void* GetProcAddressByOrdinal(uint16_t ordinal) = 0;
virtual void* GetProcAddressByName(const char* name) = 0;
virtual uint32_t GetProcAddressByOrdinal(uint16_t ordinal) = 0;
virtual uint32_t GetProcAddressByName(const char* name) = 0;
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
uint32_t* out_section_size);

View File

@ -142,23 +142,25 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
return X_STATUS_SUCCESS;
}
void* XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
PEExport export;
int ret = xe_xex2_lookup_export(xex_, ordinal, export);
if (ret) {
XELOGE("XUserModule::GetProcAddressByOrdinal(%d) not found", ordinal);
return 0;
}
if (ret) return nullptr;
return (void*)export.addr;
return uint32_t(export.addr);
}
void* XUserModule::GetProcAddressByName(const char* name) {
uint32_t XUserModule::GetProcAddressByName(const char* name) {
PEExport export;
int ret = xe_xex2_lookup_export(xex_, name, export);
// Failure.
if (ret) return nullptr;
return (void*)export.addr;
if (ret) {
XELOGE("XUserModule::GetProcAddressByName(%s) not found", name);
return 0;
}
return uint32_t(export.addr);
}
X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,

View File

@ -22,7 +22,7 @@ namespace kernel {
class XUserModule : public XModule {
public:
XUserModule(KernelState* kernel_state, const char* path);
virtual ~XUserModule();
~XUserModule() override;
xe_xex2_ref xex();
const xe_xex2_header_t* xex_header();
@ -32,18 +32,16 @@ class XUserModule : public XModule {
X_STATUS LoadFromFile(const char* path);
X_STATUS LoadFromMemory(const void* addr, const size_t length);
virtual void* GetProcAddressByOrdinal(uint16_t ordinal);
virtual void* GetProcAddressByName(const char* name);
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
uint32_t* out_section_size);
uint32_t GetProcAddressByOrdinal(uint16_t ordinal) override;
uint32_t GetProcAddressByName(const char* name) override;
X_STATUS GetSection(const char* name, uint32_t* out_section_data,
uint32_t* out_section_size) override;
X_STATUS Launch(uint32_t flags);
void Dump();
private:
int LoadPE();
xe_xex2_ref xex_;
uint32_t execution_info_ptr_;
};

View File

@ -1016,7 +1016,7 @@ int xe_xex2_lookup_export(xe_xex2_ref xex, const char *name,
const char *mod_name = (const char *)((uint64_t)e + e->Name);
for (int i = 0; i < e->NumberOfNames; i++) {
for (uint32_t i = 0; i < e->NumberOfNames; i++) {
const char *fn_name = (const char *)((uint64_t)e + name_table[i]);
uint16_t ordinal = ordinal_table[i];
uint64_t addr = (uint64_t)(baseaddr + function_table[ordinal]);
@ -1064,7 +1064,7 @@ int xe_xex2_lookup_export(xe_xex2_ref xex, int ordinal,
const char *mod_name = (const char *)((uint64_t)e + e->Name);
if (ordinal < e->NumberOfFunctions) {
if (ordinal < int(e->NumberOfFunctions)) {
peexport.name = nullptr; // TODO: Backwards conversion to get this
peexport.ordinal = ordinal;
peexport.addr = (uint64_t)(baseaddr + function_table[ordinal]);

View File

@ -279,14 +279,14 @@ SHIM_CALL XexGetProcedureAddress_shim(PPCContext* ppc_state,
if (XSUCCEEDED(result)) {
if (ordinal < 0x10000) {
// Ordinal.
uint64_t ptr = (uint64_t)module->GetProcAddressByOrdinal(ordinal);
uint32_t ptr = module->GetProcAddressByOrdinal(ordinal);
if (ptr) {
SHIM_SET_MEM_32(out_function_ptr, ptr);
result = X_STATUS_SUCCESS;
}
} else {
// It's a name pointer instead.
uint64_t ptr = (uint64_t)module->GetProcAddressByName(name);
uint32_t ptr = module->GetProcAddressByName(name);
// FYI: We don't need to generate this function now. It'll
// be done automatically by xenia when it gets called.