parent
effe241a11
commit
e4cef38d95
|
@ -531,7 +531,8 @@ X_STATUS Emulator::CompleteLaunch(const std::wstring& path,
|
||||||
|
|
||||||
xe::xdbf::XdbfBlock icon_block = xe::xdbf::get_icon(db);
|
xe::xdbf::XdbfBlock icon_block = xe::xdbf::get_icon(db);
|
||||||
if (icon_block.buffer != nullptr) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,12 +168,13 @@ bool Win32Window::set_title(const std::wstring& title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Win32Window::set_icon_from_buffer(void* buffer, size_t size) {
|
bool Win32Window::set_icon_from_buffer(void* buffer, size_t size) {
|
||||||
|
|
||||||
if (icon_ != nullptr) {
|
if (icon_ != nullptr) {
|
||||||
DestroyIcon(icon_);
|
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) {
|
if (icon != nullptr) {
|
||||||
icon_ = icon;
|
icon_ = icon;
|
||||||
|
|
|
@ -14,23 +14,17 @@ namespace xdbf {
|
||||||
|
|
||||||
XdbfWrapper::XdbfWrapper() = default;
|
XdbfWrapper::XdbfWrapper() = default;
|
||||||
|
|
||||||
XBDF_HEADER& XdbfWrapper::get_header() const
|
XBDF_HEADER& XdbfWrapper::get_header() const { return *state_.header; }
|
||||||
{
|
|
||||||
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];
|
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];
|
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)) {
|
if (length <= sizeof(XBDF_HEADER)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +56,6 @@ namespace xdbf {
|
||||||
}
|
}
|
||||||
|
|
||||||
XdbfBlock XdbfWrapper::get_entry(XdbfSection section, uint64_t id) const {
|
XdbfBlock XdbfWrapper::get_entry(XdbfSection section, uint64_t id) const {
|
||||||
|
|
||||||
XdbfBlock block = {nullptr, 0};
|
XdbfBlock block = {nullptr, 0};
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
|
|
||||||
|
@ -81,13 +74,11 @@ namespace xdbf {
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
XdbfBlock get_icon(XdbfWrapper& ref)
|
XdbfBlock get_icon(XdbfWrapper& ref) {
|
||||||
{
|
|
||||||
return ref.get_entry(kSectionImage, 0x8000);
|
return ref.get_entry(kSectionImage, 0x8000);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_title(XdbfWrapper& ref)
|
std::string get_title(XdbfWrapper& ref) {
|
||||||
{
|
|
||||||
std::string title_str;
|
std::string title_str;
|
||||||
|
|
||||||
XdbfBlock block = ref.get_entry(kSectionMetadata, 0x58535443);
|
XdbfBlock block = ref.get_entry(kSectionMetadata, 0x58535443);
|
||||||
|
@ -97,10 +88,12 @@ namespace xdbf {
|
||||||
assert_true(xstc->magic == 'XSTC');
|
assert_true(xstc->magic == 'XSTC');
|
||||||
uint32_t def_language = xstc->default_language;
|
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) {
|
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->magic == 'XSTR');
|
||||||
assert_true(xstr_head->version == 1);
|
assert_true(xstr_head->version == 1);
|
||||||
|
@ -110,7 +103,8 @@ namespace xdbf {
|
||||||
|
|
||||||
uint16_t s = 0;
|
uint16_t s = 0;
|
||||||
while (s < str_count && title_str.empty()) {
|
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);
|
currentAddress += sizeof(XDBF_STRINGTABLE_ENTRY);
|
||||||
uint16_t len = entry->string_length;
|
uint16_t len = entry->string_length;
|
||||||
|
|
||||||
|
@ -127,6 +121,5 @@ namespace xdbf {
|
||||||
return title_str;
|
return title_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace xdbf
|
} // namespace xdbf
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
|
@ -115,7 +115,6 @@ namespace xdbf {
|
||||||
XdbfBlock get_icon(XdbfWrapper& ref);
|
XdbfBlock get_icon(XdbfWrapper& ref);
|
||||||
std::string get_title(XdbfWrapper& ref);
|
std::string get_title(XdbfWrapper& ref);
|
||||||
|
|
||||||
|
|
||||||
} // namespace xdbf
|
} // namespace xdbf
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue