Fixing compile warnings.
This commit is contained in:
parent
3f1131c65f
commit
b07d5b8ed3
|
@ -28,15 +28,15 @@ XKernelModule::XKernelModule(KernelState* kernel_state, const char* path)
|
||||||
|
|
||||||
XKernelModule::~XKernelModule() {}
|
XKernelModule::~XKernelModule() {}
|
||||||
|
|
||||||
void* XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
uint32_t XKernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||||
// TODO(benvanik): check export tables.
|
// TODO(benvanik): check export tables.
|
||||||
XELOGE("GetProcAddressByOrdinal not implemented");
|
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");
|
XELOGE("GetProcAddressByName not implemented");
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace kernel
|
} // namespace kernel
|
||||||
|
|
|
@ -21,10 +21,10 @@ class KernelState;
|
||||||
class XKernelModule : public XModule {
|
class XKernelModule : public XModule {
|
||||||
public:
|
public:
|
||||||
XKernelModule(KernelState* kernel_state, const char* path);
|
XKernelModule(KernelState* kernel_state, const char* path);
|
||||||
virtual ~XKernelModule();
|
~XKernelModule() override;
|
||||||
|
|
||||||
virtual void* GetProcAddressByOrdinal(uint16_t ordinal);
|
uint32_t GetProcAddressByOrdinal(uint16_t ordinal) override;
|
||||||
virtual void* GetProcAddressByName(const char* name);
|
uint32_t GetProcAddressByName(const char* name) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Emulator* emulator_;
|
Emulator* emulator_;
|
||||||
|
|
|
@ -26,8 +26,8 @@ class XModule : public XObject {
|
||||||
const std::string& path() const { return path_; }
|
const std::string& path() const { return path_; }
|
||||||
const std::string& name() const { return name_; }
|
const std::string& name() const { return name_; }
|
||||||
|
|
||||||
virtual void* GetProcAddressByOrdinal(uint16_t ordinal) = 0;
|
virtual uint32_t GetProcAddressByOrdinal(uint16_t ordinal) = 0;
|
||||||
virtual void* GetProcAddressByName(const char* name) = 0;
|
virtual uint32_t GetProcAddressByName(const char* name) = 0;
|
||||||
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
|
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
|
||||||
uint32_t* out_section_size);
|
uint32_t* out_section_size);
|
||||||
|
|
||||||
|
|
|
@ -142,23 +142,25 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
uint32_t XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
|
||||||
PEExport export;
|
PEExport export;
|
||||||
int ret = xe_xex2_lookup_export(xex_, ordinal, 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 uint32_t(export.addr);
|
||||||
|
|
||||||
return (void*)export.addr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* XUserModule::GetProcAddressByName(const char* name) {
|
uint32_t XUserModule::GetProcAddressByName(const char* name) {
|
||||||
PEExport export;
|
PEExport export;
|
||||||
int ret = xe_xex2_lookup_export(xex_, name, export);
|
int ret = xe_xex2_lookup_export(xex_, name, export);
|
||||||
|
if (ret) {
|
||||||
// Failure.
|
XELOGE("XUserModule::GetProcAddressByName(%s) not found", name);
|
||||||
if (ret) return nullptr;
|
return 0;
|
||||||
|
}
|
||||||
return (void*)export.addr;
|
return uint32_t(export.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,
|
X_STATUS XUserModule::GetSection(const char* name, uint32_t* out_section_data,
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace kernel {
|
||||||
class XUserModule : public XModule {
|
class XUserModule : public XModule {
|
||||||
public:
|
public:
|
||||||
XUserModule(KernelState* kernel_state, const char* path);
|
XUserModule(KernelState* kernel_state, const char* path);
|
||||||
virtual ~XUserModule();
|
~XUserModule() override;
|
||||||
|
|
||||||
xe_xex2_ref xex();
|
xe_xex2_ref xex();
|
||||||
const xe_xex2_header_t* xex_header();
|
const xe_xex2_header_t* xex_header();
|
||||||
|
@ -32,18 +32,16 @@ class XUserModule : public XModule {
|
||||||
X_STATUS LoadFromFile(const char* path);
|
X_STATUS LoadFromFile(const char* path);
|
||||||
X_STATUS LoadFromMemory(const void* addr, const size_t length);
|
X_STATUS LoadFromMemory(const void* addr, const size_t length);
|
||||||
|
|
||||||
virtual void* GetProcAddressByOrdinal(uint16_t ordinal);
|
uint32_t GetProcAddressByOrdinal(uint16_t ordinal) override;
|
||||||
virtual void* GetProcAddressByName(const char* name);
|
uint32_t GetProcAddressByName(const char* name) override;
|
||||||
virtual X_STATUS GetSection(const char* name, uint32_t* out_section_data,
|
X_STATUS GetSection(const char* name, uint32_t* out_section_data,
|
||||||
uint32_t* out_section_size);
|
uint32_t* out_section_size) override;
|
||||||
|
|
||||||
X_STATUS Launch(uint32_t flags);
|
X_STATUS Launch(uint32_t flags);
|
||||||
|
|
||||||
void Dump();
|
void Dump();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int LoadPE();
|
|
||||||
|
|
||||||
xe_xex2_ref xex_;
|
xe_xex2_ref xex_;
|
||||||
uint32_t execution_info_ptr_;
|
uint32_t execution_info_ptr_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
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]);
|
const char *fn_name = (const char *)((uint64_t)e + name_table[i]);
|
||||||
uint16_t ordinal = ordinal_table[i];
|
uint16_t ordinal = ordinal_table[i];
|
||||||
uint64_t addr = (uint64_t)(baseaddr + function_table[ordinal]);
|
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);
|
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.name = nullptr; // TODO: Backwards conversion to get this
|
||||||
peexport.ordinal = ordinal;
|
peexport.ordinal = ordinal;
|
||||||
peexport.addr = (uint64_t)(baseaddr + function_table[ordinal]);
|
peexport.addr = (uint64_t)(baseaddr + function_table[ordinal]);
|
||||||
|
|
|
@ -279,14 +279,14 @@ SHIM_CALL XexGetProcedureAddress_shim(PPCContext* ppc_state,
|
||||||
if (XSUCCEEDED(result)) {
|
if (XSUCCEEDED(result)) {
|
||||||
if (ordinal < 0x10000) {
|
if (ordinal < 0x10000) {
|
||||||
// Ordinal.
|
// Ordinal.
|
||||||
uint64_t ptr = (uint64_t)module->GetProcAddressByOrdinal(ordinal);
|
uint32_t ptr = module->GetProcAddressByOrdinal(ordinal);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
SHIM_SET_MEM_32(out_function_ptr, ptr);
|
SHIM_SET_MEM_32(out_function_ptr, ptr);
|
||||||
result = X_STATUS_SUCCESS;
|
result = X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// It's a name pointer instead.
|
// 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
|
// FYI: We don't need to generate this function now. It'll
|
||||||
// be done automatically by xenia when it gets called.
|
// be done automatically by xenia when it gets called.
|
||||||
|
|
Loading…
Reference in New Issue