Code cleanup: moving poly/ into xenia/base/
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/kernel/apps/xgi_app.h"
|
||||
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -32,26 +32,26 @@ X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
// qword 0
|
||||
// dword r4 context enum
|
||||
// dword r5 value
|
||||
uint32_t user_index = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t context_id = poly::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t context_value = poly::load_and_swap<uint32_t>(buffer + 20);
|
||||
uint32_t user_index = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t context_id = xe::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t context_value = xe::load_and_swap<uint32_t>(buffer + 20);
|
||||
XELOGD("XUserSetContextEx(%.8X, %.8X, %.8X)", user_index, context_id,
|
||||
context_value);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x000B0007: {
|
||||
uint32_t user_index = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t property_id = poly::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t value_size = poly::load_and_swap<uint32_t>(buffer + 20);
|
||||
uint32_t value_ptr = poly::load_and_swap<uint32_t>(buffer + 24);
|
||||
uint32_t user_index = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t property_id = xe::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t value_size = xe::load_and_swap<uint32_t>(buffer + 20);
|
||||
uint32_t value_ptr = xe::load_and_swap<uint32_t>(buffer + 24);
|
||||
XELOGD("XUserSetPropertyEx(%.8X, %.8X, %d, %.8X)", user_index,
|
||||
property_id, value_size, value_ptr);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x000B0008: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t achievement_count = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t achievements_ptr = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t achievement_count = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t achievements_ptr = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
XELOGD("XUserWriteAchievements(%.8X, %.8X)", achievement_count,
|
||||
achievements_ptr);
|
||||
return X_ERROR_SUCCESS;
|
||||
@@ -69,14 +69,14 @@ X_RESULT XXGIApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
case 0x000B0041: {
|
||||
assert_true(!buffer_length || buffer_length == 32);
|
||||
// 00000000 2789fecc 00000000 00000000 200491e0 00000000 200491f0 20049340
|
||||
uint32_t user_index = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t context_ptr = poly::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t user_index = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t context_ptr = xe::load_and_swap<uint32_t>(buffer + 16);
|
||||
auto context = memory_->TranslateVirtual(context_ptr);
|
||||
uint32_t context_id = poly::load_and_swap<uint32_t>(context + 0);
|
||||
uint32_t context_id = xe::load_and_swap<uint32_t>(context + 0);
|
||||
XELOGD("XUserGetContext(%.8X, %.8X(%.8X))", user_index, context_ptr,
|
||||
context_id);
|
||||
uint32_t value = 0;
|
||||
poly::store_and_swap<uint32_t>(context + 4, value);
|
||||
xe::store_and_swap<uint32_t>(context + 4, value);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x000B0071: {
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/kernel/apps/xlivebase_app.h"
|
||||
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -31,7 +31,7 @@ X_RESULT XXLiveBaseApp::DispatchMessageSync(uint32_t message,
|
||||
// Called on startup, seems to just return a bool in the buffer.
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
XELOGD("XLiveBaseGetLogonId(%.8X)", buffer_ptr);
|
||||
poly::store_and_swap<uint32_t>(buffer + 0, 1); // ?
|
||||
xe::store_and_swap<uint32_t>(buffer + 0, 1); // ?
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x00058020: {
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/kernel/apps/xmp_app.h"
|
||||
|
||||
#include "poly/threading.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -35,8 +35,8 @@ X_RESULT XXMPApp::XMPGetStatus(uint32_t state_ptr) {
|
||||
Sleep(1);
|
||||
|
||||
XELOGD("XMPGetStatus(%.8X)", state_ptr);
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(state_ptr),
|
||||
static_cast<uint32_t>(state_));
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(state_ptr),
|
||||
static_cast<uint32_t>(state_));
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ X_RESULT XXMPApp::XMPCreateTitlePlaylist(
|
||||
uint32_t out_playlist_handle) {
|
||||
XELOGD("XMPCreateTitlePlaylist(%.8X, %.8X, %.8X(%s), %.8X, %.8X, %.8X)",
|
||||
songs_ptr, song_count, playlist_name_ptr,
|
||||
poly::to_string(playlist_name).c_str(), flags, out_song_handles,
|
||||
xe::to_string(playlist_name).c_str(), flags, out_song_handles,
|
||||
out_playlist_handle);
|
||||
auto playlist = std::make_unique<Playlist>();
|
||||
playlist->handle = ++next_playlist_handle_;
|
||||
@@ -56,32 +56,30 @@ X_RESULT XXMPApp::XMPCreateTitlePlaylist(
|
||||
auto song = std::make_unique<Song>();
|
||||
song->handle = ++next_song_handle_;
|
||||
uint8_t* song_base = memory_->TranslateVirtual(songs_ptr + (i * 36));
|
||||
song->file_path =
|
||||
poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 0)));
|
||||
song->name = poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 4)));
|
||||
song->artist = poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 8)));
|
||||
song->album = poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 12)));
|
||||
song->album_artist =
|
||||
poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 16)));
|
||||
song->genre = poly::load_and_swap<std::wstring>(memory_->TranslateVirtual(
|
||||
poly::load_and_swap<uint32_t>(song_base + 20)));
|
||||
song->track_number = poly::load_and_swap<uint32_t>(song_base + 24);
|
||||
song->duration_ms = poly::load_and_swap<uint32_t>(song_base + 28);
|
||||
song->format = static_cast<Song::Format>(
|
||||
poly::load_and_swap<uint32_t>(song_base + 32));
|
||||
song->file_path = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 0)));
|
||||
song->name = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 4)));
|
||||
song->artist = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 8)));
|
||||
song->album = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 12)));
|
||||
song->album_artist = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 16)));
|
||||
song->genre = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(xe::load_and_swap<uint32_t>(song_base + 20)));
|
||||
song->track_number = xe::load_and_swap<uint32_t>(song_base + 24);
|
||||
song->duration_ms = xe::load_and_swap<uint32_t>(song_base + 28);
|
||||
song->format =
|
||||
static_cast<Song::Format>(xe::load_and_swap<uint32_t>(song_base + 32));
|
||||
if (out_song_handles) {
|
||||
poly::store_and_swap<uint32_t>(
|
||||
xe::store_and_swap<uint32_t>(
|
||||
memory_->TranslateVirtual(out_song_handles + (i * 4)), song->handle);
|
||||
}
|
||||
playlist->songs.emplace_back(std::move(song));
|
||||
}
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(out_playlist_handle),
|
||||
playlist->handle);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(out_playlist_handle),
|
||||
playlist->handle);
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
playlists_.insert({playlist->handle, playlist.get()});
|
||||
@@ -202,49 +200,49 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
switch (message) {
|
||||
case 0x00070002: {
|
||||
assert_true(!buffer_length || buffer_length == 12);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playlist_handle = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t song_handle = poly::load_and_swap<uint32_t>(buffer + 8); // 0?
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playlist_handle = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t song_handle = xe::load_and_swap<uint32_t>(buffer + 8); // 0?
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPPlayTitlePlaylist(playlist_handle, song_handle);
|
||||
}
|
||||
case 0x00070003: {
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPContinue();
|
||||
}
|
||||
case 0x00070004: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPStop(unk);
|
||||
}
|
||||
case 0x00070005: {
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPPause();
|
||||
}
|
||||
case 0x00070006: {
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPNext();
|
||||
}
|
||||
case 0x00070007: {
|
||||
assert_true(!buffer_length || buffer_length == 4);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPPrevious();
|
||||
}
|
||||
case 0x00070008: {
|
||||
assert_true(!buffer_length || buffer_length == 16);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playback_mode = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t repeat_mode = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t flags = poly::load_and_swap<uint32_t>(buffer + 12);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playback_mode = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t repeat_mode = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t flags = xe::load_and_swap<uint32_t>(buffer + 12);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
XELOGD("XMPSetPlaybackBehavior(%.8X, %.8X, %.8X)", playback_mode,
|
||||
repeat_mode, flags);
|
||||
@@ -256,27 +254,26 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
}
|
||||
case 0x00070009: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t state_ptr = poly::load_and_swap<uint32_t>(
|
||||
buffer + 4); // out ptr to 4b - expect 0
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t state_ptr =
|
||||
xe::load_and_swap<uint32_t>(buffer + 4); // out ptr to 4b - expect 0
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPGetStatus(state_ptr);
|
||||
}
|
||||
case 0x0007000B: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t float_ptr = poly::load_and_swap<uint32_t>(
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t float_ptr = xe::load_and_swap<uint32_t>(
|
||||
buffer + 4); // out ptr to 4b - floating point
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
XELOGD("XMPGetVolume(%.8X)", float_ptr);
|
||||
poly::store_and_swap<float>(memory_->TranslateVirtual(float_ptr),
|
||||
volume_);
|
||||
xe::store_and_swap<float>(memory_->TranslateVirtual(float_ptr), volume_);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x0007000C: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
float float_value = poly::load_and_swap<float>(buffer + 4);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
float float_value = xe::load_and_swap<float>(buffer + 4);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
XELOGD("XMPSetVolume(%g)", float_value);
|
||||
volume_ = float_value;
|
||||
@@ -284,18 +281,18 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
}
|
||||
case 0x0007000D: {
|
||||
assert_true(!buffer_length || buffer_length == 36);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t dummy_alloc_ptr = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t dummy_alloc_size = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t songs_ptr = poly::load_and_swap<uint32_t>(buffer + 12);
|
||||
uint32_t song_count = poly::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t playlist_name_ptr = poly::load_and_swap<uint32_t>(buffer + 20);
|
||||
uint32_t flags = poly::load_and_swap<uint32_t>(buffer + 24);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t dummy_alloc_ptr = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t dummy_alloc_size = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t songs_ptr = xe::load_and_swap<uint32_t>(buffer + 12);
|
||||
uint32_t song_count = xe::load_and_swap<uint32_t>(buffer + 16);
|
||||
uint32_t playlist_name_ptr = xe::load_and_swap<uint32_t>(buffer + 20);
|
||||
uint32_t flags = xe::load_and_swap<uint32_t>(buffer + 24);
|
||||
uint32_t song_handles_ptr =
|
||||
poly::load_and_swap<uint32_t>(buffer + 28); // 0?
|
||||
uint32_t playlist_handle_ptr = poly::load_and_swap<uint32_t>(buffer + 32);
|
||||
xe::load_and_swap<uint32_t>(buffer + 28); // 0?
|
||||
uint32_t playlist_handle_ptr = xe::load_and_swap<uint32_t>(buffer + 32);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
auto playlist_name = poly::load_and_swap<std::wstring>(
|
||||
auto playlist_name = xe::load_and_swap<std::wstring>(
|
||||
memory_->TranslateVirtual(playlist_name_ptr));
|
||||
// dummy_alloc_ptr is the result of a XamAlloc of dummy_alloc_size.
|
||||
assert_true(dummy_alloc_size == song_count * 128);
|
||||
@@ -305,9 +302,9 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
}
|
||||
case 0x0007000E: {
|
||||
assert_true(!buffer_length || buffer_length == 12);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk_ptr = poly::load_and_swap<uint32_t>(buffer + 4); // 0
|
||||
uint32_t info_ptr = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk_ptr = xe::load_and_swap<uint32_t>(buffer + 4); // 0
|
||||
uint32_t info_ptr = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
auto info = memory_->TranslateVirtual(info_ptr);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
assert_zero(unk_ptr);
|
||||
@@ -316,31 +313,31 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
return X_ERROR_NOT_FOUND;
|
||||
}
|
||||
auto& song = active_playlist_->songs[active_song_index_];
|
||||
poly::store_and_swap<uint32_t>(info + 0, song->handle);
|
||||
poly::store_and_swap<std::wstring>(info + 4 + 572 + 0, song->name);
|
||||
poly::store_and_swap<std::wstring>(info + 4 + 572 + 40, song->artist);
|
||||
poly::store_and_swap<std::wstring>(info + 4 + 572 + 80, song->album);
|
||||
poly::store_and_swap<std::wstring>(info + 4 + 572 + 120,
|
||||
song->album_artist);
|
||||
poly::store_and_swap<std::wstring>(info + 4 + 572 + 160, song->genre);
|
||||
poly::store_and_swap<uint32_t>(info + 4 + 572 + 200, song->track_number);
|
||||
poly::store_and_swap<uint32_t>(info + 4 + 572 + 204, song->duration_ms);
|
||||
poly::store_and_swap<uint32_t>(info + 4 + 572 + 208,
|
||||
static_cast<uint32_t>(song->format));
|
||||
xe::store_and_swap<uint32_t>(info + 0, song->handle);
|
||||
xe::store_and_swap<std::wstring>(info + 4 + 572 + 0, song->name);
|
||||
xe::store_and_swap<std::wstring>(info + 4 + 572 + 40, song->artist);
|
||||
xe::store_and_swap<std::wstring>(info + 4 + 572 + 80, song->album);
|
||||
xe::store_and_swap<std::wstring>(info + 4 + 572 + 120,
|
||||
song->album_artist);
|
||||
xe::store_and_swap<std::wstring>(info + 4 + 572 + 160, song->genre);
|
||||
xe::store_and_swap<uint32_t>(info + 4 + 572 + 200, song->track_number);
|
||||
xe::store_and_swap<uint32_t>(info + 4 + 572 + 204, song->duration_ms);
|
||||
xe::store_and_swap<uint32_t>(info + 4 + 572 + 208,
|
||||
static_cast<uint32_t>(song->format));
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x00070013: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playlist_handle = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playlist_handle = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
return XMPDeleteTitlePlaylist(playlist_handle);
|
||||
}
|
||||
case 0x0007001A: {
|
||||
assert_true(!buffer_length || buffer_length == 12);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk1 = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t enabled = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk1 = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t enabled = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
assert_zero(unk1);
|
||||
XELOGD("XMPSetEnabled(%.8X, %.8X)", unk1, enabled);
|
||||
@@ -353,49 +350,48 @@ X_RESULT XXMPApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
}
|
||||
case 0x0007001B: {
|
||||
assert_true(!buffer_length || buffer_length == 12);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk_ptr = poly::load_and_swap<uint32_t>(
|
||||
buffer + 4); // out ptr to 4b - expect 0
|
||||
uint32_t disabled_ptr = poly::load_and_swap<uint32_t>(
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t unk_ptr =
|
||||
xe::load_and_swap<uint32_t>(buffer + 4); // out ptr to 4b - expect 0
|
||||
uint32_t disabled_ptr = xe::load_and_swap<uint32_t>(
|
||||
buffer + 8); // out ptr to 4b - expect 1 (to skip)
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
XELOGD("XMPGetEnabled(%.8X, %.8X)", unk_ptr, disabled_ptr);
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk_ptr), 0);
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(disabled_ptr),
|
||||
disabled_);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk_ptr), 0);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(disabled_ptr),
|
||||
disabled_);
|
||||
// Atrain spawns a thread 82437FD0 to call this in a tight loop forever.
|
||||
poly::threading::Sleep(std::chrono::milliseconds(10));
|
||||
xe::threading::Sleep(std::chrono::milliseconds(10));
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x00070029: {
|
||||
assert_true(!buffer_length || buffer_length == 16);
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playback_mode_ptr = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t repeat_mode_ptr = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t unk3_ptr = poly::load_and_swap<uint32_t>(buffer + 12);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t playback_mode_ptr = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t repeat_mode_ptr = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t unk3_ptr = xe::load_and_swap<uint32_t>(buffer + 12);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
XELOGD("XMPGetPlaybackBehavior(%.8X, %.8X, %.8X)", playback_mode_ptr,
|
||||
repeat_mode_ptr, unk3_ptr);
|
||||
poly::store_and_swap<uint32_t>(
|
||||
memory_->TranslateVirtual(playback_mode_ptr),
|
||||
static_cast<uint32_t>(playback_mode_));
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(repeat_mode_ptr),
|
||||
static_cast<uint32_t>(repeat_mode_));
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk3_ptr),
|
||||
unknown_flags_);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(playback_mode_ptr),
|
||||
static_cast<uint32_t>(playback_mode_));
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(repeat_mode_ptr),
|
||||
static_cast<uint32_t>(repeat_mode_));
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(unk3_ptr),
|
||||
unknown_flags_);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x0007002E: {
|
||||
assert_true(!buffer_length || buffer_length == 12);
|
||||
// Query of size for XamAlloc - the result of the alloc is passed to
|
||||
// 0x0007000D.
|
||||
uint32_t xmp_client = poly::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t song_count = poly::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t size_ptr = poly::load_and_swap<uint32_t>(buffer + 8);
|
||||
uint32_t xmp_client = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t song_count = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
uint32_t size_ptr = xe::load_and_swap<uint32_t>(buffer + 8);
|
||||
assert_true(xmp_client == 0x00000002);
|
||||
// We don't use the storage, so just fudge the number.
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(size_ptr),
|
||||
song_count * 128);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(size_ptr),
|
||||
song_count * 128);
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
case 0x0007003D: {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -70,7 +70,7 @@ std::wstring ContentManager::ResolvePackageRoot(uint32_t content_type) {
|
||||
// Package root path:
|
||||
// content_root/title_id/type_name/
|
||||
auto package_root =
|
||||
poly::join_paths(root_path_, poly::join_paths(title_id, type_name));
|
||||
xe::join_paths(root_path_, xe::join_paths(title_id, type_name));
|
||||
return package_root + L"\\";
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ std::wstring ContentManager::ResolvePackagePath(const XCONTENT_DATA& data) {
|
||||
// content_root/title_id/type_name/data_file_name/
|
||||
auto package_root = ResolvePackageRoot(data.content_type);
|
||||
auto package_path =
|
||||
poly::join_paths(package_root, poly::to_wstring(data.file_name));
|
||||
package_path += poly::path_separator;
|
||||
xe::join_paths(package_root, xe::to_wstring(data.file_name));
|
||||
package_path += xe::path_separator;
|
||||
return package_path;
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
|
||||
// Search path:
|
||||
// content_root/title_id/type_name/*
|
||||
auto package_root = ResolvePackageRoot(content_type);
|
||||
auto file_infos = poly::fs::ListFiles(package_root);
|
||||
auto file_infos = xe::fs::ListFiles(package_root);
|
||||
for (const auto& file_info : file_infos) {
|
||||
if (file_info.type != poly::fs::FileInfo::Type::kDirectory) {
|
||||
if (file_info.type != xe::fs::FileInfo::Type::kDirectory) {
|
||||
// Directories only.
|
||||
continue;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
|
||||
content_data.device_id = device_id;
|
||||
content_data.content_type = content_type;
|
||||
content_data.display_name = file_info.name;
|
||||
content_data.file_name = poly::to_string(file_info.name);
|
||||
content_data.file_name = xe::to_string(file_info.name);
|
||||
result.emplace_back(std::move(content_data));
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
|
||||
std::unique_ptr<ContentPackage> ContentManager::ResolvePackage(
|
||||
std::string root_name, const XCONTENT_DATA& data) {
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
if (!poly::fs::PathExists(package_path)) {
|
||||
if (!xe::fs::PathExists(package_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ std::unique_ptr<ContentPackage> ContentManager::ResolvePackage(
|
||||
|
||||
bool ContentManager::ContentExists(const XCONTENT_DATA& data) {
|
||||
auto path = ResolvePackagePath(data);
|
||||
return poly::fs::PathExists(path);
|
||||
return xe::fs::PathExists(path);
|
||||
}
|
||||
|
||||
X_RESULT ContentManager::CreateContent(std::string root_name,
|
||||
@@ -137,12 +137,12 @@ X_RESULT ContentManager::CreateContent(std::string root_name,
|
||||
}
|
||||
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
if (poly::fs::PathExists(package_path)) {
|
||||
if (xe::fs::PathExists(package_path)) {
|
||||
// Exists, must not!
|
||||
return X_ERROR_ALREADY_EXISTS;
|
||||
}
|
||||
|
||||
if (!poly::fs::CreateFolder(package_path)) {
|
||||
if (!xe::fs::CreateFolder(package_path)) {
|
||||
return X_ERROR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ X_RESULT ContentManager::OpenContent(std::string root_name,
|
||||
}
|
||||
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
if (!poly::fs::PathExists(package_path)) {
|
||||
if (!xe::fs::PathExists(package_path)) {
|
||||
// Does not exist, must be created.
|
||||
return X_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
@@ -197,8 +197,8 @@ X_RESULT ContentManager::GetContentThumbnail(const XCONTENT_DATA& data,
|
||||
std::vector<uint8_t>* buffer) {
|
||||
std::lock_guard<std::recursive_mutex> lock(content_mutex_);
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
auto thumb_path = poly::join_paths(package_path, kThumbnailFileName);
|
||||
if (poly::fs::PathExists(thumb_path)) {
|
||||
auto thumb_path = xe::join_paths(package_path, kThumbnailFileName);
|
||||
if (xe::fs::PathExists(thumb_path)) {
|
||||
auto file = _wfopen(thumb_path.c_str(), L"rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
size_t file_len = ftell(file);
|
||||
@@ -216,8 +216,8 @@ X_RESULT ContentManager::SetContentThumbnail(const XCONTENT_DATA& data,
|
||||
std::vector<uint8_t> buffer) {
|
||||
std::lock_guard<std::recursive_mutex> lock(content_mutex_);
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
if (poly::fs::PathExists(package_path)) {
|
||||
auto thumb_path = poly::join_paths(package_path, kThumbnailFileName);
|
||||
if (xe::fs::PathExists(package_path)) {
|
||||
auto thumb_path = xe::join_paths(package_path, kThumbnailFileName);
|
||||
auto file = _wfopen(thumb_path.c_str(), L"wb");
|
||||
fwrite(buffer.data(), 1, buffer.size(), file);
|
||||
fclose(file);
|
||||
@@ -231,8 +231,8 @@ X_RESULT ContentManager::DeleteContent(const XCONTENT_DATA& data) {
|
||||
std::lock_guard<std::recursive_mutex> lock(content_mutex_);
|
||||
|
||||
auto package_path = ResolvePackagePath(data);
|
||||
if (poly::fs::PathExists(package_path)) {
|
||||
poly::fs::DeleteFolder(package_path);
|
||||
if (xe::fs::PathExists(package_path)) {
|
||||
xe::fs::DeleteFolder(package_path);
|
||||
return X_ERROR_SUCCESS;
|
||||
} else {
|
||||
return X_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -33,17 +33,17 @@ struct XCONTENT_DATA {
|
||||
|
||||
XCONTENT_DATA() = default;
|
||||
XCONTENT_DATA(const uint8_t* ptr) {
|
||||
device_id = poly::load_and_swap<uint32_t>(ptr + 0);
|
||||
content_type = poly::load_and_swap<uint32_t>(ptr + 4);
|
||||
display_name = poly::load_and_swap<std::wstring>(ptr + 8);
|
||||
file_name = poly::load_and_swap<std::string>(ptr + 8 + 128 * 2);
|
||||
device_id = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
content_type = xe::load_and_swap<uint32_t>(ptr + 4);
|
||||
display_name = xe::load_and_swap<std::wstring>(ptr + 8);
|
||||
file_name = xe::load_and_swap<std::string>(ptr + 8 + 128 * 2);
|
||||
}
|
||||
|
||||
void Write(uint8_t* ptr) {
|
||||
poly::store_and_swap<uint32_t>(ptr + 0, device_id);
|
||||
poly::store_and_swap<uint32_t>(ptr + 4, content_type);
|
||||
poly::store_and_swap<std::wstring>(ptr + 8, display_name);
|
||||
poly::store_and_swap<std::string>(ptr + 8 + 128 * 2, file_name);
|
||||
xe::store_and_swap<uint32_t>(ptr + 0, device_id);
|
||||
xe::store_and_swap<uint32_t>(ptr + 4, content_type);
|
||||
xe::store_and_swap<std::wstring>(ptr + 8, display_name);
|
||||
xe::store_and_swap<std::string>(ptr + 8 + 128 * 2, file_name);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/kernel/fs/devices/disc_image_device.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/fs/gdfx.h"
|
||||
#include "xenia/kernel/fs/devices/disc_image_entry.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -25,8 +25,7 @@ DiscImageDevice::DiscImageDevice(const std::string& path,
|
||||
DiscImageDevice::~DiscImageDevice() { delete gdfx_; }
|
||||
|
||||
int DiscImageDevice::Init() {
|
||||
mmap_ =
|
||||
poly::MappedMemory::Open(local_path_, poly::MappedMemory::Mode::kRead);
|
||||
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
|
||||
if (!mmap_) {
|
||||
XELOGE("Disc image could not be mapped");
|
||||
return 1;
|
||||
@@ -54,7 +53,7 @@ std::unique_ptr<Entry> DiscImageDevice::ResolvePath(const char* path) {
|
||||
GDFXEntry* gdfx_entry = gdfx_->root_entry();
|
||||
|
||||
// Walk the path, one separator at a time.
|
||||
auto path_parts = poly::split_path(path);
|
||||
auto path_parts = xe::split_path(path);
|
||||
for (auto& part : path_parts) {
|
||||
gdfx_entry = gdfx_entry->GetChild(part.c_str());
|
||||
if (!gdfx_entry) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/device.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -33,7 +33,7 @@ class DiscImageDevice : public Device {
|
||||
|
||||
private:
|
||||
std::wstring local_path_;
|
||||
std::unique_ptr<poly::MappedMemory> mmap_;
|
||||
std::unique_ptr<MappedMemory> mmap_;
|
||||
GDFX* gdfx_;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class DiscImageMemoryMapping : public MemoryMapping {
|
||||
};
|
||||
|
||||
DiscImageEntry::DiscImageEntry(Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
||||
MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
gdfx_entry_(gdfx_entry),
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/entry.h"
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/kernel/fs/gdfx.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -23,11 +23,11 @@ namespace fs {
|
||||
|
||||
class DiscImageEntry : public Entry {
|
||||
public:
|
||||
DiscImageEntry(Device* device, const char* path, poly::MappedMemory* mmap,
|
||||
DiscImageEntry(Device* device, const char* path, MappedMemory* mmap,
|
||||
GDFXEntry* gdfx_entry);
|
||||
~DiscImageEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
MappedMemory* mmap() const { return mmap_; }
|
||||
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
|
||||
|
||||
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||
@@ -42,10 +42,10 @@ class DiscImageEntry : public Entry {
|
||||
XFile** out_file) override;
|
||||
|
||||
private:
|
||||
poly::MappedMemory* mmap_;
|
||||
MappedMemory* mmap_;
|
||||
GDFXEntry* gdfx_entry_;
|
||||
|
||||
poly::fs::WildcardEngine find_engine_;
|
||||
xe::fs::WildcardEngine find_engine_;
|
||||
GDFXEntry::child_it_t it_;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/kernel/fs/devices/host_path_device.h"
|
||||
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/kernel/fs/devices/host_path_entry.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -31,13 +31,13 @@ std::unique_ptr<Entry> HostPathDevice::ResolvePath(const char* path) {
|
||||
|
||||
XELOGFS("HostPathDevice::ResolvePath(%s)", path);
|
||||
|
||||
auto rel_path = poly::to_wstring(path);
|
||||
auto full_path = poly::join_paths(local_path_, rel_path);
|
||||
full_path = poly::fix_path_separators(full_path);
|
||||
auto rel_path = xe::to_wstring(path);
|
||||
auto full_path = xe::join_paths(local_path_, rel_path);
|
||||
full_path = xe::fix_path_separators(full_path);
|
||||
|
||||
// Only check the file exists when the device is read-only
|
||||
if (read_only_) {
|
||||
if (!poly::fs::PathExists(full_path)) {
|
||||
if (!xe::fs::PathExists(full_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/kernel/fs/devices/host_path_entry.h"
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/fs/devices/host_path_file.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -19,11 +19,11 @@ namespace fs {
|
||||
|
||||
class HostPathMemoryMapping : public MemoryMapping {
|
||||
public:
|
||||
HostPathMemoryMapping(std::unique_ptr<poly::MappedMemory> mmap)
|
||||
HostPathMemoryMapping(std::unique_ptr<MappedMemory> mmap)
|
||||
: MemoryMapping(mmap->data(), mmap->size()), mmap_(std::move(mmap)) {}
|
||||
|
||||
private:
|
||||
std::unique_ptr<poly::MappedMemory> mmap_;
|
||||
std::unique_ptr<MappedMemory> mmap_;
|
||||
};
|
||||
|
||||
HostPathEntry::HostPathEntry(Device* device, const char* path,
|
||||
@@ -75,9 +75,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
std::wstring target_path = local_path_;
|
||||
if (!file_name) {
|
||||
target_path = poly::join_paths(target_path, L"*");
|
||||
target_path = xe::join_paths(target_path, L"*");
|
||||
} else {
|
||||
target_path = poly::join_paths(target_path, poly::to_wstring(file_name));
|
||||
target_path = xe::join_paths(target_path, xe::to_wstring(file_name));
|
||||
}
|
||||
handle = find_file_ = FindFirstFile(target_path.c_str(), &ffd);
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
@@ -124,10 +124,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||
|
||||
std::unique_ptr<MemoryMapping> HostPathEntry::CreateMemoryMapping(
|
||||
Mode map_mode, const size_t offset, const size_t length) {
|
||||
auto mmap = poly::MappedMemory::Open(
|
||||
local_path_,
|
||||
map_mode == Mode::READ ? poly::MappedMemory::Mode::kRead
|
||||
: poly::MappedMemory::Mode::kReadWrite,
|
||||
auto mmap = MappedMemory::Open(
|
||||
local_path_, map_mode == Mode::READ ? MappedMemory::Mode::kRead
|
||||
: MappedMemory::Mode::kReadWrite,
|
||||
offset, length);
|
||||
if (!mmap) {
|
||||
return nullptr;
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/kernel/fs/devices/stfs_container_device.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/fs/stfs.h"
|
||||
#include "xenia/kernel/fs/devices/stfs_container_entry.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -26,8 +26,7 @@ STFSContainerDevice::STFSContainerDevice(const std::string& path,
|
||||
STFSContainerDevice::~STFSContainerDevice() { delete stfs_; }
|
||||
|
||||
int STFSContainerDevice::Init() {
|
||||
mmap_ =
|
||||
poly::MappedMemory::Open(local_path_, poly::MappedMemory::Mode::kRead);
|
||||
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
|
||||
if (!mmap_) {
|
||||
XELOGE("STFS container could not be mapped");
|
||||
return 1;
|
||||
@@ -55,7 +54,7 @@ std::unique_ptr<Entry> STFSContainerDevice::ResolvePath(const char* path) {
|
||||
STFSEntry* stfs_entry = stfs_->root_entry();
|
||||
|
||||
// Walk the path, one separator at a time.
|
||||
auto path_parts = poly::split_path(path);
|
||||
auto path_parts = xe::split_path(path);
|
||||
for (auto& part : path_parts) {
|
||||
stfs_entry = stfs_entry->GetChild(part.c_str());
|
||||
if (!stfs_entry) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/device.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -33,7 +33,7 @@ class STFSContainerDevice : public Device {
|
||||
|
||||
private:
|
||||
std::wstring local_path_;
|
||||
std::unique_ptr<poly::MappedMemory> mmap_;
|
||||
std::unique_ptr<MappedMemory> mmap_;
|
||||
STFS* stfs_;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,13 +16,12 @@ namespace kernel {
|
||||
namespace fs {
|
||||
|
||||
STFSContainerEntry::STFSContainerEntry(Device* device, const char* path,
|
||||
poly::MappedMemory* mmap,
|
||||
MappedMemory* mmap,
|
||||
STFSEntry* stfs_entry)
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
stfs_entry_(stfs_entry),
|
||||
it_(stfs_entry_->children.end())
|
||||
{ }
|
||||
it_(stfs_entry_->children.end()) {}
|
||||
|
||||
STFSContainerEntry::~STFSContainerEntry() = default;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/entry.h"
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/kernel/fs/stfs.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -24,11 +24,11 @@ namespace fs {
|
||||
|
||||
class STFSContainerEntry : public Entry {
|
||||
public:
|
||||
STFSContainerEntry(Device* device, const char* path, poly::MappedMemory* mmap,
|
||||
STFSContainerEntry(Device* device, const char* path, MappedMemory* mmap,
|
||||
STFSEntry* stfs_entry);
|
||||
~STFSContainerEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
MappedMemory* mmap() const { return mmap_; }
|
||||
STFSEntry* stfs_entry() const { return stfs_entry_; }
|
||||
|
||||
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||
@@ -39,10 +39,10 @@ class STFSContainerEntry : public Entry {
|
||||
XFile** out_file) override;
|
||||
|
||||
private:
|
||||
poly::MappedMemory* mmap_;
|
||||
MappedMemory* mmap_;
|
||||
STFSEntry* stfs_entry_;
|
||||
|
||||
poly::fs::WildcardEngine find_engine_;
|
||||
|
||||
xe::fs::WildcardEngine find_engine_;
|
||||
STFSEntry::child_it_t it_;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/kernel/fs/entry.h"
|
||||
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/fs/device.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -25,7 +25,7 @@ Entry::Entry(Device* device, const std::string& path)
|
||||
: device_(device), path_(path) {
|
||||
assert_not_null(device);
|
||||
absolute_path_ = device->path() + path;
|
||||
name_ = poly::find_name_from_path(path);
|
||||
name_ = xe::find_name_from_path(path);
|
||||
}
|
||||
|
||||
Entry::~Entry() = default;
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include "xenia/kernel/fs/filesystem.h"
|
||||
|
||||
#include "poly/fs.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/fs/devices/disc_image_device.h"
|
||||
#include "xenia/kernel/fs/devices/host_path_device.h"
|
||||
#include "xenia/kernel/fs/devices/stfs_container_device.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -34,7 +34,7 @@ FileSystem::~FileSystem() {
|
||||
}
|
||||
|
||||
fs::FileSystemType FileSystem::InferType(const std::wstring& local_path) {
|
||||
auto last_slash = local_path.find_last_of(poly::path_separator);
|
||||
auto last_slash = local_path.find_last_of(xe::path_separator);
|
||||
auto last_dot = local_path.find_last_of('.');
|
||||
if (last_dot < last_slash) {
|
||||
last_dot = std::wstring::npos;
|
||||
@@ -71,7 +71,7 @@ int FileSystem::InitializeFromPath(fs::FileSystemType type,
|
||||
}
|
||||
case FileSystemType::XEX_FILE: {
|
||||
// Get the parent path of the file.
|
||||
auto last_slash = local_path.find_last_of(poly::path_separator);
|
||||
auto last_slash = local_path.find_last_of(xe::path_separator);
|
||||
std::wstring parent_path = local_path.substr(0, last_slash);
|
||||
|
||||
// Register the local directory in the virtual filesystem.
|
||||
@@ -151,7 +151,7 @@ int FileSystem::DeleteSymbolicLink(const std::string& path) {
|
||||
|
||||
std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
|
||||
// Resolve relative paths
|
||||
std::string normalized_path(poly::fs::CanonicalizePath(path));
|
||||
std::string normalized_path(xe::fs::CanonicalizePath(path));
|
||||
|
||||
// If no path (starts with a slash) do it module-relative.
|
||||
// Which for now, we just make game:.
|
||||
@@ -164,7 +164,7 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
|
||||
// drive path -> device mappings with nothing nested.
|
||||
std::string full_path = normalized_path;
|
||||
for (const auto& it : symlinks_) {
|
||||
if (poly::find_first_of_case(normalized_path, it.first) == 0) {
|
||||
if (xe::find_first_of_case(normalized_path, it.first) == 0) {
|
||||
// Found symlink, fixup by replacing the prefix.
|
||||
full_path = it.second + full_path.substr(it.first.size());
|
||||
break;
|
||||
@@ -173,7 +173,7 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
|
||||
|
||||
// Scan all devices.
|
||||
for (auto& device : devices_) {
|
||||
if (poly::find_first_of_case(full_path, device->path()) == 0) {
|
||||
if (xe::find_first_of_case(full_path, device->path()) == 0) {
|
||||
// Found! Trim the device prefix off and pass down.
|
||||
auto device_path = full_path.substr(device->path().size());
|
||||
return device->ResolvePath(device_path.c_str());
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "xenia/kernel/fs/gdfx.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -29,8 +29,8 @@ GDFXEntry::~GDFXEntry() {
|
||||
}
|
||||
}
|
||||
|
||||
GDFXEntry* GDFXEntry::GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it)
|
||||
{
|
||||
GDFXEntry* GDFXEntry::GetChild(const xe::fs::WildcardEngine& engine,
|
||||
child_it_t& ref_it) {
|
||||
GDFXEntry* child_entry(nullptr);
|
||||
while (ref_it != children.end()) {
|
||||
if (engine.Match((*ref_it)->name)) {
|
||||
@@ -64,7 +64,7 @@ void GDFXEntry::Dump(int indent) {
|
||||
}
|
||||
}
|
||||
|
||||
GDFX::GDFX(poly::MappedMemory* mmap) : mmap_(mmap) { root_entry_ = nullptr; }
|
||||
GDFX::GDFX(MappedMemory* mmap) : mmap_(mmap) { root_entry_ = nullptr; }
|
||||
|
||||
GDFX::~GDFX() { delete root_entry_; }
|
||||
|
||||
@@ -101,7 +101,7 @@ GDFX::Error GDFX::Verify(ParseState& state) {
|
||||
0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000,
|
||||
};
|
||||
bool magic_found = false;
|
||||
for (size_t n = 0; n < poly::countof(likely_offsets); n++) {
|
||||
for (size_t n = 0; n < xe::countof(likely_offsets); n++) {
|
||||
state.game_offset = likely_offsets[n];
|
||||
if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) {
|
||||
magic_found = true;
|
||||
@@ -118,8 +118,8 @@ GDFX::Error GDFX::Verify(ParseState& state) {
|
||||
return kErrorReadError;
|
||||
}
|
||||
uint8_t* fs_ptr = state.ptr + state.game_offset + (32 * kXESectorSize);
|
||||
state.root_sector = poly::load<uint32_t>(fs_ptr + 20);
|
||||
state.root_size = poly::load<uint32_t>(fs_ptr + 24);
|
||||
state.root_sector = xe::load<uint32_t>(fs_ptr + 20);
|
||||
state.root_size = xe::load<uint32_t>(fs_ptr + 24);
|
||||
state.root_offset = state.game_offset + (state.root_sector * kXESectorSize);
|
||||
if (state.root_size < 13 || state.root_size > 32 * 1024 * 1024) {
|
||||
return kErrorDamagedFile;
|
||||
@@ -152,12 +152,12 @@ bool GDFX::ReadEntry(ParseState& state, const uint8_t* buffer,
|
||||
uint16_t entry_ordinal, GDFXEntry* parent) {
|
||||
const uint8_t* p = buffer + (entry_ordinal * 4);
|
||||
|
||||
uint16_t node_l = poly::load<uint16_t>(p + 0);
|
||||
uint16_t node_r = poly::load<uint16_t>(p + 2);
|
||||
size_t sector = poly::load<uint32_t>(p + 4);
|
||||
size_t length = poly::load<uint32_t>(p + 8);
|
||||
uint8_t attributes = poly::load<uint8_t>(p + 12);
|
||||
uint8_t name_length = poly::load<uint8_t>(p + 13);
|
||||
uint16_t node_l = xe::load<uint16_t>(p + 0);
|
||||
uint16_t node_r = xe::load<uint16_t>(p + 2);
|
||||
size_t sector = xe::load<uint32_t>(p + 4);
|
||||
size_t length = xe::load<uint32_t>(p + 8);
|
||||
uint8_t attributes = xe::load<uint8_t>(p + 12);
|
||||
uint8_t name_length = xe::load<uint8_t>(p + 13);
|
||||
char* name = (char*)(p + 14);
|
||||
|
||||
if (node_l && !ReadEntry(state, buffer, node_l, parent)) {
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/entry.h"
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -31,7 +31,7 @@ class GDFXEntry {
|
||||
typedef std::vector<GDFXEntry*> child_t;
|
||||
typedef child_t::iterator child_it_t;
|
||||
|
||||
GDFXEntry* GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it);
|
||||
GDFXEntry* GetChild(const xe::fs::WildcardEngine& engine, child_it_t& ref_it);
|
||||
GDFXEntry* GetChild(const char* name);
|
||||
|
||||
void Dump(int indent);
|
||||
@@ -53,7 +53,7 @@ class GDFX {
|
||||
kErrorDamagedFile = -31,
|
||||
};
|
||||
|
||||
GDFX(poly::MappedMemory* mmap);
|
||||
GDFX(MappedMemory* mmap);
|
||||
virtual ~GDFX();
|
||||
|
||||
GDFXEntry* root_entry();
|
||||
@@ -85,7 +85,7 @@ class GDFX {
|
||||
bool ReadEntry(ParseState& state, const uint8_t* buffer,
|
||||
uint16_t entry_ordinal, GDFXEntry* parent);
|
||||
|
||||
poly::MappedMemory* mmap_;
|
||||
MappedMemory* mmap_;
|
||||
|
||||
GDFXEntry* root_entry_;
|
||||
};
|
||||
|
||||
@@ -13,64 +13,64 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace fs {
|
||||
|
||||
#define XEGETUINT24BE(p) \
|
||||
(((uint32_t)poly::load_and_swap<uint8_t>((p)+0) << 16) | \
|
||||
((uint32_t)poly::load_and_swap<uint8_t>((p)+1) << 8) | \
|
||||
(uint32_t)poly::load_and_swap<uint8_t>((p)+2))
|
||||
#define XEGETUINT24LE(p) \
|
||||
(((uint32_t)poly::load<uint8_t>((p)+2) << 16) | \
|
||||
((uint32_t)poly::load<uint8_t>((p)+1) << 8) | \
|
||||
(uint32_t)poly::load<uint8_t>((p)+0))
|
||||
#define XEGETUINT24BE(p) \
|
||||
(((uint32_t)xe::load_and_swap<uint8_t>((p)+0) << 16) | \
|
||||
((uint32_t)xe::load_and_swap<uint8_t>((p)+1) << 8) | \
|
||||
(uint32_t)xe::load_and_swap<uint8_t>((p)+2))
|
||||
#define XEGETUINT24LE(p) \
|
||||
(((uint32_t)xe::load<uint8_t>((p)+2) << 16) | \
|
||||
((uint32_t)xe::load<uint8_t>((p)+1) << 8) | \
|
||||
(uint32_t)xe::load<uint8_t>((p)+0))
|
||||
|
||||
bool STFSVolumeDescriptor::Read(const uint8_t* p) {
|
||||
descriptor_size = poly::load_and_swap<uint8_t>(p + 0x00);
|
||||
descriptor_size = xe::load_and_swap<uint8_t>(p + 0x00);
|
||||
if (descriptor_size != 0x24) {
|
||||
XELOGE("STFS volume descriptor size mismatch, expected 0x24 but got 0x%X",
|
||||
descriptor_size);
|
||||
return false;
|
||||
}
|
||||
reserved = poly::load_and_swap<uint8_t>(p + 0x01);
|
||||
block_separation = poly::load_and_swap<uint8_t>(p + 0x02);
|
||||
file_table_block_count = poly::load_and_swap<uint16_t>(p + 0x03);
|
||||
reserved = xe::load_and_swap<uint8_t>(p + 0x01);
|
||||
block_separation = xe::load_and_swap<uint8_t>(p + 0x02);
|
||||
file_table_block_count = xe::load_and_swap<uint16_t>(p + 0x03);
|
||||
file_table_block_number = XEGETUINT24BE(p + 0x05);
|
||||
memcpy(top_hash_table_hash, p + 0x08, 0x14);
|
||||
total_allocated_block_count = poly::load_and_swap<uint32_t>(p + 0x1C);
|
||||
total_unallocated_block_count = poly::load_and_swap<uint32_t>(p + 0x20);
|
||||
total_allocated_block_count = xe::load_and_swap<uint32_t>(p + 0x1C);
|
||||
total_unallocated_block_count = xe::load_and_swap<uint32_t>(p + 0x20);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool STFSHeader::Read(const uint8_t* p) {
|
||||
memcpy(license_entries, p + 0x22C, 0x100);
|
||||
memcpy(header_hash, p + 0x32C, 0x14);
|
||||
header_size = poly::load_and_swap<uint32_t>(p + 0x340);
|
||||
content_type = (STFSContentType)poly::load_and_swap<uint32_t>(p + 0x344);
|
||||
metadata_version = poly::load_and_swap<uint32_t>(p + 0x348);
|
||||
header_size = xe::load_and_swap<uint32_t>(p + 0x340);
|
||||
content_type = (STFSContentType)xe::load_and_swap<uint32_t>(p + 0x344);
|
||||
metadata_version = xe::load_and_swap<uint32_t>(p + 0x348);
|
||||
if (metadata_version > 1) {
|
||||
// This is a variant of thumbnail data/etc.
|
||||
// Can just ignore it for now (until we parse thumbnails).
|
||||
XELOGW("STFSContainer doesn't support version %d yet", metadata_version);
|
||||
}
|
||||
content_size = poly::load_and_swap<uint32_t>(p + 0x34C);
|
||||
media_id = poly::load_and_swap<uint32_t>(p + 0x354);
|
||||
version = poly::load_and_swap<uint32_t>(p + 0x358);
|
||||
base_version = poly::load_and_swap<uint32_t>(p + 0x35C);
|
||||
title_id = poly::load_and_swap<uint32_t>(p + 0x360);
|
||||
platform = (STFSPlatform)poly::load_and_swap<uint8_t>(p + 0x364);
|
||||
executable_type = poly::load_and_swap<uint8_t>(p + 0x365);
|
||||
disc_number = poly::load_and_swap<uint8_t>(p + 0x366);
|
||||
disc_in_set = poly::load_and_swap<uint8_t>(p + 0x367);
|
||||
save_game_id = poly::load_and_swap<uint32_t>(p + 0x368);
|
||||
content_size = xe::load_and_swap<uint32_t>(p + 0x34C);
|
||||
media_id = xe::load_and_swap<uint32_t>(p + 0x354);
|
||||
version = xe::load_and_swap<uint32_t>(p + 0x358);
|
||||
base_version = xe::load_and_swap<uint32_t>(p + 0x35C);
|
||||
title_id = xe::load_and_swap<uint32_t>(p + 0x360);
|
||||
platform = (STFSPlatform)xe::load_and_swap<uint8_t>(p + 0x364);
|
||||
executable_type = xe::load_and_swap<uint8_t>(p + 0x365);
|
||||
disc_number = xe::load_and_swap<uint8_t>(p + 0x366);
|
||||
disc_in_set = xe::load_and_swap<uint8_t>(p + 0x367);
|
||||
save_game_id = xe::load_and_swap<uint32_t>(p + 0x368);
|
||||
memcpy(console_id, p + 0x36C, 0x5);
|
||||
memcpy(profile_id, p + 0x371, 0x8);
|
||||
data_file_count = poly::load_and_swap<uint32_t>(p + 0x39D);
|
||||
data_file_combined_size = poly::load_and_swap<uint64_t>(p + 0x3A1);
|
||||
descriptor_type = (STFSDescriptorType)poly::load_and_swap<uint8_t>(p + 0x3A9);
|
||||
data_file_count = xe::load_and_swap<uint32_t>(p + 0x39D);
|
||||
data_file_combined_size = xe::load_and_swap<uint64_t>(p + 0x3A1);
|
||||
descriptor_type = (STFSDescriptorType)xe::load_and_swap<uint8_t>(p + 0x3A9);
|
||||
if (descriptor_type != STFS_DESCRIPTOR_STFS) {
|
||||
XELOGE("STFS descriptor format not supported: %d", descriptor_type);
|
||||
return false;
|
||||
@@ -80,16 +80,16 @@ bool STFSHeader::Read(const uint8_t* p) {
|
||||
}
|
||||
memcpy(device_id, p + 0x3FD, 0x14);
|
||||
for (size_t n = 0; n < 0x900 / 2; n++) {
|
||||
display_names[n] = poly::load_and_swap<uint16_t>(p + 0x411 + n * 2);
|
||||
display_descs[n] = poly::load_and_swap<uint16_t>(p + 0xD11 + n * 2);
|
||||
display_names[n] = xe::load_and_swap<uint16_t>(p + 0x411 + n * 2);
|
||||
display_descs[n] = xe::load_and_swap<uint16_t>(p + 0xD11 + n * 2);
|
||||
}
|
||||
for (size_t n = 0; n < 0x80 / 2; n++) {
|
||||
publisher_name[n] = poly::load_and_swap<uint16_t>(p + 0x1611 + n * 2);
|
||||
title_name[n] = poly::load_and_swap<uint16_t>(p + 0x1691 + n * 2);
|
||||
publisher_name[n] = xe::load_and_swap<uint16_t>(p + 0x1611 + n * 2);
|
||||
title_name[n] = xe::load_and_swap<uint16_t>(p + 0x1691 + n * 2);
|
||||
}
|
||||
transfer_flags = poly::load_and_swap<uint8_t>(p + 0x1711);
|
||||
thumbnail_image_size = poly::load_and_swap<uint32_t>(p + 0x1712);
|
||||
title_thumbnail_image_size = poly::load_and_swap<uint32_t>(p + 0x1716);
|
||||
transfer_flags = xe::load_and_swap<uint8_t>(p + 0x1711);
|
||||
thumbnail_image_size = xe::load_and_swap<uint32_t>(p + 0x1712);
|
||||
title_thumbnail_image_size = xe::load_and_swap<uint32_t>(p + 0x1716);
|
||||
memcpy(thumbnail_image, p + 0x171A, 0x4000);
|
||||
memcpy(title_thumbnail_image, p + 0x571A, 0x4000);
|
||||
return true;
|
||||
@@ -102,8 +102,8 @@ STFSEntry::STFSEntry()
|
||||
update_timestamp(0),
|
||||
access_timestamp(0) {}
|
||||
|
||||
STFSEntry* STFSEntry::GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it)
|
||||
{
|
||||
STFSEntry* STFSEntry::GetChild(const xe::fs::WildcardEngine& engine,
|
||||
child_it_t& ref_it) {
|
||||
STFSEntry* child_entry(nullptr);
|
||||
while (ref_it != children.end()) {
|
||||
if (engine.Match((*ref_it)->name)) {
|
||||
@@ -133,7 +133,7 @@ void STFSEntry::Dump(int indent) {
|
||||
}
|
||||
}
|
||||
|
||||
STFS::STFS(poly::MappedMemory* mmap) : mmap_(mmap) {}
|
||||
STFS::STFS(MappedMemory* mmap) : mmap_(mmap) {}
|
||||
|
||||
STFS::~STFS() {}
|
||||
|
||||
@@ -204,13 +204,13 @@ STFS::Error STFS::ReadAllEntries(const uint8_t* map_ptr) {
|
||||
// Done.
|
||||
break;
|
||||
}
|
||||
uint8_t filename_length_flags = poly::load_and_swap<uint8_t>(p + 0x28);
|
||||
uint8_t filename_length_flags = xe::load_and_swap<uint8_t>(p + 0x28);
|
||||
uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29);
|
||||
uint32_t start_block_index = XEGETUINT24LE(p + 0x2F);
|
||||
uint16_t path_indicator = poly::load_and_swap<uint16_t>(p + 0x32);
|
||||
uint32_t file_size = poly::load_and_swap<uint32_t>(p + 0x34);
|
||||
uint32_t update_timestamp = poly::load_and_swap<uint32_t>(p + 0x38);
|
||||
uint32_t access_timestamp = poly::load_and_swap<uint32_t>(p + 0x3C);
|
||||
uint16_t path_indicator = xe::load_and_swap<uint16_t>(p + 0x32);
|
||||
uint32_t file_size = xe::load_and_swap<uint32_t>(p + 0x34);
|
||||
uint32_t update_timestamp = xe::load_and_swap<uint32_t>(p + 0x38);
|
||||
uint32_t access_timestamp = xe::load_and_swap<uint32_t>(p + 0x3C);
|
||||
p += 0x40;
|
||||
|
||||
auto entry = std::make_unique<STFSEntry>();
|
||||
@@ -335,7 +335,7 @@ STFS::BlockHash_t STFS::GetBlockHash(const uint8_t* map_ptr,
|
||||
// table_index += table_offset - (1 << table_size_shift_);
|
||||
const uint8_t* hash_data = map_ptr + BlockToOffset(table_index);
|
||||
const uint8_t* record_data = hash_data + record * 0x18;
|
||||
uint32_t info = poly::load_and_swap<uint8_t>(record_data + 0x14);
|
||||
uint32_t info = xe::load_and_swap<uint8_t>(record_data + 0x14);
|
||||
uint32_t next_block_index = XEGETUINT24BE(record_data + 0x15);
|
||||
return {next_block_index, info};
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/mapped_memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
#include "xenia/base/fs.h"
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/kernel/fs/entry.h"
|
||||
#include "poly/fs.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -134,7 +134,7 @@ class STFSEntry {
|
||||
typedef std::vector<std::unique_ptr<STFSEntry>> child_t;
|
||||
typedef child_t::iterator child_it_t;
|
||||
|
||||
STFSEntry* GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it);
|
||||
STFSEntry* GetChild(const xe::fs::WildcardEngine& engine, child_it_t& ref_it);
|
||||
STFSEntry* GetChild(const char* name);
|
||||
|
||||
void Dump(int indent);
|
||||
@@ -164,7 +164,7 @@ class STFS {
|
||||
kErrorDamagedFile = -31,
|
||||
};
|
||||
|
||||
STFS(poly::MappedMemory* mmap);
|
||||
STFS(MappedMemory* mmap);
|
||||
virtual ~STFS();
|
||||
|
||||
const STFSHeader* header() const { return &header_; }
|
||||
@@ -186,7 +186,7 @@ class STFS {
|
||||
BlockHash_t GetBlockHash(const uint8_t* map_ptr, uint32_t block_index,
|
||||
uint32_t table_offset);
|
||||
|
||||
poly::MappedMemory* mmap_;
|
||||
MappedMemory* mmap_;
|
||||
|
||||
STFSPackageType package_type_;
|
||||
STFSHeader header_;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/dispatcher.h"
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
@@ -52,8 +52,8 @@ KernelState::KernelState(Emulator* emulator)
|
||||
app_manager_ = std::make_unique<XAppManager>();
|
||||
user_profile_ = std::make_unique<UserProfile>();
|
||||
|
||||
auto content_root = poly::to_wstring(FLAGS_content_root);
|
||||
content_root = poly::to_absolute_path(content_root);
|
||||
auto content_root = xe::to_wstring(FLAGS_content_root);
|
||||
content_root = xe::to_absolute_path(content_root);
|
||||
content_manager_ = std::make_unique<ContentManager>(this, content_root);
|
||||
|
||||
object_table_ = new ObjectTable();
|
||||
|
||||
@@ -16,44 +16,42 @@ NativeList::NativeList(Memory* memory)
|
||||
: memory_(memory), head_(kInvalidPointer) {}
|
||||
|
||||
void NativeList::Insert(uint32_t ptr) {
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0), head_);
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4), 0);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0), head_);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4), 0);
|
||||
if (head_) {
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(head_ + 4), ptr);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(head_ + 4), ptr);
|
||||
}
|
||||
head_ = ptr;
|
||||
}
|
||||
|
||||
bool NativeList::IsQueued(uint32_t ptr) {
|
||||
uint32_t flink =
|
||||
poly::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0));
|
||||
xe::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0));
|
||||
uint32_t blink =
|
||||
poly::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4));
|
||||
xe::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4));
|
||||
return head_ == ptr || flink || blink;
|
||||
}
|
||||
|
||||
void NativeList::Remove(uint32_t ptr) {
|
||||
uint32_t flink =
|
||||
poly::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0));
|
||||
xe::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0));
|
||||
uint32_t blink =
|
||||
poly::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4));
|
||||
xe::load_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4));
|
||||
if (ptr == head_) {
|
||||
head_ = flink;
|
||||
if (flink) {
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(flink + 4), 0);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(flink + 4), 0);
|
||||
}
|
||||
} else {
|
||||
if (blink) {
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(blink + 0),
|
||||
flink);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(blink + 0), flink);
|
||||
}
|
||||
if (flink) {
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(flink + 4),
|
||||
blink);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(flink + 4), blink);
|
||||
}
|
||||
}
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0), 0);
|
||||
poly::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4), 0);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 0), 0);
|
||||
xe::store_and_swap<uint32_t>(memory_->TranslateVirtual(ptr + 4), 0);
|
||||
}
|
||||
|
||||
uint32_t NativeList::Shift() {
|
||||
|
||||
@@ -32,14 +32,14 @@ class XFileInfo {
|
||||
X_FILE_ATTRIBUTES attributes;
|
||||
|
||||
void Write(uint8_t* base, uint32_t p) {
|
||||
poly::store_and_swap<uint64_t>(base + p, creation_time);
|
||||
poly::store_and_swap<uint64_t>(base + p + 8, last_access_time);
|
||||
poly::store_and_swap<uint64_t>(base + p + 16, last_write_time);
|
||||
poly::store_and_swap<uint64_t>(base + p + 24, change_time);
|
||||
poly::store_and_swap<uint64_t>(base + p + 32, allocation_size);
|
||||
poly::store_and_swap<uint64_t>(base + p + 40, file_length);
|
||||
poly::store_and_swap<uint32_t>(base + p + 48, attributes);
|
||||
poly::store_and_swap<uint32_t>(base + p + 52, 0); // pad
|
||||
xe::store_and_swap<uint64_t>(base + p, creation_time);
|
||||
xe::store_and_swap<uint64_t>(base + p + 8, last_access_time);
|
||||
xe::store_and_swap<uint64_t>(base + p + 16, last_write_time);
|
||||
xe::store_and_swap<uint64_t>(base + p + 24, change_time);
|
||||
xe::store_and_swap<uint64_t>(base + p + 32, allocation_size);
|
||||
xe::store_and_swap<uint64_t>(base + p + 40, file_length);
|
||||
xe::store_and_swap<uint32_t>(base + p + 48, attributes);
|
||||
xe::store_and_swap<uint32_t>(base + p + 52, 0); // pad
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,16 +64,16 @@ class XDirectoryInfo {
|
||||
XDirectoryInfo* info;
|
||||
do {
|
||||
info = (XDirectoryInfo*)src;
|
||||
poly::store_and_swap<uint32_t>(dst, info->next_entry_offset);
|
||||
poly::store_and_swap<uint32_t>(dst + 4, info->file_index);
|
||||
poly::store_and_swap<uint64_t>(dst + 8, info->creation_time);
|
||||
poly::store_and_swap<uint64_t>(dst + 16, info->last_access_time);
|
||||
poly::store_and_swap<uint64_t>(dst + 24, info->last_write_time);
|
||||
poly::store_and_swap<uint64_t>(dst + 32, info->change_time);
|
||||
poly::store_and_swap<uint64_t>(dst + 40, info->end_of_file);
|
||||
poly::store_and_swap<uint64_t>(dst + 48, info->allocation_size);
|
||||
poly::store_and_swap<uint32_t>(dst + 56, info->attributes);
|
||||
poly::store_and_swap<uint32_t>(dst + 60, info->file_name_length);
|
||||
xe::store_and_swap<uint32_t>(dst, info->next_entry_offset);
|
||||
xe::store_and_swap<uint32_t>(dst + 4, info->file_index);
|
||||
xe::store_and_swap<uint64_t>(dst + 8, info->creation_time);
|
||||
xe::store_and_swap<uint64_t>(dst + 16, info->last_access_time);
|
||||
xe::store_and_swap<uint64_t>(dst + 24, info->last_write_time);
|
||||
xe::store_and_swap<uint64_t>(dst + 32, info->change_time);
|
||||
xe::store_and_swap<uint64_t>(dst + 40, info->end_of_file);
|
||||
xe::store_and_swap<uint64_t>(dst + 48, info->allocation_size);
|
||||
xe::store_and_swap<uint32_t>(dst + 56, info->attributes);
|
||||
xe::store_and_swap<uint32_t>(dst + 60, info->file_name_length);
|
||||
memcpy(dst + 64, info->file_name, info->file_name_length);
|
||||
dst += info->next_entry_offset;
|
||||
src += info->next_entry_offset;
|
||||
@@ -94,10 +94,10 @@ class XVolumeInfo {
|
||||
|
||||
void Write(uint8_t* base, uint32_t p) {
|
||||
uint8_t* dst = base + p;
|
||||
poly::store_and_swap<uint64_t>(dst + 0, this->creation_time);
|
||||
poly::store_and_swap<uint32_t>(dst + 8, this->serial_number);
|
||||
poly::store_and_swap<uint32_t>(dst + 12, this->label_length);
|
||||
poly::store_and_swap<uint32_t>(dst + 16, this->supports_objects);
|
||||
xe::store_and_swap<uint64_t>(dst + 0, this->creation_time);
|
||||
xe::store_and_swap<uint32_t>(dst + 8, this->serial_number);
|
||||
xe::store_and_swap<uint32_t>(dst + 12, this->label_length);
|
||||
xe::store_and_swap<uint32_t>(dst + 16, this->supports_objects);
|
||||
memcpy(dst + 20, this->label, this->label_length);
|
||||
}
|
||||
};
|
||||
@@ -114,10 +114,9 @@ class XFileSystemAttributeInfo {
|
||||
|
||||
void Write(uint8_t* base, uint32_t p) {
|
||||
uint8_t* dst = base + p;
|
||||
poly::store_and_swap<uint32_t>(dst + 0, this->attributes);
|
||||
poly::store_and_swap<uint32_t>(dst + 4,
|
||||
this->maximum_component_name_length);
|
||||
poly::store_and_swap<uint32_t>(dst + 8, this->fs_name_length);
|
||||
xe::store_and_swap<uint32_t>(dst + 0, this->attributes);
|
||||
xe::store_and_swap<uint32_t>(dst + 4, this->maximum_component_name_length);
|
||||
xe::store_and_swap<uint32_t>(dst + 8, this->fs_name_length);
|
||||
memcpy(dst + 12, this->fs_name, this->fs_name_length);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/kernel/objects/xkernel_module.h"
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "poly/threading.h"
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/threading.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/kernel/native_list.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -113,7 +113,7 @@ uint32_t XThread::GetCurrentThreadHandle() {
|
||||
}
|
||||
|
||||
uint32_t XThread::GetCurrentThreadId(const uint8_t* thread_state_block) {
|
||||
return poly::load_and_swap<uint32_t>(thread_state_block + 0x14C);
|
||||
return xe::load_and_swap<uint32_t>(thread_state_block + 0x14C);
|
||||
}
|
||||
|
||||
uint32_t XThread::thread_state() { return thread_state_address_; }
|
||||
@@ -122,17 +122,17 @@ uint32_t XThread::thread_id() { return thread_id_; }
|
||||
|
||||
uint32_t XThread::last_error() {
|
||||
uint8_t* p = memory()->TranslateVirtual(thread_state_address_);
|
||||
return poly::load_and_swap<uint32_t>(p + 0x160);
|
||||
return xe::load_and_swap<uint32_t>(p + 0x160);
|
||||
}
|
||||
|
||||
void XThread::set_last_error(uint32_t error_code) {
|
||||
uint8_t* p = memory()->TranslateVirtual(thread_state_address_);
|
||||
poly::store_and_swap<uint32_t>(p + 0x160, error_code);
|
||||
xe::store_and_swap<uint32_t>(p + 0x160, error_code);
|
||||
}
|
||||
|
||||
void XThread::set_name(const std::string& name) {
|
||||
name_ = name;
|
||||
poly::threading::set_name(thread_handle_, name);
|
||||
xe::threading::set_name(thread_handle_, name);
|
||||
}
|
||||
|
||||
X_STATUS XThread::Create() {
|
||||
@@ -180,11 +180,11 @@ X_STATUS XThread::Create() {
|
||||
|
||||
// Setup the thread state block (last error/etc).
|
||||
uint8_t* p = memory()->TranslateVirtual(thread_state_address_);
|
||||
poly::store_and_swap<uint32_t>(p + 0x000, tls_address_);
|
||||
poly::store_and_swap<uint32_t>(p + 0x100, thread_state_address_);
|
||||
poly::store_and_swap<uint32_t>(p + 0x14C, thread_id_);
|
||||
poly::store_and_swap<uint32_t>(p + 0x150, 0); // ?
|
||||
poly::store_and_swap<uint32_t>(p + 0x160, 0); // last error
|
||||
xe::store_and_swap<uint32_t>(p + 0x000, tls_address_);
|
||||
xe::store_and_swap<uint32_t>(p + 0x100, thread_state_address_);
|
||||
xe::store_and_swap<uint32_t>(p + 0x14C, thread_id_);
|
||||
xe::store_and_swap<uint32_t>(p + 0x150, 0); // ?
|
||||
xe::store_and_swap<uint32_t>(p + 0x160, 0); // last error
|
||||
|
||||
// Allocate processor thread state.
|
||||
// This is thread safe.
|
||||
@@ -200,7 +200,7 @@ X_STATUS XThread::Create() {
|
||||
}
|
||||
|
||||
char thread_name[32];
|
||||
snprintf(thread_name, poly::countof(thread_name), "XThread%04X", handle());
|
||||
snprintf(thread_name, xe::countof(thread_name), "XThread%04X", handle());
|
||||
set_name(thread_name);
|
||||
|
||||
uint32_t proc_mask = creation_params_.creation_flags >> 24;
|
||||
@@ -338,12 +338,12 @@ X_STATUS XThread::PlatformExit(int exit_code) {
|
||||
void XThread::Execute() {
|
||||
XELOGKERNEL("XThread::Execute thid %d (handle=%.8X, '%s', native=%.8X)",
|
||||
thread_id_, handle(), name_.c_str(),
|
||||
poly::threading::current_thread_id());
|
||||
xe::threading::current_thread_id());
|
||||
|
||||
// All threads get a mandatory sleep. This is to deal with some buggy
|
||||
// games that are assuming the 360 is so slow to create threads that they
|
||||
// have time to initialize shared structures AFTER CreateThread (RR).
|
||||
poly::threading::Sleep(std::chrono::milliseconds::duration(100));
|
||||
xe::threading::Sleep(std::chrono::milliseconds::duration(100));
|
||||
|
||||
// If a XapiThreadStartup value is present, we use that as a trampoline.
|
||||
// Otherwise, we are a raw thread.
|
||||
@@ -352,13 +352,12 @@ void XThread::Execute() {
|
||||
creation_params_.start_context};
|
||||
kernel_state()->processor()->Execute(thread_state_,
|
||||
creation_params_.xapi_thread_startup,
|
||||
args, poly::countof(args));
|
||||
args, xe::countof(args));
|
||||
} else {
|
||||
// Run user code.
|
||||
uint64_t args[] = {creation_params_.start_context};
|
||||
int exit_code = (int)kernel_state()->processor()->Execute(
|
||||
thread_state_, creation_params_.start_address, args,
|
||||
poly::countof(args));
|
||||
thread_state_, creation_params_.start_address, args, xe::countof(args));
|
||||
// If we got here it means the execute completed without an exit being
|
||||
// called.
|
||||
// Treat the return code as an implicit exit code.
|
||||
@@ -403,25 +402,25 @@ void XThread::DeliverAPCs(void* data) {
|
||||
// Calling the routine may delete the memory/overwrite it.
|
||||
uint32_t apc_address = apc_list->Shift() - 8;
|
||||
uint8_t* apc_ptr = memory->TranslateVirtual(apc_address);
|
||||
uint32_t kernel_routine = poly::load_and_swap<uint32_t>(apc_ptr + 16);
|
||||
uint32_t normal_routine = poly::load_and_swap<uint32_t>(apc_ptr + 24);
|
||||
uint32_t normal_context = poly::load_and_swap<uint32_t>(apc_ptr + 28);
|
||||
uint32_t system_arg1 = poly::load_and_swap<uint32_t>(apc_ptr + 32);
|
||||
uint32_t system_arg2 = poly::load_and_swap<uint32_t>(apc_ptr + 36);
|
||||
uint32_t kernel_routine = xe::load_and_swap<uint32_t>(apc_ptr + 16);
|
||||
uint32_t normal_routine = xe::load_and_swap<uint32_t>(apc_ptr + 24);
|
||||
uint32_t normal_context = xe::load_and_swap<uint32_t>(apc_ptr + 28);
|
||||
uint32_t system_arg1 = xe::load_and_swap<uint32_t>(apc_ptr + 32);
|
||||
uint32_t system_arg2 = xe::load_and_swap<uint32_t>(apc_ptr + 36);
|
||||
|
||||
// Mark as uninserted so that it can be reinserted again by the routine.
|
||||
uint32_t old_flags = poly::load_and_swap<uint32_t>(apc_ptr + 40);
|
||||
poly::store_and_swap<uint32_t>(apc_ptr + 40, old_flags & ~0xFF00);
|
||||
uint32_t old_flags = xe::load_and_swap<uint32_t>(apc_ptr + 40);
|
||||
xe::store_and_swap<uint32_t>(apc_ptr + 40, old_flags & ~0xFF00);
|
||||
|
||||
// Call kernel routine.
|
||||
// The routine can modify all of its arguments before passing it on.
|
||||
// Since we need to give guest accessible pointers over, we copy things
|
||||
// into and out of scratch.
|
||||
uint8_t* scratch_ptr = memory->TranslateVirtual(thread->scratch_address_);
|
||||
poly::store_and_swap<uint32_t>(scratch_ptr + 0, normal_routine);
|
||||
poly::store_and_swap<uint32_t>(scratch_ptr + 4, normal_context);
|
||||
poly::store_and_swap<uint32_t>(scratch_ptr + 8, system_arg1);
|
||||
poly::store_and_swap<uint32_t>(scratch_ptr + 12, system_arg2);
|
||||
xe::store_and_swap<uint32_t>(scratch_ptr + 0, normal_routine);
|
||||
xe::store_and_swap<uint32_t>(scratch_ptr + 4, normal_context);
|
||||
xe::store_and_swap<uint32_t>(scratch_ptr + 8, system_arg1);
|
||||
xe::store_and_swap<uint32_t>(scratch_ptr + 12, system_arg2);
|
||||
// kernel_routine(apc_address, &normal_routine, &normal_context,
|
||||
// &system_arg1, &system_arg2)
|
||||
uint64_t kernel_args[] = {
|
||||
@@ -429,11 +428,11 @@ void XThread::DeliverAPCs(void* data) {
|
||||
thread->scratch_address_ + 8, thread->scratch_address_ + 12,
|
||||
};
|
||||
processor->ExecuteInterrupt(0, kernel_routine, kernel_args,
|
||||
poly::countof(kernel_args));
|
||||
normal_routine = poly::load_and_swap<uint32_t>(scratch_ptr + 0);
|
||||
normal_context = poly::load_and_swap<uint32_t>(scratch_ptr + 4);
|
||||
system_arg1 = poly::load_and_swap<uint32_t>(scratch_ptr + 8);
|
||||
system_arg2 = poly::load_and_swap<uint32_t>(scratch_ptr + 12);
|
||||
xe::countof(kernel_args));
|
||||
normal_routine = xe::load_and_swap<uint32_t>(scratch_ptr + 0);
|
||||
normal_context = xe::load_and_swap<uint32_t>(scratch_ptr + 4);
|
||||
system_arg1 = xe::load_and_swap<uint32_t>(scratch_ptr + 8);
|
||||
system_arg2 = xe::load_and_swap<uint32_t>(scratch_ptr + 12);
|
||||
|
||||
// Call the normal routine. Note that it may have been killed by the kernel
|
||||
// routine.
|
||||
@@ -442,7 +441,7 @@ void XThread::DeliverAPCs(void* data) {
|
||||
// normal_routine(normal_context, system_arg1, system_arg2)
|
||||
uint64_t normal_args[] = {normal_context, system_arg1, system_arg2};
|
||||
processor->ExecuteInterrupt(0, normal_routine, normal_args,
|
||||
poly::countof(normal_args));
|
||||
xe::countof(normal_args));
|
||||
thread->LockApc();
|
||||
}
|
||||
}
|
||||
@@ -456,18 +455,18 @@ void XThread::RundownAPCs() {
|
||||
// Calling the routine may delete the memory/overwrite it.
|
||||
uint32_t apc_address = apc_list_->Shift() - 8;
|
||||
uint8_t* apc_ptr = memory()->TranslateVirtual(apc_address);
|
||||
uint32_t rundown_routine = poly::load_and_swap<uint32_t>(apc_ptr + 20);
|
||||
uint32_t rundown_routine = xe::load_and_swap<uint32_t>(apc_ptr + 20);
|
||||
|
||||
// Mark as uninserted so that it can be reinserted again by the routine.
|
||||
uint32_t old_flags = poly::load_and_swap<uint32_t>(apc_ptr + 40);
|
||||
poly::store_and_swap<uint32_t>(apc_ptr + 40, old_flags & ~0xFF00);
|
||||
uint32_t old_flags = xe::load_and_swap<uint32_t>(apc_ptr + 40);
|
||||
xe::store_and_swap<uint32_t>(apc_ptr + 40, old_flags & ~0xFF00);
|
||||
|
||||
// Call the rundown routine.
|
||||
if (rundown_routine) {
|
||||
// rundown_routine(apc)
|
||||
uint64_t args[] = {apc_address};
|
||||
kernel_state()->processor()->ExecuteInterrupt(0, rundown_routine, args,
|
||||
poly::countof(args));
|
||||
xe::countof(args));
|
||||
}
|
||||
}
|
||||
UnlockApc();
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/kernel/objects/xtimer.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -118,15 +118,15 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
execution_info_ptr_ = memory()->SystemHeapAlloc(24);
|
||||
auto eip = memory()->TranslateVirtual(execution_info_ptr_);
|
||||
const auto& ex = xe_xex2_get_header(xex_)->execution_info;
|
||||
poly::store_and_swap<uint32_t>(eip + 0x00, ex.media_id);
|
||||
poly::store_and_swap<uint32_t>(eip + 0x04, ex.version.value);
|
||||
poly::store_and_swap<uint32_t>(eip + 0x08, ex.base_version.value);
|
||||
poly::store_and_swap<uint32_t>(eip + 0x0C, ex.title_id);
|
||||
poly::store_and_swap<uint8_t>(eip + 0x10, ex.platform);
|
||||
poly::store_and_swap<uint8_t>(eip + 0x11, ex.executable_table);
|
||||
poly::store_and_swap<uint8_t>(eip + 0x12, ex.disc_number);
|
||||
poly::store_and_swap<uint8_t>(eip + 0x13, ex.disc_count);
|
||||
poly::store_and_swap<uint32_t>(eip + 0x14, ex.savegame_id);
|
||||
xe::store_and_swap<uint32_t>(eip + 0x00, ex.media_id);
|
||||
xe::store_and_swap<uint32_t>(eip + 0x04, ex.version.value);
|
||||
xe::store_and_swap<uint32_t>(eip + 0x08, ex.base_version.value);
|
||||
xe::store_and_swap<uint32_t>(eip + 0x0C, ex.title_id);
|
||||
xe::store_and_swap<uint8_t>(eip + 0x10, ex.platform);
|
||||
xe::store_and_swap<uint8_t>(eip + 0x11, ex.executable_table);
|
||||
xe::store_and_swap<uint8_t>(eip + 0x12, ex.disc_number);
|
||||
xe::store_and_swap<uint8_t>(eip + 0x13, ex.disc_count);
|
||||
xe::store_and_swap<uint32_t>(eip + 0x14, ex.savegame_id);
|
||||
|
||||
// Prepare the module for execution.
|
||||
// Runtime takes ownership.
|
||||
|
||||
@@ -51,8 +51,8 @@ class UserProfile {
|
||||
virtual size_t extra_size() const { return 0; }
|
||||
virtual size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) {
|
||||
poly::store_and_swap<uint8_t>(user_data + kTypeOffset,
|
||||
static_cast<uint8_t>(type));
|
||||
xe::store_and_swap<uint8_t>(user_data + kTypeOffset,
|
||||
static_cast<uint8_t>(type));
|
||||
return buffer_offset;
|
||||
}
|
||||
bool is_title_specific() const { return (setting_id & 0x3F00) == 0x3F00; }
|
||||
@@ -69,7 +69,7 @@ class UserProfile {
|
||||
size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) override {
|
||||
buffer_offset = Setting::Append(user_data, buffer, buffer_offset);
|
||||
poly::store_and_swap<int32_t>(user_data + kValueOffset, value);
|
||||
xe::store_and_swap<int32_t>(user_data + kValueOffset, value);
|
||||
return buffer_offset;
|
||||
}
|
||||
};
|
||||
@@ -80,7 +80,7 @@ class UserProfile {
|
||||
size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) override {
|
||||
buffer_offset = Setting::Append(user_data, buffer, buffer_offset);
|
||||
poly::store_and_swap<int64_t>(user_data + kValueOffset, value);
|
||||
xe::store_and_swap<int64_t>(user_data + kValueOffset, value);
|
||||
return buffer_offset;
|
||||
}
|
||||
};
|
||||
@@ -91,7 +91,7 @@ class UserProfile {
|
||||
size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) override {
|
||||
buffer_offset = Setting::Append(user_data, buffer, buffer_offset);
|
||||
poly::store_and_swap<double>(user_data + kValueOffset, value);
|
||||
xe::store_and_swap<double>(user_data + kValueOffset, value);
|
||||
return buffer_offset;
|
||||
}
|
||||
};
|
||||
@@ -108,13 +108,13 @@ class UserProfile {
|
||||
int32_t length;
|
||||
if (value.empty()) {
|
||||
length = 0;
|
||||
poly::store_and_swap<int32_t>(user_data + kValueOffset, 0);
|
||||
poly::store_and_swap<uint32_t>(user_data + kPointerOffset, 0);
|
||||
xe::store_and_swap<int32_t>(user_data + kValueOffset, 0);
|
||||
xe::store_and_swap<uint32_t>(user_data + kPointerOffset, 0);
|
||||
} else {
|
||||
length = 2 * (static_cast<int32_t>(value.size()) + 1);
|
||||
poly::store_and_swap<int32_t>(user_data + kValueOffset, length);
|
||||
poly::store_and_swap<uint32_t>(user_data + kPointerOffset,
|
||||
static_cast<uint32_t>(buffer_offset));
|
||||
xe::store_and_swap<int32_t>(user_data + kValueOffset, length);
|
||||
xe::store_and_swap<uint32_t>(user_data + kPointerOffset,
|
||||
static_cast<uint32_t>(buffer_offset));
|
||||
memcpy(buffer + buffer_offset, value.data(), length);
|
||||
}
|
||||
return buffer_offset + length;
|
||||
@@ -127,7 +127,7 @@ class UserProfile {
|
||||
size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) override {
|
||||
buffer_offset = Setting::Append(user_data, buffer, buffer_offset);
|
||||
poly::store_and_swap<float>(user_data + kValueOffset, value);
|
||||
xe::store_and_swap<float>(user_data + kValueOffset, value);
|
||||
return buffer_offset;
|
||||
}
|
||||
};
|
||||
@@ -144,13 +144,13 @@ class UserProfile {
|
||||
int32_t length;
|
||||
if (value.empty()) {
|
||||
length = 0;
|
||||
poly::store_and_swap<int32_t>(user_data + kValueOffset, 0);
|
||||
poly::store_and_swap<int32_t>(user_data + kPointerOffset, 0);
|
||||
xe::store_and_swap<int32_t>(user_data + kValueOffset, 0);
|
||||
xe::store_and_swap<int32_t>(user_data + kPointerOffset, 0);
|
||||
} else {
|
||||
length = static_cast<int32_t>(value.size());
|
||||
poly::store_and_swap<int32_t>(user_data + kValueOffset, length);
|
||||
poly::store_and_swap<uint32_t>(user_data + kPointerOffset,
|
||||
static_cast<uint32_t>(buffer_offset));
|
||||
xe::store_and_swap<int32_t>(user_data + kValueOffset, length);
|
||||
xe::store_and_swap<uint32_t>(user_data + kPointerOffset,
|
||||
static_cast<uint32_t>(buffer_offset));
|
||||
memcpy(buffer + buffer_offset, value.data(), length);
|
||||
}
|
||||
return buffer_offset + length;
|
||||
@@ -163,7 +163,7 @@ class UserProfile {
|
||||
size_t Append(uint8_t* user_data, uint8_t* buffer,
|
||||
size_t buffer_offset) override {
|
||||
buffer_offset = Setting::Append(user_data, buffer, buffer_offset);
|
||||
poly::store_and_swap<int64_t>(user_data + kValueOffset, value);
|
||||
xe::store_and_swap<int64_t>(user_data + kValueOffset, value);
|
||||
return buffer_offset;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* #include "xenia/kernel/util/export_table_post.inc"
|
||||
* export_resolver_->RegisterTable(
|
||||
* "my_module.xex",
|
||||
* my_module_export_table, poly::countof(my_module_export_table));
|
||||
* my_module_export_table, xe::countof(my_module_export_table));
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ using PPCContext = xe::cpu::frontend::PPCContext;
|
||||
#define SHIM_MEM_BASE ppc_state->virtual_membase
|
||||
#define SHIM_MEM_ADDR(a) (a ? (ppc_state->virtual_membase + a) : nullptr)
|
||||
|
||||
#define SHIM_MEM_8(a) poly::load_and_swap<uint8_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_16(a) poly::load_and_swap<uint16_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_32(a) poly::load_and_swap<uint32_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_64(a) poly::load_and_swap<uint64_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_SET_MEM_8(a, v) poly::store_and_swap<uint8_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_16(a, v) poly::store_and_swap<uint16_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_32(a, v) poly::store_and_swap<uint32_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_64(a, v) poly::store_and_swap<uint64_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_F32(a, v) poly::store_and_swap<float>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_F64(a, v) poly::store_and_swap<double>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_MEM_8(a) xe::load_and_swap<uint8_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_16(a) xe::load_and_swap<uint16_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_32(a) xe::load_and_swap<uint32_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_MEM_64(a) xe::load_and_swap<uint64_t>(SHIM_MEM_ADDR(a))
|
||||
#define SHIM_SET_MEM_8(a, v) xe::store_and_swap<uint8_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_16(a, v) xe::store_and_swap<uint16_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_32(a, v) xe::store_and_swap<uint32_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_64(a, v) xe::store_and_swap<uint64_t>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_F32(a, v) xe::store_and_swap<float>(SHIM_MEM_ADDR(a), v)
|
||||
#define SHIM_SET_MEM_F64(a, v) xe::store_and_swap<double>(SHIM_MEM_ADDR(a), v)
|
||||
|
||||
#define SHIM_GPR_8(n) (uint8_t)(ppc_state->r[n])
|
||||
#define SHIM_GPR_16(n) (uint16_t)(ppc_state->r[n])
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
#include "third_party/mspack/mspack.h"
|
||||
#include "third_party/pe/pe_image.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "poly/memory.h"
|
||||
#include "poly/platform.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/base/platform.h"
|
||||
|
||||
// TODO(benvanik): remove.
|
||||
#define XEEXPECTZERO(expr) \
|
||||
@@ -124,22 +124,22 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
const uint8_t *ps;
|
||||
xe_xex2_loader_info_t *ldr;
|
||||
|
||||
header->xex2 = poly::load_and_swap<uint32_t>(p + 0x00);
|
||||
header->xex2 = xe::load_and_swap<uint32_t>(p + 0x00);
|
||||
if (header->xex2 != 0x58455832) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
header->module_flags =
|
||||
(xe_xex2_module_flags)poly::load_and_swap<uint32_t>(p + 0x04);
|
||||
header->exe_offset = poly::load_and_swap<uint32_t>(p + 0x08);
|
||||
header->unknown0 = poly::load_and_swap<uint32_t>(p + 0x0C);
|
||||
header->certificate_offset = poly::load_and_swap<uint32_t>(p + 0x10);
|
||||
header->header_count = poly::load_and_swap<uint32_t>(p + 0x14);
|
||||
(xe_xex2_module_flags)xe::load_and_swap<uint32_t>(p + 0x04);
|
||||
header->exe_offset = xe::load_and_swap<uint32_t>(p + 0x08);
|
||||
header->unknown0 = xe::load_and_swap<uint32_t>(p + 0x0C);
|
||||
header->certificate_offset = xe::load_and_swap<uint32_t>(p + 0x10);
|
||||
header->header_count = xe::load_and_swap<uint32_t>(p + 0x14);
|
||||
|
||||
for (size_t n = 0; n < header->header_count; n++) {
|
||||
const uint8_t *ph = p + 0x18 + (n * 8);
|
||||
const uint32_t key = poly::load_and_swap<uint32_t>(ph + 0x00);
|
||||
const uint32_t data_offset = poly::load_and_swap<uint32_t>(ph + 0x04);
|
||||
const uint32_t key = xe::load_and_swap<uint32_t>(ph + 0x00);
|
||||
const uint32_t data_offset = xe::load_and_swap<uint32_t>(ph + 0x04);
|
||||
|
||||
xe_xex2_opt_header_t *opt_header = &header->headers[n];
|
||||
opt_header->key = key;
|
||||
@@ -151,7 +151,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
break;
|
||||
case 0xFF:
|
||||
// dataOffset = offset (first dword in data is size)
|
||||
opt_header->length = poly::load_and_swap<uint32_t>(p + data_offset);
|
||||
opt_header->length = xe::load_and_swap<uint32_t>(p + data_offset);
|
||||
opt_header->offset = data_offset;
|
||||
break;
|
||||
default:
|
||||
@@ -174,61 +174,56 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
for (size_t m = 0; m < header->resource_info_count; m++) {
|
||||
auto &res = header->resource_infos[m];
|
||||
memcpy(res.name, phi + 0x00, 8);
|
||||
res.address = poly::load_and_swap<uint32_t>(phi + 0x08);
|
||||
res.size = poly::load_and_swap<uint32_t>(phi + 0x0C);
|
||||
res.address = xe::load_and_swap<uint32_t>(phi + 0x08);
|
||||
res.size = xe::load_and_swap<uint32_t>(phi + 0x0C);
|
||||
phi += 16;
|
||||
}
|
||||
} break;
|
||||
case XEX_HEADER_EXECUTION_INFO: {
|
||||
xe_xex2_execution_info_t *ex = &header->execution_info;
|
||||
ex->media_id = poly::load_and_swap<uint32_t>(pp + 0x00);
|
||||
ex->version.value = poly::load_and_swap<uint32_t>(pp + 0x04);
|
||||
ex->base_version.value = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
ex->title_id = poly::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
ex->platform = poly::load_and_swap<uint8_t>(pp + 0x10);
|
||||
ex->executable_table = poly::load_and_swap<uint8_t>(pp + 0x11);
|
||||
ex->disc_number = poly::load_and_swap<uint8_t>(pp + 0x12);
|
||||
ex->disc_count = poly::load_and_swap<uint8_t>(pp + 0x13);
|
||||
ex->savegame_id = poly::load_and_swap<uint32_t>(pp + 0x14);
|
||||
ex->media_id = xe::load_and_swap<uint32_t>(pp + 0x00);
|
||||
ex->version.value = xe::load_and_swap<uint32_t>(pp + 0x04);
|
||||
ex->base_version.value = xe::load_and_swap<uint32_t>(pp + 0x08);
|
||||
ex->title_id = xe::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
ex->platform = xe::load_and_swap<uint8_t>(pp + 0x10);
|
||||
ex->executable_table = xe::load_and_swap<uint8_t>(pp + 0x11);
|
||||
ex->disc_number = xe::load_and_swap<uint8_t>(pp + 0x12);
|
||||
ex->disc_count = xe::load_and_swap<uint8_t>(pp + 0x13);
|
||||
ex->savegame_id = xe::load_and_swap<uint32_t>(pp + 0x14);
|
||||
} break;
|
||||
case XEX_HEADER_GAME_RATINGS: {
|
||||
xe_xex2_game_ratings_t *ratings = &header->game_ratings;
|
||||
ratings->esrb =
|
||||
(xe_xex2_rating_esrb_value)poly::load_and_swap<uint8_t>(pp + 0x00);
|
||||
(xe_xex2_rating_esrb_value)xe::load_and_swap<uint8_t>(pp + 0x00);
|
||||
ratings->pegi =
|
||||
(xe_xex2_rating_pegi_value)poly::load_and_swap<uint8_t>(pp + 0x01);
|
||||
(xe_xex2_rating_pegi_value)xe::load_and_swap<uint8_t>(pp + 0x01);
|
||||
ratings->pegifi =
|
||||
(xe_xex2_rating_pegi_fi_value)poly::load_and_swap<uint8_t>(pp +
|
||||
0x02);
|
||||
(xe_xex2_rating_pegi_fi_value)xe::load_and_swap<uint8_t>(pp + 0x02);
|
||||
ratings->pegipt =
|
||||
(xe_xex2_rating_pegi_pt_value)poly::load_and_swap<uint8_t>(pp +
|
||||
0x03);
|
||||
(xe_xex2_rating_pegi_pt_value)xe::load_and_swap<uint8_t>(pp + 0x03);
|
||||
ratings->bbfc =
|
||||
(xe_xex2_rating_bbfc_value)poly::load_and_swap<uint8_t>(pp + 0x04);
|
||||
(xe_xex2_rating_bbfc_value)xe::load_and_swap<uint8_t>(pp + 0x04);
|
||||
ratings->cero =
|
||||
(xe_xex2_rating_cero_value)poly::load_and_swap<uint8_t>(pp + 0x05);
|
||||
(xe_xex2_rating_cero_value)xe::load_and_swap<uint8_t>(pp + 0x05);
|
||||
ratings->usk =
|
||||
(xe_xex2_rating_usk_value)poly::load_and_swap<uint8_t>(pp + 0x06);
|
||||
(xe_xex2_rating_usk_value)xe::load_and_swap<uint8_t>(pp + 0x06);
|
||||
ratings->oflcau =
|
||||
(xe_xex2_rating_oflc_au_value)poly::load_and_swap<uint8_t>(pp +
|
||||
0x07);
|
||||
(xe_xex2_rating_oflc_au_value)xe::load_and_swap<uint8_t>(pp + 0x07);
|
||||
ratings->oflcnz =
|
||||
(xe_xex2_rating_oflc_nz_value)poly::load_and_swap<uint8_t>(pp +
|
||||
0x08);
|
||||
(xe_xex2_rating_oflc_nz_value)xe::load_and_swap<uint8_t>(pp + 0x08);
|
||||
ratings->kmrb =
|
||||
(xe_xex2_rating_kmrb_value)poly::load_and_swap<uint8_t>(pp + 0x09);
|
||||
(xe_xex2_rating_kmrb_value)xe::load_and_swap<uint8_t>(pp + 0x09);
|
||||
ratings->brazil =
|
||||
(xe_xex2_rating_brazil_value)poly::load_and_swap<uint8_t>(pp +
|
||||
0x0A);
|
||||
(xe_xex2_rating_brazil_value)xe::load_and_swap<uint8_t>(pp + 0x0A);
|
||||
ratings->fpb =
|
||||
(xe_xex2_rating_fpb_value)poly::load_and_swap<uint8_t>(pp + 0x0B);
|
||||
(xe_xex2_rating_fpb_value)xe::load_and_swap<uint8_t>(pp + 0x0B);
|
||||
} break;
|
||||
case XEX_HEADER_TLS_INFO: {
|
||||
xe_xex2_tls_info_t *tls = &header->tls_info;
|
||||
tls->slot_count = poly::load_and_swap<uint32_t>(pp + 0x00);
|
||||
tls->raw_data_address = poly::load_and_swap<uint32_t>(pp + 0x04);
|
||||
tls->data_size = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
tls->raw_data_size = poly::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
tls->slot_count = xe::load_and_swap<uint32_t>(pp + 0x00);
|
||||
tls->raw_data_address = xe::load_and_swap<uint32_t>(pp + 0x04);
|
||||
tls->data_size = xe::load_and_swap<uint32_t>(pp + 0x08);
|
||||
tls->raw_data_size = xe::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
} break;
|
||||
case XEX_HEADER_IMAGE_BASE_ADDRESS:
|
||||
header->exe_address = opt_header->value;
|
||||
@@ -243,8 +238,8 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
header->exe_heap_size = opt_header->value;
|
||||
break;
|
||||
case XEX_HEADER_IMPORT_LIBRARIES: {
|
||||
const size_t max_count = poly::countof(header->import_libraries);
|
||||
size_t count = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
const size_t max_count = xe::countof(header->import_libraries);
|
||||
size_t count = xe::load_and_swap<uint32_t>(pp + 0x08);
|
||||
assert_true(count <= max_count);
|
||||
if (count > max_count) {
|
||||
XELOGW("ignoring %zu extra entries in XEX_HEADER_IMPORT_LIBRARIES",
|
||||
@@ -253,24 +248,24 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
}
|
||||
header->import_library_count = count;
|
||||
|
||||
uint32_t string_table_size = poly::load_and_swap<uint32_t>(pp + 0x04);
|
||||
uint32_t string_table_size = xe::load_and_swap<uint32_t>(pp + 0x04);
|
||||
const char *string_table = (const char *)(pp + 0x0C);
|
||||
|
||||
pp += 12 + string_table_size;
|
||||
for (size_t m = 0; m < count; m++) {
|
||||
xe_xex2_import_library_t *library = &header->import_libraries[m];
|
||||
memcpy(library->digest, pp + 0x04, 20);
|
||||
library->import_id = poly::load_and_swap<uint32_t>(pp + 0x18);
|
||||
library->version.value = poly::load_and_swap<uint32_t>(pp + 0x1C);
|
||||
library->min_version.value = poly::load_and_swap<uint32_t>(pp + 0x20);
|
||||
library->import_id = xe::load_and_swap<uint32_t>(pp + 0x18);
|
||||
library->version.value = xe::load_and_swap<uint32_t>(pp + 0x1C);
|
||||
library->min_version.value = xe::load_and_swap<uint32_t>(pp + 0x20);
|
||||
|
||||
const uint16_t name_index =
|
||||
poly::load_and_swap<uint16_t>(pp + 0x24) & 0xFF;
|
||||
xe::load_and_swap<uint16_t>(pp + 0x24) & 0xFF;
|
||||
for (size_t i = 0, j = 0; i < string_table_size;) {
|
||||
assert_true(j <= 0xFF);
|
||||
if (j == name_index) {
|
||||
std::strncpy(library->name, string_table + i,
|
||||
poly::countof(library->name));
|
||||
xe::countof(library->name));
|
||||
break;
|
||||
}
|
||||
if (string_table[i] == 0) {
|
||||
@@ -284,19 +279,19 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
}
|
||||
}
|
||||
|
||||
library->record_count = poly::load_and_swap<uint16_t>(pp + 0x26);
|
||||
library->record_count = xe::load_and_swap<uint16_t>(pp + 0x26);
|
||||
library->records =
|
||||
(uint32_t *)calloc(library->record_count, sizeof(uint32_t));
|
||||
XEEXPECTNOTNULL(library->records);
|
||||
pp += 0x28;
|
||||
for (size_t i = 0; i < library->record_count; i++) {
|
||||
library->records[i] = poly::load_and_swap<uint32_t>(pp);
|
||||
library->records[i] = xe::load_and_swap<uint32_t>(pp);
|
||||
pp += 4;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case XEX_HEADER_STATIC_LIBRARIES: {
|
||||
const size_t max_count = poly::countof(header->static_libraries);
|
||||
const size_t max_count = xe::countof(header->static_libraries);
|
||||
size_t count = (opt_header->length - 4) / 16;
|
||||
assert_true(count <= max_count);
|
||||
if (count > max_count) {
|
||||
@@ -310,10 +305,10 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
xe_xex2_static_library_t *library = &header->static_libraries[m];
|
||||
memcpy(library->name, pp + 0x00, 8);
|
||||
library->name[8] = 0;
|
||||
library->major = poly::load_and_swap<uint16_t>(pp + 0x08);
|
||||
library->minor = poly::load_and_swap<uint16_t>(pp + 0x0A);
|
||||
library->build = poly::load_and_swap<uint16_t>(pp + 0x0C);
|
||||
uint16_t qfeapproval = poly::load_and_swap<uint16_t>(pp + 0x0E);
|
||||
library->major = xe::load_and_swap<uint16_t>(pp + 0x08);
|
||||
library->minor = xe::load_and_swap<uint16_t>(pp + 0x0A);
|
||||
library->build = xe::load_and_swap<uint16_t>(pp + 0x0C);
|
||||
uint16_t qfeapproval = xe::load_and_swap<uint16_t>(pp + 0x0E);
|
||||
library->approval = (xe_xex2_approval_type)(qfeapproval & 0x8000);
|
||||
library->qfe = qfeapproval & ~0x8000;
|
||||
pp += 16;
|
||||
@@ -322,9 +317,9 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
case XEX_HEADER_FILE_FORMAT_INFO: {
|
||||
xe_xex2_file_format_info_t *fmt = &header->file_format_info;
|
||||
fmt->encryption_type =
|
||||
(xe_xex2_encryption_type)poly::load_and_swap<uint16_t>(pp + 0x04);
|
||||
(xe_xex2_encryption_type)xe::load_and_swap<uint16_t>(pp + 0x04);
|
||||
fmt->compression_type =
|
||||
(xe_xex2_compression_type)poly::load_and_swap<uint16_t>(pp + 0x06);
|
||||
(xe_xex2_compression_type)xe::load_and_swap<uint16_t>(pp + 0x06);
|
||||
switch (fmt->compression_type) {
|
||||
case XEX_COMPRESSION_NONE:
|
||||
// TODO: XEX_COMPRESSION_NONE
|
||||
@@ -333,7 +328,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
case XEX_COMPRESSION_BASIC: {
|
||||
xe_xex2_file_basic_compression_info_t *comp_info =
|
||||
&fmt->compression_info.basic;
|
||||
uint32_t info_size = poly::load_and_swap<uint32_t>(pp + 0x00);
|
||||
uint32_t info_size = xe::load_and_swap<uint32_t>(pp + 0x00);
|
||||
comp_info->block_count = (info_size - 8) / 8;
|
||||
comp_info->blocks =
|
||||
(xe_xex2_file_basic_compression_block_t *)calloc(
|
||||
@@ -344,15 +339,15 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
xe_xex2_file_basic_compression_block_t *block =
|
||||
&comp_info->blocks[m];
|
||||
block->data_size =
|
||||
poly::load_and_swap<uint32_t>(pp + 0x08 + (m * 8));
|
||||
xe::load_and_swap<uint32_t>(pp + 0x08 + (m * 8));
|
||||
block->zero_size =
|
||||
poly::load_and_swap<uint32_t>(pp + 0x0C + (m * 8));
|
||||
xe::load_and_swap<uint32_t>(pp + 0x0C + (m * 8));
|
||||
}
|
||||
} break;
|
||||
case XEX_COMPRESSION_NORMAL: {
|
||||
xe_xex2_file_normal_compression_info_t *comp_info =
|
||||
&fmt->compression_info.normal;
|
||||
uint32_t window_size = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
uint32_t window_size = xe::load_and_swap<uint32_t>(pp + 0x08);
|
||||
uint32_t window_bits = 0;
|
||||
for (size_t m = 0; m < 32; m++, window_bits++) {
|
||||
window_size <<= 1;
|
||||
@@ -360,9 +355,9 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
break;
|
||||
}
|
||||
}
|
||||
comp_info->window_size = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
comp_info->window_size = xe::load_and_swap<uint32_t>(pp + 0x08);
|
||||
comp_info->window_bits = window_bits;
|
||||
comp_info->block_size = poly::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
comp_info->block_size = xe::load_and_swap<uint32_t>(pp + 0x0C);
|
||||
memcpy(comp_info->block_hash, pp + 0x10, 20);
|
||||
} break;
|
||||
case XEX_COMPRESSION_DELTA:
|
||||
@@ -377,28 +372,28 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
// Loader info.
|
||||
pc = p + header->certificate_offset;
|
||||
ldr = &header->loader_info;
|
||||
ldr->header_size = poly::load_and_swap<uint32_t>(pc + 0x000);
|
||||
ldr->image_size = poly::load_and_swap<uint32_t>(pc + 0x004);
|
||||
ldr->header_size = xe::load_and_swap<uint32_t>(pc + 0x000);
|
||||
ldr->image_size = xe::load_and_swap<uint32_t>(pc + 0x004);
|
||||
memcpy(ldr->rsa_signature, pc + 0x008, 256);
|
||||
ldr->unklength = poly::load_and_swap<uint32_t>(pc + 0x108);
|
||||
ldr->unklength = xe::load_and_swap<uint32_t>(pc + 0x108);
|
||||
ldr->image_flags =
|
||||
(xe_xex2_image_flags)poly::load_and_swap<uint32_t>(pc + 0x10C);
|
||||
ldr->load_address = poly::load_and_swap<uint32_t>(pc + 0x110);
|
||||
(xe_xex2_image_flags)xe::load_and_swap<uint32_t>(pc + 0x10C);
|
||||
ldr->load_address = xe::load_and_swap<uint32_t>(pc + 0x110);
|
||||
memcpy(ldr->section_digest, pc + 0x114, 20);
|
||||
ldr->import_table_count = poly::load_and_swap<uint32_t>(pc + 0x128);
|
||||
ldr->import_table_count = xe::load_and_swap<uint32_t>(pc + 0x128);
|
||||
memcpy(ldr->import_table_digest, pc + 0x12C, 20);
|
||||
memcpy(ldr->media_id, pc + 0x140, 16);
|
||||
memcpy(ldr->file_key, pc + 0x150, 16);
|
||||
ldr->export_table = poly::load_and_swap<uint32_t>(pc + 0x160);
|
||||
ldr->export_table = xe::load_and_swap<uint32_t>(pc + 0x160);
|
||||
memcpy(ldr->header_digest, pc + 0x164, 20);
|
||||
ldr->game_regions =
|
||||
(xe_xex2_region_flags)poly::load_and_swap<uint32_t>(pc + 0x178);
|
||||
(xe_xex2_region_flags)xe::load_and_swap<uint32_t>(pc + 0x178);
|
||||
ldr->media_flags =
|
||||
(xe_xex2_media_flags)poly::load_and_swap<uint32_t>(pc + 0x17C);
|
||||
(xe_xex2_media_flags)xe::load_and_swap<uint32_t>(pc + 0x17C);
|
||||
|
||||
// Section info follows loader info.
|
||||
ps = p + header->certificate_offset + 0x180;
|
||||
header->section_count = poly::load_and_swap<uint32_t>(ps + 0x000);
|
||||
header->section_count = xe::load_and_swap<uint32_t>(ps + 0x000);
|
||||
ps += 4;
|
||||
header->sections = (xe_xex2_section_t *)calloc(header->section_count,
|
||||
sizeof(xe_xex2_section_t));
|
||||
@@ -407,7 +402,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
xe_xex2_section_t *section = &header->sections[n];
|
||||
section->page_size =
|
||||
header->exe_address <= 0x90000000 ? 64 * 1024 : 4 * 1024;
|
||||
section->info.value = poly::load_and_swap<uint32_t>(ps);
|
||||
section->info.value = xe::load_and_swap<uint32_t>(ps);
|
||||
ps += 4;
|
||||
memcpy(section->digest, ps, sizeof(section->digest));
|
||||
ps += sizeof(section->digest);
|
||||
@@ -701,7 +696,7 @@ int xe_xex2_read_image_compressed(const xe_xex2_header_t *header,
|
||||
block_size = header->file_format_info.compression_info.normal.block_size;
|
||||
while (block_size) {
|
||||
const uint8_t *pnext = p + block_size;
|
||||
const size_t next_size = poly::load_and_swap<int32_t>(p);
|
||||
const size_t next_size = xe::load_and_swap<int32_t>(p);
|
||||
p += 4;
|
||||
p += 20; // skip 20b hash
|
||||
|
||||
@@ -915,7 +910,7 @@ int xe_xex2_find_import_infos(xe_xex2_ref xex,
|
||||
for (size_t n = 0; n < library->record_count; n++) {
|
||||
const uint32_t record = library->records[n];
|
||||
const uint32_t value =
|
||||
poly::load_and_swap<uint32_t>(xex->memory->TranslateVirtual(record));
|
||||
xe::load_and_swap<uint32_t>(xex->memory->TranslateVirtual(record));
|
||||
if (value & 0xFF000000) {
|
||||
// Thunk for previous record - ignore.
|
||||
} else {
|
||||
@@ -935,7 +930,7 @@ int xe_xex2_find_import_infos(xe_xex2_ref xex,
|
||||
for (size_t n = 0, i = 0; n < library->record_count; n++) {
|
||||
const uint32_t record = library->records[n];
|
||||
const uint32_t value =
|
||||
poly::load_and_swap<uint32_t>(xex->memory->TranslateVirtual(record));
|
||||
xe::load_and_swap<uint32_t>(xex->memory->TranslateVirtual(record));
|
||||
const uint32_t type = (value & 0xFF000000) >> 24;
|
||||
|
||||
// Verify library index matches given library.
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -101,8 +101,8 @@ SHIM_CALL XamContentGetDeviceName_shim(PPCContext* ppc_state,
|
||||
return;
|
||||
}
|
||||
|
||||
poly::store_and_swap<std::wstring>(SHIM_MEM_ADDR(name_ptr),
|
||||
dummy_device_info_.name);
|
||||
xe::store_and_swap<std::wstring>(SHIM_MEM_ADDR(name_ptr),
|
||||
dummy_device_info_.name);
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
@@ -153,8 +153,8 @@ SHIM_CALL XamContentGetDeviceData_shim(PPCContext* ppc_state,
|
||||
SHIM_SET_MEM_32(device_data_ptr + 4, device_info.device_type);
|
||||
SHIM_SET_MEM_64(device_data_ptr + 8, device_info.total_bytes);
|
||||
SHIM_SET_MEM_64(device_data_ptr + 16, device_info.free_bytes);
|
||||
poly::store_and_swap<std::wstring>(SHIM_MEM_ADDR(device_data_ptr + 24),
|
||||
device_info.name);
|
||||
xe::store_and_swap<std::wstring>(SHIM_MEM_ADDR(device_data_ptr + 24),
|
||||
device_info.name);
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
@@ -324,8 +324,7 @@ SHIM_CALL XamContentCreate_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t license_mask_ptr = SHIM_GET_ARG_32(5);
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(6);
|
||||
|
||||
auto root_name =
|
||||
poly::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
||||
|
||||
XELOGD("XamContentCreate(%d, %.8X(%s), %.8X, %.8X, %.8X, %.8X, %.8X)",
|
||||
@@ -349,8 +348,7 @@ SHIM_CALL XamContentCreateEx_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t sp = (uint32_t)ppc_state->r[1];
|
||||
uint32_t overlapped_ptr = SHIM_MEM_32(sp + 0x54);
|
||||
|
||||
auto root_name =
|
||||
poly::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
||||
|
||||
XELOGD(
|
||||
@@ -369,8 +367,7 @@ SHIM_CALL XamContentFlush_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t root_name_ptr = SHIM_GET_ARG_32(0);
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
||||
|
||||
auto root_name =
|
||||
poly::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
|
||||
XELOGD("XamContentFlush(%.8X(%s), %.8X)", root_name_ptr, root_name.c_str(),
|
||||
overlapped_ptr);
|
||||
@@ -388,8 +385,7 @@ SHIM_CALL XamContentClose_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t root_name_ptr = SHIM_GET_ARG_32(0);
|
||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
||||
|
||||
auto root_name =
|
||||
poly::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
||||
|
||||
XELOGD("XamContentClose(%.8X(%s), %.8X)", root_name_ptr, root_name.c_str(),
|
||||
overlapped_ptr);
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/hid/hid.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/kernel/xam_module.h"
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
|
||||
@@ -47,7 +47,7 @@ void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
|
||||
};
|
||||
#include "xenia/kernel/util/export_table_post.inc"
|
||||
export_resolver->RegisterTable("xam.xex", xam_export_table,
|
||||
poly::countof(xam_export_table));
|
||||
xe::countof(xam_export_table));
|
||||
}
|
||||
|
||||
XamModule::~XamModule() {}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -10,23 +10,23 @@
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
|
||||
#include <winsock2.h>
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
void LoadSockaddr(const uint8_t* ptr, sockaddr* out_addr) {
|
||||
out_addr->sa_family = poly::load_and_swap<uint16_t>(ptr + 0);
|
||||
out_addr->sa_family = xe::load_and_swap<uint16_t>(ptr + 0);
|
||||
switch (out_addr->sa_family) {
|
||||
case AF_INET: {
|
||||
auto in_addr = reinterpret_cast<sockaddr_in*>(out_addr);
|
||||
in_addr->sin_port = poly::load_and_swap<uint16_t>(ptr + 2);
|
||||
in_addr->sin_port = xe::load_and_swap<uint16_t>(ptr + 2);
|
||||
// Maybe? Depends on type.
|
||||
in_addr->sin_addr.S_un.S_addr = poly::load_and_swap<uint32_t>(ptr + 4);
|
||||
in_addr->sin_addr.S_un.S_addr = xe::load_and_swap<uint32_t>(ptr + 4);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -42,10 +42,10 @@ void StoreSockaddr(const sockaddr& addr, uint8_t* ptr) {
|
||||
break;
|
||||
case AF_INET: {
|
||||
auto& in_addr = reinterpret_cast<const sockaddr_in&>(addr);
|
||||
poly::store_and_swap<uint16_t>(ptr + 0, in_addr.sin_family);
|
||||
poly::store_and_swap<uint16_t>(ptr + 2, in_addr.sin_port);
|
||||
xe::store_and_swap<uint16_t>(ptr + 0, in_addr.sin_family);
|
||||
xe::store_and_swap<uint16_t>(ptr + 2, in_addr.sin_port);
|
||||
// Maybe? Depends on type.
|
||||
poly::store_and_swap<uint32_t>(ptr + 4, in_addr.sin_addr.S_un.S_addr);
|
||||
xe::store_and_swap<uint32_t>(ptr + 4, in_addr.sin_addr.S_un.S_addr);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -256,21 +256,21 @@ SHIM_CALL NetDll_accept_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
}
|
||||
|
||||
void LoadFdset(const uint8_t* src, fd_set* dest) {
|
||||
dest->fd_count = poly::load_and_swap<uint32_t>(src);
|
||||
dest->fd_count = xe::load_and_swap<uint32_t>(src);
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
auto socket_handle =
|
||||
static_cast<SOCKET>(poly::load_and_swap<uint32_t>(src + 4 + i * 4));
|
||||
static_cast<SOCKET>(xe::load_and_swap<uint32_t>(src + 4 + i * 4));
|
||||
dest->fd_array[i] = socket_handle;
|
||||
}
|
||||
}
|
||||
|
||||
void StoreFdset(const fd_set& src, uint8_t* dest) {
|
||||
poly::store_and_swap<uint32_t>(dest, src.fd_count);
|
||||
xe::store_and_swap<uint32_t>(dest, src.fd_count);
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
SOCKET socket_handle = src.fd_array[i];
|
||||
assert_true(socket_handle >> 32 == 0);
|
||||
poly::store_and_swap<uint32_t>(dest + 4 + i * 4,
|
||||
static_cast<uint32_t>(socket_handle));
|
||||
xe::store_and_swap<uint32_t>(dest + 4 + i * 4,
|
||||
static_cast<uint32_t>(socket_handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xnotify_listener.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -30,13 +30,13 @@ SHIM_CALL XamShowMessageBoxUI_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t sp = (uint32_t)ppc_state->r[1];
|
||||
uint32_t overlapped_ptr = SHIM_MEM_32(sp + 0x54);
|
||||
|
||||
auto title = poly::load_and_swap<std::wstring>(SHIM_MEM_ADDR(title_ptr));
|
||||
auto text = poly::load_and_swap<std::wstring>(SHIM_MEM_ADDR(text_ptr));
|
||||
auto title = xe::load_and_swap<std::wstring>(SHIM_MEM_ADDR(title_ptr));
|
||||
auto text = xe::load_and_swap<std::wstring>(SHIM_MEM_ADDR(text_ptr));
|
||||
std::vector<std::wstring> buttons;
|
||||
std::wstring all_buttons;
|
||||
for (uint32_t j = 0; j < button_count; ++j) {
|
||||
uint32_t button_ptr = SHIM_MEM_32(button_ptrs + j * 4);
|
||||
auto button = poly::load_and_swap<std::wstring>(SHIM_MEM_ADDR(button_ptr));
|
||||
auto button = xe::load_and_swap<std::wstring>(SHIM_MEM_ADDR(button_ptr));
|
||||
all_buttons.append(button);
|
||||
if (j + 1 < button_count) {
|
||||
all_buttons.append(L" | ");
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xenumerator.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
|
||||
#include "xenia/apu/apu.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
|
||||
#include "xenia/apu/apu.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -138,15 +138,15 @@ struct XMAContextData {
|
||||
uint32_t unk_dword_9 : 27;
|
||||
|
||||
XMAContextData(const void* ptr) {
|
||||
poly::copy_and_swap_32_aligned(reinterpret_cast<uint32_t*>(this),
|
||||
reinterpret_cast<const uint32_t*>(ptr),
|
||||
sizeof(XMAContextData) / 4);
|
||||
xe::copy_and_swap_32_aligned(reinterpret_cast<uint32_t*>(this),
|
||||
reinterpret_cast<const uint32_t*>(ptr),
|
||||
sizeof(XMAContextData) / 4);
|
||||
}
|
||||
|
||||
void Store(void* ptr) {
|
||||
poly::copy_and_swap_32_aligned(reinterpret_cast<uint32_t*>(ptr),
|
||||
reinterpret_cast<const uint32_t*>(this),
|
||||
sizeof(XMAContextData) / 4);
|
||||
xe::copy_and_swap_32_aligned(reinterpret_cast<uint32_t*>(ptr),
|
||||
reinterpret_cast<const uint32_t*>(this),
|
||||
sizeof(XMAContextData) / 4);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(XMAContextData) == 4 * 10, "Must be packed");
|
||||
@@ -158,8 +158,8 @@ void StoreXmaContextIndexedRegister(KernelState* state, uint32_t base_reg,
|
||||
XMAContextData::kSize;
|
||||
uint32_t reg_num = base_reg + (hw_index >> 5) * 4;
|
||||
uint32_t reg_value = 1 << (hw_index & 0x1F);
|
||||
poly::store<uint32_t>(state->memory()->TranslateVirtual(0x7FEA0000 + reg_num),
|
||||
reg_value);
|
||||
xe::store<uint32_t>(state->memory()->TranslateVirtual(0x7FEA0000 + reg_num),
|
||||
reg_value);
|
||||
}
|
||||
|
||||
SHIM_CALL XMAInitializeContext_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/kernel/async_request.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xevent.h"
|
||||
#include "xenia/kernel/objects/xfile.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -32,14 +32,14 @@ class X_OBJECT_ATTRIBUTES {
|
||||
X_OBJECT_ATTRIBUTES() { Zero(); }
|
||||
X_OBJECT_ATTRIBUTES(const uint8_t* base, uint32_t p) { Read(base, p); }
|
||||
void Read(const uint8_t* base, uint32_t p) {
|
||||
root_directory = poly::load_and_swap<uint32_t>(base + p);
|
||||
object_name_ptr = poly::load_and_swap<uint32_t>(base + p + 4);
|
||||
root_directory = xe::load_and_swap<uint32_t>(base + p);
|
||||
object_name_ptr = xe::load_and_swap<uint32_t>(base + p + 4);
|
||||
if (object_name_ptr) {
|
||||
object_name.Read(base, object_name_ptr);
|
||||
} else {
|
||||
object_name.Zero();
|
||||
}
|
||||
attributes = poly::load_and_swap<uint32_t>(base + p + 8);
|
||||
attributes = xe::load_and_swap<uint32_t>(base + p + 8);
|
||||
}
|
||||
void Zero() {
|
||||
root_directory = 0;
|
||||
@@ -472,7 +472,7 @@ SHIM_CALL NtQueryInformationFile_shim(PPCContext* ppc_state,
|
||||
info = 8;
|
||||
// TODO(benvanik): use pointer to fs:: entry?
|
||||
SHIM_SET_MEM_64(file_info_ptr,
|
||||
poly::hash_combine(0, file->absolute_path()));
|
||||
xe::hash_combine(0, file->absolute_path()));
|
||||
break;
|
||||
case XFilePositionInformation:
|
||||
// struct FILE_POSITION_INFORMATION {
|
||||
@@ -511,7 +511,7 @@ SHIM_CALL NtQueryInformationFile_shim(PPCContext* ppc_state,
|
||||
if (bytes_read == sizeof(magic)) {
|
||||
info = 4;
|
||||
SHIM_SET_MEM_32(file_info_ptr,
|
||||
magic == poly::byte_swap(0x0FF512ED));
|
||||
magic == xe::byte_swap(0x0FF512ED));
|
||||
} else {
|
||||
result = X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -232,8 +232,8 @@ SHIM_CALL MmAllocatePhysicalMemoryEx_shim(PPCContext* ppc_state,
|
||||
}
|
||||
|
||||
// Round up the region size and alignment to the next page.
|
||||
uint32_t adjusted_size = poly::round_up(region_size, page_size);
|
||||
uint32_t adjusted_alignment = poly::round_up(alignment, page_size);
|
||||
uint32_t adjusted_size = xe::round_up(region_size, page_size);
|
||||
uint32_t adjusted_alignment = xe::round_up(alignment, page_size);
|
||||
|
||||
// Callers can pick an address to allocate with min_addr_range/max_addr_range
|
||||
// and the memory must be allocated there. I haven't seen a game do this,
|
||||
@@ -416,7 +416,7 @@ SHIM_CALL ExAllocatePoolTypeWithTag_shim(PPCContext* ppc_state,
|
||||
uint32_t alignment = 8;
|
||||
uint32_t adjusted_size = size;
|
||||
if (adjusted_size < 4 * 1024) {
|
||||
adjusted_size = poly::round_up(adjusted_size, 4 * 1024);
|
||||
adjusted_size = xe::round_up(adjusted_size, 4 * 1024);
|
||||
} else {
|
||||
alignment = 4 * 1024;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
#include "xenia/kernel/xboxkrnl_module.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include "poly/math.h"
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
DEFINE_bool(abort_before_entry, false,
|
||||
"Abort execution right before launching the module.");
|
||||
@@ -52,7 +53,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
auto lpKeDebugMonitorData = memory_->TranslateVirtual(pKeDebugMonitorData);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::KeDebugMonitorData, pKeDebugMonitorData);
|
||||
poly::store_and_swap<uint32_t>(lpKeDebugMonitorData, 0);
|
||||
xe::store_and_swap<uint32_t>(lpKeDebugMonitorData, 0);
|
||||
|
||||
// KeCertMonitorData (?*)
|
||||
// Always set to zero, ignored.
|
||||
@@ -60,7 +61,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
auto lpKeCertMonitorData = memory_->TranslateVirtual(pKeCertMonitorData);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::KeCertMonitorData, pKeCertMonitorData);
|
||||
poly::store_and_swap<uint32_t>(lpKeCertMonitorData, 0);
|
||||
xe::store_and_swap<uint32_t>(lpKeCertMonitorData, 0);
|
||||
|
||||
// XboxHardwareInfo (XboxHardwareInfo_t, 16b)
|
||||
// flags cpu# ? ? ? ? ? ?
|
||||
@@ -74,8 +75,8 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
auto lpXboxHardwareInfo = memory_->TranslateVirtual(pXboxHardwareInfo);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::XboxHardwareInfo, pXboxHardwareInfo);
|
||||
poly::store_and_swap<uint32_t>(lpXboxHardwareInfo + 0, 0); // flags
|
||||
poly::store_and_swap<uint8_t>(lpXboxHardwareInfo + 4, 0x06); // cpu count
|
||||
xe::store_and_swap<uint32_t>(lpXboxHardwareInfo + 0, 0); // flags
|
||||
xe::store_and_swap<uint8_t>(lpXboxHardwareInfo + 4, 0x06); // cpu count
|
||||
// Remaining 11b are zeroes?
|
||||
|
||||
// XexExecutableModuleHandle (?**)
|
||||
@@ -96,10 +97,9 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
uint32_t pXexExecutableModuleHandle = memory_->SystemHeapAlloc(256);
|
||||
auto lpXexExecutableModuleHandle =
|
||||
memory_->TranslateVirtual(pXexExecutableModuleHandle);
|
||||
poly::store_and_swap<uint32_t>(lppXexExecutableModuleHandle,
|
||||
pXexExecutableModuleHandle);
|
||||
poly::store_and_swap<uint32_t>(lpXexExecutableModuleHandle + 0x58,
|
||||
0x80101100);
|
||||
xe::store_and_swap<uint32_t>(lppXexExecutableModuleHandle,
|
||||
pXexExecutableModuleHandle);
|
||||
xe::store_and_swap<uint32_t>(lpXexExecutableModuleHandle + 0x58, 0x80101100);
|
||||
|
||||
// ExLoadedCommandLine (char*)
|
||||
// The name of the xex. Not sure this is ever really used on real devices.
|
||||
@@ -111,7 +111,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
"xboxkrnl.exe", ordinals::ExLoadedCommandLine, pExLoadedCommandLine);
|
||||
char command_line[] = "\"default.xex\"";
|
||||
std::memcpy(lpExLoadedCommandLine, command_line,
|
||||
poly::countof(command_line) + 1);
|
||||
xe::countof(command_line) + 1);
|
||||
|
||||
// XboxKrnlVersion (8b)
|
||||
// Kernel version, looks like 2b.2b.2b.2b.
|
||||
@@ -120,11 +120,11 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
auto lpXboxKrnlVersion = memory_->TranslateVirtual(pXboxKrnlVersion);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::XboxKrnlVersion, pXboxKrnlVersion);
|
||||
poly::store_and_swap<uint16_t>(lpXboxKrnlVersion + 0, 2);
|
||||
poly::store_and_swap<uint16_t>(lpXboxKrnlVersion + 2, 0xFFFF);
|
||||
poly::store_and_swap<uint16_t>(lpXboxKrnlVersion + 4, 0xFFFF);
|
||||
poly::store_and_swap<uint8_t>(lpXboxKrnlVersion + 6, 0x80);
|
||||
poly::store_and_swap<uint8_t>(lpXboxKrnlVersion + 7, 0x00);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 0, 2);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 2, 0xFFFF);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 4, 0xFFFF);
|
||||
xe::store_and_swap<uint8_t>(lpXboxKrnlVersion + 6, 0x80);
|
||||
xe::store_and_swap<uint8_t>(lpXboxKrnlVersion + 7, 0x00);
|
||||
|
||||
// KeTimeStampBundle (ad)
|
||||
// This must be updated during execution, at 1ms intevals.
|
||||
@@ -133,15 +133,15 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
||||
auto lpKeTimeStampBundle = memory_->TranslateVirtual(pKeTimeStampBundle);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::KeTimeStampBundle, pKeTimeStampBundle);
|
||||
poly::store_and_swap<uint64_t>(lpKeTimeStampBundle + 0, 0);
|
||||
poly::store_and_swap<uint64_t>(lpKeTimeStampBundle + 8, 0);
|
||||
poly::store_and_swap<uint32_t>(lpKeTimeStampBundle + 16, GetTickCount());
|
||||
poly::store_and_swap<uint32_t>(lpKeTimeStampBundle + 20, 0);
|
||||
xe::store_and_swap<uint64_t>(lpKeTimeStampBundle + 0, 0);
|
||||
xe::store_and_swap<uint64_t>(lpKeTimeStampBundle + 8, 0);
|
||||
xe::store_and_swap<uint32_t>(lpKeTimeStampBundle + 16, GetTickCount());
|
||||
xe::store_and_swap<uint32_t>(lpKeTimeStampBundle + 20, 0);
|
||||
CreateTimerQueueTimer(
|
||||
×tamp_timer_, nullptr,
|
||||
[](PVOID param, BOOLEAN timer_or_wait_fired) {
|
||||
auto timestamp_bundle = reinterpret_cast<uint8_t*>(param);
|
||||
poly::store_and_swap<uint32_t>(timestamp_bundle + 16, GetTickCount());
|
||||
xe::store_and_swap<uint32_t>(timestamp_bundle + 16, GetTickCount());
|
||||
},
|
||||
lpKeTimeStampBundle, 0,
|
||||
1, // 1ms
|
||||
@@ -163,7 +163,7 @@ void XboxkrnlModule::RegisterExportTable(
|
||||
};
|
||||
#include "xenia/kernel/util/export_table_post.inc"
|
||||
export_resolver->RegisterTable("xboxkrnl.exe", xboxkrnl_export_table,
|
||||
poly::countof(xboxkrnl_export_table));
|
||||
xe::countof(xboxkrnl_export_table));
|
||||
}
|
||||
|
||||
XboxkrnlModule::~XboxkrnlModule() {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -90,7 +90,7 @@ X_STATUS xeExGetXConfigSetting(uint16_t category, uint16_t setting,
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
poly::store_and_swap<uint32_t>(buffer, value);
|
||||
xe::store_and_swap<uint32_t>(buffer, value);
|
||||
}
|
||||
if (required_size) {
|
||||
*required_size = setting_size;
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xobject.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "poly/atomic.h"
|
||||
#include "poly/string.h"
|
||||
#include "xenia/base/atomic.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -79,7 +79,7 @@ SHIM_CALL RtlCompareMemoryUlong_shim(PPCContext* ppc_state,
|
||||
// TODO(benvanik): ensure byte order of pattern is correct.
|
||||
// Since we are doing byte-by-byte comparison we may not want to swap.
|
||||
// GET_ARG swaps, so this is a swap back. Ugly.
|
||||
const uint32_t pb32 = poly::byte_swap(pattern);
|
||||
const uint32_t pb32 = xe::byte_swap(pattern);
|
||||
const uint8_t* pb = (uint8_t*)&pb32;
|
||||
|
||||
uint32_t c = 0;
|
||||
@@ -113,7 +113,7 @@ SHIM_CALL RtlFillMemoryUlong_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
// swapped arg value.
|
||||
|
||||
uint32_t count = length >> 2;
|
||||
uint32_t native_pattern = poly::byte_swap(pattern);
|
||||
uint32_t native_pattern = xe::byte_swap(pattern);
|
||||
|
||||
// TODO: unroll loop?
|
||||
|
||||
@@ -227,9 +227,9 @@ SHIM_CALL RtlInitUnicodeString_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t destination_ptr = SHIM_GET_ARG_32(0);
|
||||
uint32_t source_ptr = SHIM_GET_ARG_32(1);
|
||||
|
||||
auto source =
|
||||
source_ptr ? poly::load_and_swap<std::wstring>(SHIM_MEM_ADDR(source_ptr))
|
||||
: L"";
|
||||
auto source = source_ptr
|
||||
? xe::load_and_swap<std::wstring>(SHIM_MEM_ADDR(source_ptr))
|
||||
: L"";
|
||||
XELOGD("RtlInitUnicodeString(%.8X, %.8X = %ls)", destination_ptr, source_ptr,
|
||||
source.empty() ? L"<null>" : source.c_str());
|
||||
|
||||
@@ -286,9 +286,9 @@ SHIM_CALL RtlUnicodeStringToAnsiString_shim(PPCContext* ppc_state,
|
||||
// _In_ PCUNICODE_STRING SourceString,
|
||||
// _In_ BOOLEAN AllocateDestinationString
|
||||
|
||||
std::wstring unicode_str = poly::load_and_swap<std::wstring>(
|
||||
std::wstring unicode_str = xe::load_and_swap<std::wstring>(
|
||||
SHIM_MEM_ADDR(SHIM_MEM_32(source_ptr + 4)));
|
||||
std::string ansi_str = poly::to_string(unicode_str);
|
||||
std::string ansi_str = xe::to_string(unicode_str);
|
||||
if (ansi_str.size() > 0xFFFF - 1) {
|
||||
SHIM_SET_RETURN_32(X_STATUS_INVALID_PARAMETER_2);
|
||||
return;
|
||||
@@ -333,9 +333,9 @@ SHIM_CALL RtlMultiByteToUnicodeN_shim(PPCContext* ppc_state,
|
||||
// TODO: maybe use MultiByteToUnicode on Win32? would require swapping
|
||||
|
||||
for (uint32_t i = 0; i < copy_len; i++) {
|
||||
poly::store_and_swap<uint16_t>(
|
||||
xe::store_and_swap<uint16_t>(
|
||||
SHIM_MEM_ADDR(destination_ptr + i * 2),
|
||||
poly::load<uint8_t>(SHIM_MEM_ADDR(source_ptr + i)));
|
||||
xe::load<uint8_t>(SHIM_MEM_ADDR(source_ptr + i)));
|
||||
}
|
||||
|
||||
if (written_ptr != 0) {
|
||||
@@ -361,7 +361,7 @@ SHIM_CALL RtlUnicodeToMultiByteN_shim(PPCContext* ppc_state,
|
||||
auto source = (uint16_t*)SHIM_MEM_ADDR(source_ptr);
|
||||
auto destination = (uint8_t*)SHIM_MEM_ADDR(destination_ptr);
|
||||
for (uint32_t i = 0; i < copy_len; i++) {
|
||||
uint16_t c = poly::byte_swap(*source++);
|
||||
uint16_t c = xe::byte_swap(*source++);
|
||||
*destination++ = c < 256 ? (uint8_t)c : '?';
|
||||
}
|
||||
|
||||
@@ -552,13 +552,13 @@ SHIM_CALL RtlEnterCriticalSection_shim(PPCContext* ppc_state,
|
||||
|
||||
uint32_t spin_wait_remaining = cs->spin_count_div_256 * 256;
|
||||
spin:
|
||||
if (poly::atomic_inc(&cs->lock_count) != 0) {
|
||||
if (xe::atomic_inc(&cs->lock_count) != 0) {
|
||||
// If this thread already owns the CS increment the recursion count.
|
||||
if (cs->owning_thread_id == thread_id) {
|
||||
cs->recursion_count++;
|
||||
return;
|
||||
}
|
||||
poly::atomic_dec(&cs->lock_count);
|
||||
xe::atomic_dec(&cs->lock_count);
|
||||
|
||||
// Thread was locked - spin wait.
|
||||
if (spin_wait_remaining) {
|
||||
@@ -593,13 +593,13 @@ SHIM_CALL RtlTryEnterCriticalSection_shim(PPCContext* ppc_state,
|
||||
auto cs = (X_RTL_CRITICAL_SECTION*)SHIM_MEM_ADDR(cs_ptr);
|
||||
|
||||
uint32_t result = 0;
|
||||
if (poly::atomic_cas(-1, 0, &cs->lock_count)) {
|
||||
if (xe::atomic_cas(-1, 0, &cs->lock_count)) {
|
||||
// Able to steal the lock right away.
|
||||
cs->owning_thread_id = thread_id;
|
||||
cs->recursion_count = 1;
|
||||
result = 1;
|
||||
} else if (cs->owning_thread_id == thread_id) {
|
||||
poly::atomic_inc(&cs->lock_count);
|
||||
xe::atomic_inc(&cs->lock_count);
|
||||
++cs->recursion_count;
|
||||
result = 1;
|
||||
}
|
||||
@@ -619,13 +619,13 @@ SHIM_CALL RtlLeaveCriticalSection_shim(PPCContext* ppc_state,
|
||||
// Drop recursion count - if we are still not zero'ed return.
|
||||
uint32_t recursion_count = --cs->recursion_count;
|
||||
if (recursion_count) {
|
||||
poly::atomic_dec(&cs->lock_count);
|
||||
xe::atomic_dec(&cs->lock_count);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unlock!
|
||||
cs->owning_thread_id = 0;
|
||||
if (poly::atomic_dec(&cs->lock_count) != -1) {
|
||||
if (xe::atomic_dec(&cs->lock_count) != -1) {
|
||||
// There were waiters - wake one of them.
|
||||
// TODO(benvanik): wake a waiter.
|
||||
XELOGE("RtlLeaveCriticalSection would have woken a waiter");
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/objects/xthread.h"
|
||||
#include "xenia/kernel/objects/xuser_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/util/xex2.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -580,7 +580,7 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
wchar_t* swapped_format =
|
||||
(wchar_t*)malloc((format_length + 1) * sizeof(wchar_t));
|
||||
for (size_t i = 0; i < format_length; ++i) {
|
||||
swapped_format[i] = poly::byte_swap(format[i]);
|
||||
swapped_format[i] = xe::byte_swap(format[i]);
|
||||
}
|
||||
swapped_format[format_length] = '\0';
|
||||
|
||||
@@ -700,7 +700,7 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
assert_true(arg_size == 8 || arg_size == 4);
|
||||
if (arg_size == 8) {
|
||||
if (arg_extras == 0) {
|
||||
uint64_t value = poly::load_and_swap<uint64_t>(
|
||||
uint64_t value = xe::load_and_swap<uint64_t>(
|
||||
arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
|
||||
int result = wsprintf(b, local, value);
|
||||
b += result;
|
||||
@@ -710,7 +710,7 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
}
|
||||
} else if (arg_size == 4) {
|
||||
if (arg_extras == 0) {
|
||||
uint32_t value = (uint32_t)poly::load_and_swap<uint64_t>(
|
||||
uint32_t value = (uint32_t)xe::load_and_swap<uint64_t>(
|
||||
arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
|
||||
int result = wsprintf(b, local, value);
|
||||
b += result;
|
||||
@@ -722,9 +722,9 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
} else if (*end == 'n') {
|
||||
assert_true(arg_size == 4);
|
||||
if (arg_extras == 0) {
|
||||
uint32_t value = (uint32_t)poly::load_and_swap<uint64_t>(
|
||||
uint32_t value = (uint32_t)xe::load_and_swap<uint64_t>(
|
||||
arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
|
||||
poly::store_and_swap<uint32_t>(membase + value, (uint32_t)(b - buffer));
|
||||
xe::store_and_swap<uint32_t>(membase + value, (uint32_t)(b - buffer));
|
||||
arg_index++;
|
||||
} else {
|
||||
assert_true(false);
|
||||
@@ -736,7 +736,7 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
|
||||
assert_true(arg_size == 4);
|
||||
if (arg_extras == 0) {
|
||||
uint32_t value = (uint32_t)poly::load_and_swap<uint64_t>(
|
||||
uint32_t value = (uint32_t)xe::load_and_swap<uint64_t>(
|
||||
arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
|
||||
const void* pointer = (void*)(membase + value);
|
||||
int result = wsprintf(b, local, pointer);
|
||||
@@ -752,14 +752,14 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
|
||||
assert_true(arg_size == 4);
|
||||
if (arg_extras == 0) {
|
||||
uint32_t value = (uint32_t)poly::load_and_swap<uint64_t>(
|
||||
uint32_t value = (uint32_t)xe::load_and_swap<uint64_t>(
|
||||
arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
|
||||
const wchar_t* data = (const wchar_t*)(membase + value);
|
||||
size_t data_length = wcslen(data);
|
||||
wchar_t* swapped_data =
|
||||
(wchar_t*)malloc((data_length + 1) * sizeof(wchar_t));
|
||||
for (size_t i = 0; i < data_length; ++i) {
|
||||
swapped_data[i] = poly::byte_swap(data[i]);
|
||||
swapped_data[i] = xe::byte_swap(data[i]);
|
||||
}
|
||||
swapped_data[data_length] = '\0';
|
||||
int result = wsprintf(b, local, swapped_data);
|
||||
@@ -781,7 +781,7 @@ uint32_t vswprintf_core(wchar_t* buffer, const wchar_t* format,
|
||||
|
||||
// swap the result buffer
|
||||
for (wchar_t* swap = buffer; swap != b; ++swap) {
|
||||
*swap = poly::byte_swap(*swap);
|
||||
*swap = xe::byte_swap(*swap);
|
||||
}
|
||||
|
||||
return uint32_t(b - buffer);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/atomic.h"
|
||||
#include "xenia/base/atomic.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/kernel/dispatcher.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
@@ -19,7 +20,6 @@
|
||||
#include "xenia/kernel/objects/xtimer.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -63,7 +63,7 @@ void AssertNoNameCollision(KernelState* state, uint32_t obj_attributes_ptr) {
|
||||
// with a success of NAME_EXISTS.
|
||||
// If the name exists and its type doesn't match, we do NAME_COLLISION.
|
||||
// Otherwise, we add like normal.
|
||||
uint32_t name_str_ptr = poly::load_and_swap<uint32_t>(
|
||||
uint32_t name_str_ptr = xe::load_and_swap<uint32_t>(
|
||||
state->memory()->TranslateVirtual(obj_attributes_ptr + 4));
|
||||
if (name_str_ptr) {
|
||||
X_ANSI_STRING name_str(state->memory()->virtual_membase(), name_str_ptr);
|
||||
@@ -975,7 +975,7 @@ SHIM_CALL KfAcquireSpinLock_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
|
||||
// Lock.
|
||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||
while (!poly::atomic_cas(0, 1, lock)) {
|
||||
while (!xe::atomic_cas(0, 1, lock)) {
|
||||
// Spin!
|
||||
// TODO(benvanik): error on deadlock?
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ SHIM_CALL KfReleaseSpinLock_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
|
||||
// Unlock.
|
||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||
poly::atomic_dec(lock);
|
||||
xe::atomic_dec(lock);
|
||||
}
|
||||
|
||||
SHIM_CALL KeAcquireSpinLockAtRaisedIrql_shim(PPCContext* ppc_state,
|
||||
@@ -1015,7 +1015,7 @@ SHIM_CALL KeAcquireSpinLockAtRaisedIrql_shim(PPCContext* ppc_state,
|
||||
|
||||
// Lock.
|
||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||
while (!poly::atomic_cas(0, 1, lock)) {
|
||||
while (!xe::atomic_cas(0, 1, lock)) {
|
||||
// Spin!
|
||||
// TODO(benvanik): error on deadlock?
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ SHIM_CALL KeReleaseSpinLockFromRaisedIrql_shim(PPCContext* ppc_state,
|
||||
|
||||
// Unlock.
|
||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||
poly::atomic_dec(lock);
|
||||
xe::atomic_dec(lock);
|
||||
}
|
||||
|
||||
SHIM_CALL KeEnterCriticalRegion_shim(PPCContext* ppc_state,
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
@@ -15,7 +16,6 @@
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xboxkrnl_private.h"
|
||||
#include "xenia/kernel/xboxkrnl_rtl.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -309,7 +309,7 @@ SHIM_CALL VdInitializeScalerCommandBuffer_shim(PPCContext* ppc_state,
|
||||
size_t total_words = 0x1CC / 4;
|
||||
uint8_t* p = SHIM_MEM_ADDR(dest_ptr);
|
||||
for (size_t i = 0; i < total_words; ++i, p += 4) {
|
||||
poly::store_and_swap(p, 0x80000000);
|
||||
xe::store_and_swap(p, 0x80000000);
|
||||
}
|
||||
|
||||
// returns memcpy size >> 2 for memcpy(...,...,ret << 2)
|
||||
@@ -419,13 +419,13 @@ SHIM_CALL VdSwap_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
// use this method.
|
||||
memset(SHIM_MEM_ADDR(unk0), 0, 64 * 4);
|
||||
auto dwords = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(unk0));
|
||||
dwords[0] = poly::byte_swap((0x3 << 30) | ((63 - 1) << 16) |
|
||||
(xe::gpu::xenos::PM4_XE_SWAP << 8));
|
||||
dwords[1] = poly::byte_swap(frontbuffer);
|
||||
dwords[0] = xe::byte_swap((0x3 << 30) | ((63 - 1) << 16) |
|
||||
(xe::gpu::xenos::PM4_XE_SWAP << 8));
|
||||
dwords[1] = xe::byte_swap(frontbuffer);
|
||||
|
||||
// Set by VdCallGraphicsNotificationRoutines.
|
||||
dwords[2] = poly::byte_swap(last_frontbuffer_width_);
|
||||
dwords[3] = poly::byte_swap(last_frontbuffer_height_);
|
||||
dwords[2] = xe::byte_swap(last_frontbuffer_width_);
|
||||
dwords[3] = xe::byte_swap(last_frontbuffer_height_);
|
||||
|
||||
SHIM_SET_RETURN_64(0);
|
||||
}
|
||||
@@ -468,7 +468,7 @@ void xe::kernel::xboxkrnl::RegisterVideoExports(
|
||||
memory->SystemHeapAlloc(4, 32, kSystemHeapPhysical);
|
||||
export_resolver->SetVariableMapping("xboxkrnl.exe", ordinals::VdGlobalDevice,
|
||||
pVdGlobalDevice);
|
||||
poly::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGlobalDevice), 0);
|
||||
xe::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGlobalDevice), 0);
|
||||
|
||||
// VdGlobalXamDevice (4b)
|
||||
// Pointer to the XAM D3D device, which we don't have.
|
||||
@@ -476,8 +476,7 @@ void xe::kernel::xboxkrnl::RegisterVideoExports(
|
||||
memory->SystemHeapAlloc(4, 32, kSystemHeapPhysical);
|
||||
export_resolver->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::VdGlobalXamDevice, pVdGlobalXamDevice);
|
||||
poly::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGlobalXamDevice),
|
||||
0);
|
||||
xe::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGlobalXamDevice), 0);
|
||||
|
||||
// VdGpuClockInMHz (4b)
|
||||
// GPU clock. Xenos is 500MHz. Hope nothing is relying on this timing...
|
||||
@@ -485,8 +484,7 @@ void xe::kernel::xboxkrnl::RegisterVideoExports(
|
||||
memory->SystemHeapAlloc(4, 32, kSystemHeapPhysical);
|
||||
export_resolver->SetVariableMapping("xboxkrnl.exe", ordinals::VdGpuClockInMHz,
|
||||
pVdGpuClockInMHz);
|
||||
poly::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGpuClockInMHz),
|
||||
500);
|
||||
xe::store_and_swap<uint32_t>(memory->TranslateVirtual(pVdGpuClockInMHz), 500);
|
||||
|
||||
// VdHSIOCalibrationLock (28b)
|
||||
// CriticalSection.
|
||||
|
||||
@@ -73,7 +73,7 @@ void XObject::SetAttributes(const uint8_t* obj_attrs_ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t name_str_ptr = poly::load_and_swap<uint32_t>(obj_attrs_ptr + 4);
|
||||
uint32_t name_str_ptr = xe::load_and_swap<uint32_t>(obj_attrs_ptr + 4);
|
||||
if (name_str_ptr) {
|
||||
X_ANSI_STRING name_str(memory()->virtual_membase(), name_str_ptr);
|
||||
name_ = name_str.to_string();
|
||||
@@ -157,19 +157,19 @@ void XObject::SetNativePointer(uint32_t native_ptr) {
|
||||
auto header_be =
|
||||
kernel_state_->memory()->TranslateVirtual<DISPATCH_HEADER*>(native_ptr);
|
||||
DISPATCH_HEADER header;
|
||||
header.type_flags = poly::byte_swap(header_be->type_flags);
|
||||
header.signal_state = poly::byte_swap(header_be->signal_state);
|
||||
header.wait_list_flink = poly::byte_swap(header_be->wait_list_flink);
|
||||
header.wait_list_blink = poly::byte_swap(header_be->wait_list_blink);
|
||||
header.type_flags = xe::byte_swap(header_be->type_flags);
|
||||
header.signal_state = xe::byte_swap(header_be->signal_state);
|
||||
header.wait_list_flink = xe::byte_swap(header_be->wait_list_flink);
|
||||
header.wait_list_blink = xe::byte_swap(header_be->wait_list_blink);
|
||||
|
||||
assert_true(!(header.wait_list_blink & 0x1));
|
||||
|
||||
// Stash pointer in struct.
|
||||
uint64_t object_ptr = reinterpret_cast<uint64_t>(this);
|
||||
object_ptr |= 0x1;
|
||||
header_be->wait_list_flink = poly::byte_swap((uint32_t)(object_ptr >> 32));
|
||||
header_be->wait_list_flink = xe::byte_swap((uint32_t)(object_ptr >> 32));
|
||||
header_be->wait_list_blink =
|
||||
poly::byte_swap((uint32_t)(object_ptr & 0xFFFFFFFF));
|
||||
xe::byte_swap((uint32_t)(object_ptr & 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
XObject* XObject::GetObject(KernelState* kernel_state, void* native_ptr,
|
||||
@@ -187,10 +187,10 @@ XObject* XObject::GetObject(KernelState* kernel_state, void* native_ptr,
|
||||
|
||||
DISPATCH_HEADER* header_be = (DISPATCH_HEADER*)native_ptr;
|
||||
DISPATCH_HEADER header;
|
||||
header.type_flags = poly::byte_swap(header_be->type_flags);
|
||||
header.signal_state = poly::byte_swap(header_be->signal_state);
|
||||
header.wait_list_flink = poly::byte_swap(header_be->wait_list_flink);
|
||||
header.wait_list_blink = poly::byte_swap(header_be->wait_list_blink);
|
||||
header.type_flags = xe::byte_swap(header_be->type_flags);
|
||||
header.signal_state = xe::byte_swap(header_be->signal_state);
|
||||
header.wait_list_flink = xe::byte_swap(header_be->wait_list_flink);
|
||||
header.wait_list_blink = xe::byte_swap(header_be->wait_list_blink);
|
||||
|
||||
if (as_type == -1) {
|
||||
as_type = header.type_flags & 0xFF;
|
||||
@@ -248,9 +248,9 @@ XObject* XObject::GetObject(KernelState* kernel_state, void* native_ptr,
|
||||
// Stash pointer in struct.
|
||||
uint64_t object_ptr = reinterpret_cast<uint64_t>(object);
|
||||
object_ptr |= 0x1;
|
||||
header_be->wait_list_flink = poly::byte_swap((uint32_t)(object_ptr >> 32));
|
||||
header_be->wait_list_flink = xe::byte_swap((uint32_t)(object_ptr >> 32));
|
||||
header_be->wait_list_blink =
|
||||
poly::byte_swap((uint32_t)(object_ptr & 0xFFFFFFFF));
|
||||
xe::byte_swap((uint32_t)(object_ptr & 0xFFFFFFFF));
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user