Formatting of changes

As per the style guide
This commit is contained in:
x1nixmzeng 2016-01-07 20:51:28 +00:00
parent effe241a11
commit e4cef38d95
4 changed files with 192 additions and 198 deletions

View File

@ -531,7 +531,8 @@ X_STATUS Emulator::CompleteLaunch(const std::wstring& path,
xe::xdbf::XdbfBlock icon_block = xe::xdbf::get_icon(db);
if (icon_block.buffer != nullptr) {
display_window_->set_icon_from_buffer(icon_block.buffer, icon_block.size);
display_window_->set_icon_from_buffer(icon_block.buffer,
icon_block.size);
}
}
}

View File

@ -168,12 +168,13 @@ bool Win32Window::set_title(const std::wstring& title) {
}
bool Win32Window::set_icon_from_buffer(void* buffer, size_t size) {
if (icon_ != nullptr) {
DestroyIcon(icon_);
}
HICON icon = CreateIconFromResourceEx(reinterpret_cast<BYTE *>(buffer), static_cast<DWORD>(size), TRUE, 0x00030000, 0, 0, LR_DEFAULTCOLOR);
HICON icon = CreateIconFromResourceEx(reinterpret_cast<BYTE*>(buffer),
static_cast<DWORD>(size), TRUE,
0x00030000, 0, 0, LR_DEFAULTCOLOR);
if (icon != nullptr) {
icon_ = icon;

View File

@ -14,23 +14,17 @@ namespace xdbf {
XdbfWrapper::XdbfWrapper() = default;
XBDF_HEADER& XdbfWrapper::get_header() const
{
return *state_.header;
}
XBDF_HEADER& XdbfWrapper::get_header() const { return *state_.header; }
XBDF_ENTRY& XdbfWrapper::get_entry(uint32_t n) const
{
XBDF_ENTRY& XdbfWrapper::get_entry(uint32_t n) const {
return state_.entries[n];
}
XBDF_FILE_LOC& XdbfWrapper::get_file(uint32_t n) const
{
XBDF_FILE_LOC& XdbfWrapper::get_file(uint32_t n) const {
return state_.files[n];
}
bool XdbfWrapper::initialize(uint8_t* buffer, size_t length)
{
bool XdbfWrapper::initialize(uint8_t* buffer, size_t length) {
if (length <= sizeof(XBDF_HEADER)) {
return false;
}
@ -62,7 +56,6 @@ namespace xdbf {
}
XdbfBlock XdbfWrapper::get_entry(XdbfSection section, uint64_t id) const {
XdbfBlock block = {nullptr, 0};
uint32_t x = 0;
@ -81,13 +74,11 @@ namespace xdbf {
return block;
}
XdbfBlock get_icon(XdbfWrapper& ref)
{
XdbfBlock get_icon(XdbfWrapper& ref) {
return ref.get_entry(kSectionImage, 0x8000);
}
std::string get_title(XdbfWrapper& ref)
{
std::string get_title(XdbfWrapper& ref) {
std::string title_str;
XdbfBlock block = ref.get_entry(kSectionMetadata, 0x58535443);
@ -97,10 +88,12 @@ namespace xdbf {
assert_true(xstc->magic == 'XSTC');
uint32_t def_language = xstc->default_language;
XdbfBlock lang_block = ref.get_entry(kSectionStringTable, static_cast<uint64_t>(def_language));
XdbfBlock lang_block =
ref.get_entry(kSectionStringTable, static_cast<uint64_t>(def_language));
if (lang_block.buffer != nullptr) {
XDBF_XSTR_HEADER* xstr_head = reinterpret_cast<XDBF_XSTR_HEADER*>(lang_block.buffer);
XDBF_XSTR_HEADER* xstr_head =
reinterpret_cast<XDBF_XSTR_HEADER*>(lang_block.buffer);
assert_true(xstr_head->magic == 'XSTR');
assert_true(xstr_head->version == 1);
@ -110,7 +103,8 @@ namespace xdbf {
uint16_t s = 0;
while (s < str_count && title_str.empty()) {
XDBF_STRINGTABLE_ENTRY* entry = reinterpret_cast<XDBF_STRINGTABLE_ENTRY*>(currentAddress);
XDBF_STRINGTABLE_ENTRY* entry =
reinterpret_cast<XDBF_STRINGTABLE_ENTRY*>(currentAddress);
currentAddress += sizeof(XDBF_STRINGTABLE_ENTRY);
uint16_t len = entry->string_length;
@ -127,6 +121,5 @@ namespace xdbf {
return title_str;
}
} // namespace xdbf
} // namespace xe

View File

@ -115,7 +115,6 @@ namespace xdbf {
XdbfBlock get_icon(XdbfWrapper& ref);
std::string get_title(XdbfWrapper& ref);
} // namespace xdbf
} // namespace xe