Merge remote-tracking branch 'GliniakRepo/experimentals' into canary_experimental

This commit is contained in:
Gliniak
2022-05-19 10:51:44 +02:00
12 changed files with 64 additions and 20 deletions

View File

@@ -140,7 +140,7 @@ dword_result_t xeXamContentCreate(dword_t user_index, lpstring_t root_name,
}
auto run = [content_manager, root_name = root_name.value(), flags,
content_data, disposition_ptr, license_mask_ptr](
content_data, disposition_ptr, license_mask_ptr, overlapped_ptr](
uint32_t& extended_error, uint32_t& length) -> X_RESULT {
X_RESULT result = X_ERROR_INVALID_PARAMETER;
bool create = false;
@@ -217,6 +217,11 @@ dword_result_t xeXamContentCreate(dword_t user_index, lpstring_t root_name,
extended_error = X_HRESULT_FROM_WIN32(result);
length = disposition;
if (result && overlapped_ptr) {
result = X_ERROR_FUNCTION_FAILED;
}
return result;
};

View File

@@ -37,8 +37,8 @@ uint32_t xeXamEnumerate(uint32_t handle, uint32_t flags, lpvoid_t buffer_ptr,
return X_ERROR_INVALID_HANDLE;
}
auto run = [e, buffer_ptr](uint32_t& extended_error,
uint32_t& length) -> X_RESULT {
auto run = [e, buffer_ptr, overlapped_ptr](uint32_t& extended_error,
uint32_t& length) -> X_RESULT {
X_RESULT result;
uint32_t item_count = 0;
if (!buffer_ptr) {
@@ -49,6 +49,9 @@ uint32_t xeXamEnumerate(uint32_t handle, uint32_t flags, lpvoid_t buffer_ptr,
}
extended_error = X_HRESULT_FROM_WIN32(result);
length = item_count;
if (result && overlapped_ptr) {
result = X_ERROR_FUNCTION_FAILED;
}
return result;
};

View File

@@ -26,6 +26,7 @@
#include "third_party/fmt/include/fmt/format.h"
DEFINE_int32(avpack, 8, "Video modes", "Video");
DECLARE_int32(user_language);
namespace xe {
namespace kernel {
@@ -210,16 +211,16 @@ dword_result_t XGetGameRegion_entry() { return xeXGetGameRegion(); }
DECLARE_XAM_EXPORT1(XGetGameRegion, kNone, kStub);
dword_result_t XGetLanguage_entry() {
auto desired_language = XLanguage::kEnglish;
auto desired_language = static_cast<XLanguage>(cvars::user_language);
// Switch the language based on game region.
// TODO(benvanik): pull from xex header.
uint32_t game_region = XEX_REGION_NTSCU;
/* uint32_t game_region = XEX_REGION_NTSCU;
if (game_region & XEX_REGION_NTSCU) {
desired_language = XLanguage::kEnglish;
} else if (game_region & XEX_REGION_NTSCJ) {
desired_language = XLanguage::kJapanese;
}
}*/
// Add more overrides?
return uint32_t(desired_language);

View File

@@ -278,12 +278,16 @@ uint32_t XamUserReadProfileSettingsEx(uint32_t title_id, uint32_t user_index,
if (xuids) {
out_setting->xuid = user_profile->xuid();
} else {
out_setting->xuid = -1;
out_setting->user_index = static_cast<uint32_t>(user_index);
}
out_setting->setting_id = setting_id;
if (setting && setting->is_set) {
setting->Append(&out_setting->data, &out_stream);
if (setting) {
out_setting->data.type = uint8_t(setting->type);
if (setting->is_set) {
setting->Append(&out_setting->data, &out_stream);
}
}
++out_setting;
}

View File

@@ -45,14 +45,19 @@ MAKE_DUMMY_STUB_STATUS(DmGetXboxName);
dword_result_t DmIsDebuggerPresent_entry() { return 0; }
DECLARE_XBDM_EXPORT1(DmIsDebuggerPresent, kDebug, kStub);
MAKE_DUMMY_STUB_STATUS(DmRegisterCommandProcessor);
void DmSendNotificationString_entry(lpdword_t unk0_ptr) {}
DECLARE_XBDM_EXPORT1(DmSendNotificationString, kDebug, kStub);
dword_result_t DmRegisterCommandProcessor_entry(lpdword_t name_ptr,
lpdword_t handler_fn) {
// Return success to prevent some games from crashing
return X_STATUS_SUCCESS;
}
DECLARE_XBDM_EXPORT1(DmRegisterCommandProcessor, kDebug, kStub);
dword_result_t DmRegisterCommandProcessorEx_entry(lpdword_t name_ptr,
lpdword_t handler_fn,
dword_t unk3) {
lpdword_t handler_fn,
dword_t unk3) {
// Return success to prevent some games from stalling
return X_STATUS_SUCCESS;
}

View File

@@ -385,6 +385,9 @@ dword_result_t XMABlockWhileInUse_entry(lpvoid_t context_ptr) {
if (!context.input_buffer_0_valid && !context.input_buffer_1_valid) {
break;
}
if (!context.work_buffer_ptr) {
break;
}
xe::threading::Sleep(std::chrono::milliseconds(1));
} while (true);
return 0;

View File

@@ -372,6 +372,12 @@ dword_result_t MmAllocatePhysicalMemoryEx_entry(
// min_addr_range/max_addr_range are bounds in physical memory, not virtual.
uint32_t heap_base = heap->heap_base();
uint32_t heap_physical_address_offset = heap->GetPhysicalAddress(heap_base);
// TODO(Gliniak): Games like 545108B4 compares min_addr_range with value returned.
// 0x1000 offset causes it to go below that minimal range and goes haywire
if (min_addr_range && max_addr_range) {
heap_physical_address_offset = 0;
}
uint32_t heap_min_addr =
xe::sat_sub(min_addr_range.value(), heap_physical_address_offset);
uint32_t heap_max_addr =