Skip to content

Commit

Permalink
Merge branch 'xenia-canary:canary_experimental' into New_XMA
Browse files Browse the repository at this point in the history
  • Loading branch information
backgamon authored Jan 12, 2024
2 parents dc4e490 + 49d4460 commit b77da1d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/xenia/app/discord/discord_presence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void DiscordPresence::Initialize() {
handlers.joinGame = &HandleDiscordJoinGame;
handlers.joinRequest = &HandleDiscordJoinRequest;
handlers.spectateGame = &HandleDiscordSpectateGame;
Discord_Initialize("616128086999695367", &handlers, 0, "");
Discord_Initialize("1193272084797849762", &handlers, 0, "");
}

void DiscordPresence::NotPlaying() {
Expand Down
28 changes: 28 additions & 0 deletions src/xenia/kernel/util/xdbf_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ constexpr fourcc_t kXdbfSignatureXprp = make_fourcc("XPRP");
constexpr fourcc_t kXdbfSignatureXcxt = make_fourcc("XCXT");
constexpr fourcc_t kXdbfSignatureXvc2 = make_fourcc("XVC2");
constexpr fourcc_t kXdbfSignatureXmat = make_fourcc("XMAT");
constexpr fourcc_t kXdbfSignatureXsrc = make_fourcc("XSRC");

constexpr uint64_t kXdbfIdTitle = 0x8000;
constexpr uint64_t kXdbfIdXstc = 0x58535443;
Expand All @@ -30,6 +31,7 @@ constexpr uint64_t kXdbfIdXprp = 0x58505250;
constexpr uint64_t kXdbfIdXctx = 0x58435854;
constexpr uint64_t kXdbfIdXvc2 = 0x58564332;
constexpr uint64_t kXdbfIdXmat = 0x584D4154;
constexpr uint64_t kXdbfIdXsrc = 0x58535243;

XdbfWrapper::XdbfWrapper(const uint8_t* data, size_t data_size)
: data_(data), data_size_(data_size) {
Expand Down Expand Up @@ -213,6 +215,32 @@ std::vector<XdbfViewTable> XdbfWrapper::GetStatsView() const {
return entries;
}

const uint8_t* XdbfWrapper::ReadXLast(uint32_t& compressed_size,
uint32_t& decompressed_size) const {
auto xlast_table = GetEntry(XdbfSection::kMetadata, kXdbfIdXsrc);
if (!xlast_table) {
return nullptr;
}

auto xlast_head =
reinterpret_cast<const XdbfSectionHeader*>(xlast_table.buffer);
assert_true(xlast_head->magic == kXdbfSignatureXsrc);
assert_true(xlast_head->version == 1);

const uint8_t* ptr = xlast_table.buffer + sizeof(XdbfSectionHeader);

const uint32_t filename_length = xe::byte_swap(*(uint32_t*)ptr);
ptr += sizeof(uint32_t) + filename_length;

decompressed_size = xe::byte_swap(*(uint32_t*)ptr);
ptr += sizeof(uint32_t);

compressed_size = xe::byte_swap(*(uint32_t*)ptr);
ptr += sizeof(uint32_t);

return ptr;
}

XdbfAchievementTableEntry XdbfWrapper::GetAchievement(const uint32_t id) const {
const auto achievements = GetAchievements();

Expand Down
2 changes: 2 additions & 0 deletions src/xenia/kernel/util/xdbf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ class XdbfWrapper {

XdbfPropertyBag GetMatchCollection() const;

const uint8_t* ReadXLast(uint32_t& compressed_size, uint32_t& decompressed_size) const;

private:
const uint8_t* data_ = nullptr;
size_t data_size_ = 0;
Expand Down

0 comments on commit b77da1d

Please sign in to comment.