XECOUNT to countof.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <xenia/kernel/fs/devices/disc_image_device.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
#include <xenia/kernel/fs/gdfx.h>
|
||||
#include <xenia/kernel/fs/devices/disc_image_entry.h>
|
||||
|
||||
@@ -57,12 +58,12 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
|
||||
// Walk the path, one separator at a time.
|
||||
// We copy it into the buffer and shift it left over and over.
|
||||
char remaining[poly::max_path];
|
||||
xestrcpya(remaining, XECOUNT(remaining), path);
|
||||
xestrcpya(remaining, poly::countof(remaining), path);
|
||||
while (remaining[0]) {
|
||||
char* next_slash = strchr(remaining, '\\');
|
||||
if (next_slash == remaining) {
|
||||
// Leading slash - shift
|
||||
xestrcpya(remaining, XECOUNT(remaining), remaining + 1);
|
||||
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
|
||||
if (!next_slash) {
|
||||
break;
|
||||
}
|
||||
xestrcpya(remaining, XECOUNT(remaining), next_slash + 1);
|
||||
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
|
||||
}
|
||||
|
||||
Entry::Type type = gdfx_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <xenia/kernel/fs/devices/stfs_container_device.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
#include <xenia/kernel/fs/stfs.h>
|
||||
#include <xenia/kernel/fs/devices/stfs_container_entry.h>
|
||||
|
||||
@@ -57,12 +58,12 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
|
||||
// Walk the path, one separator at a time.
|
||||
// We copy it into the buffer and shift it left over and over.
|
||||
char remaining[poly::max_path];
|
||||
xestrcpya(remaining, XECOUNT(remaining), path);
|
||||
xestrcpya(remaining, poly::countof(remaining), path);
|
||||
while (remaining[0]) {
|
||||
char* next_slash = strchr(remaining, '\\');
|
||||
if (next_slash == remaining) {
|
||||
// Leading slash - shift
|
||||
xestrcpya(remaining, XECOUNT(remaining), remaining + 1);
|
||||
xestrcpya(remaining, poly::countof(remaining), remaining + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
|
||||
if (!next_slash) {
|
||||
break;
|
||||
}
|
||||
xestrcpya(remaining, XECOUNT(remaining), next_slash + 1);
|
||||
xestrcpya(remaining, poly::countof(remaining), next_slash + 1);
|
||||
}
|
||||
|
||||
Entry::Type type = stfs_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY ?
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <xenia/kernel/fs/gdfx.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
@@ -105,7 +106,7 @@ GDFX::Error GDFX::Verify(ParseState& state) {
|
||||
0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000,
|
||||
};
|
||||
bool magic_found = false;
|
||||
for (size_t n = 0; n < XECOUNT(likely_offsets); n++) {
|
||||
for (size_t n = 0; n < poly::countof(likely_offsets); n++) {
|
||||
state.game_offset = likely_offsets[n];
|
||||
if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) {
|
||||
magic_found = true;
|
||||
|
||||
@@ -219,7 +219,7 @@ X_STATUS XThread::Create() {
|
||||
}
|
||||
|
||||
char thread_name[32];
|
||||
xesnprintfa(thread_name, XECOUNT(thread_name), "XThread%04X", handle());
|
||||
xesnprintfa(thread_name, poly::countof(thread_name), "XThread%04X", handle());
|
||||
set_name(thread_name);
|
||||
|
||||
uint32_t proc_mask = creation_params_.creation_flags >> 24;
|
||||
@@ -366,22 +366,19 @@ void XThread::Execute() {
|
||||
// If a XapiThreadStartup value is present, we use that as a trampoline.
|
||||
// Otherwise, we are a raw thread.
|
||||
if (creation_params_.xapi_thread_startup) {
|
||||
uint64_t args[] = {
|
||||
creation_params_.start_address,
|
||||
creation_params_.start_context
|
||||
};
|
||||
kernel_state()->processor()->Execute(
|
||||
thread_state_,
|
||||
creation_params_.xapi_thread_startup, args, XECOUNT(args));
|
||||
uint64_t args[] = {creation_params_.start_address,
|
||||
creation_params_.start_context};
|
||||
kernel_state()->processor()->Execute(thread_state_,
|
||||
creation_params_.xapi_thread_startup,
|
||||
args, poly::countof(args));
|
||||
} else {
|
||||
// Run user code.
|
||||
uint64_t args[] = {
|
||||
creation_params_.start_context
|
||||
};
|
||||
uint64_t args[] = {creation_params_.start_context};
|
||||
int exit_code = (int)kernel_state()->processor()->Execute(
|
||||
thread_state_,
|
||||
creation_params_.start_address, args, XECOUNT(args));
|
||||
// If we got here it means the execute completed without an exit being called.
|
||||
thread_state_, creation_params_.start_address, args,
|
||||
poly::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.
|
||||
Exit(exit_code);
|
||||
}
|
||||
@@ -459,7 +456,7 @@ void XThread::DeliverAPCs(void* data) {
|
||||
thread->scratch_address_ + 12,
|
||||
};
|
||||
processor->ExecuteInterrupt(
|
||||
0, kernel_routine, kernel_args, XECOUNT(kernel_args));
|
||||
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);
|
||||
@@ -472,7 +469,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, XECOUNT(normal_args));
|
||||
0, normal_routine, normal_args, poly::countof(normal_args));
|
||||
thread->LockApc();
|
||||
}
|
||||
}
|
||||
@@ -498,7 +495,7 @@ void XThread::RundownAPCs() {
|
||||
// rundown_routine(apc)
|
||||
uint64_t args[] = { apc_address };
|
||||
kernel_state()->processor()->ExecuteInterrupt(
|
||||
0, rundown_routine, args, XECOUNT(args));
|
||||
0, rundown_routine, args, poly::countof(args));
|
||||
}
|
||||
}
|
||||
UnlockApc();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* #include <xenia/kernel/util/export_table_post.inc>
|
||||
* export_resolver_->RegisterTable(
|
||||
* "my_module.xex",
|
||||
* my_module_export_table, XECOUNT(my_module_export_table));
|
||||
* my_module_export_table, poly::countof(my_module_export_table));
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include <poly/math.h>
|
||||
#include <third_party/crypto/rijndael-alg-fst.h>
|
||||
#include <third_party/crypto/rijndael-alg-fst.c>
|
||||
#include <third_party/mspack/lzx.h>
|
||||
@@ -237,7 +238,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
break;
|
||||
case XEX_HEADER_IMPORT_LIBRARIES:
|
||||
{
|
||||
const size_t max_count = XECOUNT(header->import_libraries);
|
||||
const size_t max_count = poly::countof(header->import_libraries);
|
||||
size_t count = poly::load_and_swap<uint32_t>(pp + 0x08);
|
||||
assert_true(count <= max_count);
|
||||
if (count > max_count) {
|
||||
@@ -263,7 +264,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
for (size_t i = 0, j = 0; i < string_table_size;) {
|
||||
assert_true(j <= 0xFF);
|
||||
if (j == name_index) {
|
||||
xestrcpya(library->name, XECOUNT(library->name),
|
||||
xestrcpya(library->name, poly::countof(library->name),
|
||||
string_table + i);
|
||||
break;
|
||||
}
|
||||
@@ -292,7 +293,7 @@ int xe_xex2_read_header(const uint8_t *addr, const size_t length,
|
||||
break;
|
||||
case XEX_HEADER_STATIC_LIBRARIES:
|
||||
{
|
||||
const size_t max_count = XECOUNT(header->static_libraries);
|
||||
const size_t max_count = poly::countof(header->static_libraries);
|
||||
size_t count = (opt_header->length - 4) / 16;
|
||||
assert_true(count <= max_count);
|
||||
if (count > max_count) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <xenia/kernel/xam_module.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
@@ -27,7 +28,7 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) :
|
||||
};
|
||||
#include <xenia/kernel/util/export_table_post.inc>
|
||||
export_resolver_->RegisterTable(
|
||||
"xam.xex", xam_export_table, XECOUNT(xam_export_table));
|
||||
"xam.xex", xam_export_table, poly::countof(xam_export_table));
|
||||
|
||||
// Register all exported functions.
|
||||
xam::RegisterContentExports(export_resolver_, kernel_state);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <xenia/kernel/xboxkrnl_module.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
@@ -34,8 +34,8 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) :
|
||||
#include <xenia/kernel/xboxkrnl_table.inc>
|
||||
};
|
||||
#include <xenia/kernel/util/export_table_post.inc>
|
||||
export_resolver_->RegisterTable(
|
||||
"xboxkrnl.exe", xboxkrnl_export_table, XECOUNT(xboxkrnl_export_table));
|
||||
export_resolver_->RegisterTable("xboxkrnl.exe", xboxkrnl_export_table,
|
||||
poly::countof(xboxkrnl_export_table));
|
||||
|
||||
// Register all exported functions.
|
||||
xboxkrnl::RegisterAudioExports(export_resolver_, kernel_state);
|
||||
@@ -113,7 +113,7 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) :
|
||||
pExLoadedCommandLine);
|
||||
char command_line[] = "\"default.xex\"";
|
||||
xe_copy_memory(mem + pExLoadedCommandLine, 1024,
|
||||
command_line, XECOUNT(command_line) + 1);
|
||||
command_line, poly::countof(command_line) + 1);
|
||||
|
||||
// XboxKrnlVersion (8b)
|
||||
// Kernel version, looks like 2b.2b.2b.2b.
|
||||
|
||||
Reference in New Issue
Block a user