Formatting all code. Too gnarly to rebase properly.

This commit is contained in:
Ben Vanik 2015-12-29 13:13:34 -08:00
parent 4e7dfa477b
commit 948aa2400d
16 changed files with 27 additions and 30 deletions

View File

@ -18,9 +18,7 @@ ByteStream::ByteStream(uint8_t* data, size_t data_length, size_t offset)
ByteStream::~ByteStream() = default; ByteStream::~ByteStream() = default;
void ByteStream::Advance(size_t num_bytes) { void ByteStream::Advance(size_t num_bytes) { offset_ += num_bytes; }
offset_ += num_bytes;
}
void ByteStream::Read(uint8_t* buf, size_t len) { void ByteStream::Read(uint8_t* buf, size_t len) {
assert_true(offset_ < data_length_); assert_true(offset_ < data_length_);

View File

@ -54,7 +54,9 @@ class Backend {
Module* module, uint32_t address) = 0; Module* module, uint32_t address) = 0;
virtual bool InstallBreakpoint(Breakpoint* bp) { return false; } virtual bool InstallBreakpoint(Breakpoint* bp) { return false; }
virtual bool InstallBreakpoint(Breakpoint* bp, Function* func) { return false; } virtual bool InstallBreakpoint(Breakpoint* bp, Function* func) {
return false;
}
virtual bool UninstallBreakpoint(Breakpoint* bp) { return false; } virtual bool UninstallBreakpoint(Breakpoint* bp) { return false; }
protected: protected:

View File

@ -461,7 +461,7 @@ bool Processor::BreakpointHit(uint32_t address, uint64_t host_pc) {
auto bp = FindBreakpoint(address); auto bp = FindBreakpoint(address);
if (bp) { if (bp) {
bp->Hit(host_pc); bp->Hit(host_pc);
xe::threading::Thread::GetCurrentThread()->Suspend(); xe::threading::Thread::GetCurrentThread()->Suspend();
return true; return true;
} }

View File

@ -475,7 +475,8 @@ bool XexModule::SetupLibraryImports(const char* name,
XELOGW("WARNING: Imported kernel function %s is unimplemented!", XELOGW("WARNING: Imported kernel function %s is unimplemented!",
import_name.GetString()); import_name.GetString());
} }
static_cast<GuestFunction*>(function)->SetupExtern(handler, kernel_export); static_cast<GuestFunction*>(function)->SetupExtern(handler,
kernel_export);
} }
function->set_status(Symbol::Status::kDeclared); function->set_status(Symbol::Status::kDeclared);
} else { } else {

View File

@ -403,7 +403,8 @@ bool Emulator::RestoreFromFile(const std::wstring& path) {
} }
// Update the main thread. // Update the main thread.
auto threads = kernel_state_->object_table()->GetObjectsByType<kernel::XThread>(); auto threads =
kernel_state_->object_table()->GetObjectsByType<kernel::XThread>();
for (auto thread : threads) { for (auto thread : threads) {
if (thread->main_thread()) { if (thread->main_thread()) {
main_thread_ = thread->thread(); main_thread_ = thread->thread();

View File

@ -226,7 +226,6 @@ class CommandProcessor {
Shader* active_pixel_shader_ = nullptr; Shader* active_pixel_shader_ = nullptr;
bool paused_ = false; bool paused_ = false;
}; };
} // namespace gpu } // namespace gpu

View File

@ -111,8 +111,8 @@ uint32_t KernelModule::GetProcAddressByOrdinal(uint16_t ordinal) {
handler = handler =
(cpu::GuestFunction::ExternHandler)export_entry->function_data.shim; (cpu::GuestFunction::ExternHandler)export_entry->function_data.shim;
} }
static_cast<cpu::GuestFunction*>(function) static_cast<cpu::GuestFunction*>(function)->SetupExtern(handler,
->SetupExtern(handler, export_entry); export_entry);
function->set_status(cpu::Symbol::Status::kDeclared); function->set_status(cpu::Symbol::Status::kDeclared);

View File

@ -139,13 +139,9 @@ void KernelState::set_process_type(uint32_t value) {
pib->process_type = uint8_t(value); pib->process_type = uint8_t(value);
} }
uint32_t KernelState::AllocateTLS() { uint32_t KernelState::AllocateTLS() { return uint32_t(tls_bitmap_.Acquire()); }
return uint32_t(tls_bitmap_.Acquire());
}
void KernelState::FreeTLS(uint32_t slot) { void KernelState::FreeTLS(uint32_t slot) { tls_bitmap_.Release(slot); }
tls_bitmap_.Release(slot);
}
void KernelState::RegisterTitleTerminateNotification(uint32_t routine, void KernelState::RegisterTitleTerminateNotification(uint32_t routine,
uint32_t priority) { uint32_t priority) {

View File

@ -76,14 +76,16 @@ X_STATUS ObjectTable::FindFreeSlot(uint32_t* out_slot) {
bool ObjectTable::Resize(uint32_t new_capacity) { bool ObjectTable::Resize(uint32_t new_capacity) {
uint32_t new_size = new_capacity * sizeof(ObjectTableEntry); uint32_t new_size = new_capacity * sizeof(ObjectTableEntry);
uint32_t old_size = table_capacity_ * sizeof(ObjectTableEntry); uint32_t old_size = table_capacity_ * sizeof(ObjectTableEntry);
auto new_table = reinterpret_cast<ObjectTableEntry*>(realloc(table_, new_size)); auto new_table =
reinterpret_cast<ObjectTableEntry*>(realloc(table_, new_size));
if (!new_table) { if (!new_table) {
return false; return false;
} }
// Zero out new entries. // Zero out new entries.
if (new_size > old_size) { if (new_size > old_size) {
std::memset(reinterpret_cast<uint8_t*>(new_table) + old_size, 0, new_size - old_size); std::memset(reinterpret_cast<uint8_t*>(new_table) + old_size, 0,
new_size - old_size);
} }
last_free_entry_ = table_capacity_; last_free_entry_ = table_capacity_;

View File

@ -42,8 +42,8 @@ class ObjectTable {
bool Save(ByteStream* stream); bool Save(ByteStream* stream);
bool Restore(ByteStream* stream); bool Restore(ByteStream* stream);
// Restores a XObject reference with a handle. Mainly for internal use - do not // Restores a XObject reference with a handle. Mainly for internal use - do
// use. // not use.
X_STATUS RestoreHandle(X_HANDLE handle, XObject* object); X_STATUS RestoreHandle(X_HANDLE handle, XObject* object);
template <typename T> template <typename T>
@ -78,7 +78,7 @@ class ObjectTable {
} }
std::vector<object_ref<XObject>> GetAllObjects(); std::vector<object_ref<XObject>> GetAllObjects();
void PurgeAllObjects(); // Purges the object table of all guest objects void PurgeAllObjects(); // Purges the object table of all guest objects
private: private:
typedef struct { typedef struct {

View File

@ -14,8 +14,8 @@
#include "xenia/kernel/util/shim_utils.h" #include "xenia/kernel/util/shim_utils.h"
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h" #include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
#include "xenia/kernel/xevent.h" #include "xenia/kernel/xevent.h"
#include "xenia/kernel/xiocompletion.h"
#include "xenia/kernel/xfile.h" #include "xenia/kernel/xfile.h"
#include "xenia/kernel/xiocompletion.h"
#include "xenia/kernel/xthread.h" #include "xenia/kernel/xthread.h"
#include "xenia/vfs/device.h" #include "xenia/vfs/device.h"
#include "xenia/xbox.h" #include "xenia/xbox.h"

View File

@ -47,4 +47,4 @@ bool XIOCompletion::WaitForNotification(uint64_t wait_ticks) {
} }
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe

View File

@ -51,4 +51,4 @@ class XIOCompletion : public XObject {
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe
#endif // XENIA_KERNEL_XIOCOMPLETION_H_ #endif // XENIA_KERNEL_XIOCOMPLETION_H_

View File

@ -80,7 +80,8 @@ class XModule : public XObject {
static uint32_t GetHandleFromHModule(void* hmodule); static uint32_t GetHandleFromHModule(void* hmodule);
virtual bool Save(ByteStream* stream) override; virtual bool Save(ByteStream* stream) override;
static object_ref<XModule> Restore(KernelState* kernel_state, ByteStream* stream); static object_ref<XModule> Restore(KernelState* kernel_state,
ByteStream* stream);
protected: protected:
void OnLoad(); void OnLoad();

View File

@ -187,7 +187,6 @@ class XObject {
static object_ref<T> GetNativeObject(KernelState* kernel_state, static object_ref<T> GetNativeObject(KernelState* kernel_state,
void* native_ptr, int32_t as_type = -1); void* native_ptr, int32_t as_type = -1);
protected: protected:
bool SaveObject(ByteStream* stream); bool SaveObject(ByteStream* stream);
bool RestoreObject(ByteStream* stream); bool RestoreObject(ByteStream* stream);
@ -313,9 +312,7 @@ class object_ref {
void reset(T* value) noexcept { object_ref(value).swap(*this); } void reset(T* value) noexcept { object_ref(value).swap(*this); }
inline bool operator==(const T* right) noexcept { inline bool operator==(const T* right) noexcept { return value_ == right; }
return value_ == right;
}
private: private:
T* value_ = nullptr; T* value_ = nullptr;

View File

@ -17,8 +17,8 @@
#include "xenia/base/threading.h" #include "xenia/base/threading.h"
#include "xenia/cpu/thread_state.h" #include "xenia/cpu/thread_state.h"
#include "xenia/kernel/util/native_list.h" #include "xenia/kernel/util/native_list.h"
#include "xenia/kernel/xobject.h"
#include "xenia/kernel/xmutant.h" #include "xenia/kernel/xmutant.h"
#include "xenia/kernel/xobject.h"
#include "xenia/xbox.h" #include "xenia/xbox.h"
namespace xe { namespace xe {