add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.
This commit is contained in:
1 parent
2c4a68a75f
commit
ed3d065abd
156 files changed
+10509
-2643
No files matched your search
+44
-13
@@ -55,12 +55,21 @@ static void* doom_open_wrapper(const char* path, const char* mode)
|
||||
uint32_t handle = 0;
|
||||
uint32_t result;
|
||||
|
||||
SYS_PATH_HANDLE_REQUEST req = { SysSvFromCstr(path), &handle };
|
||||
uint32_t access = SYS_FILE_ACCESS_QUERY;
|
||||
uint32_t disposition = SYS_FILE_OPEN_EXISTING;
|
||||
if (mode[0] == 'w') {
|
||||
result = SysCreateFile(&req);
|
||||
access |= SYS_FILE_ACCESS_WRITE;
|
||||
disposition = SYS_FILE_CREATE_ALWAYS;
|
||||
} else {
|
||||
result = SysOpenFile(&req);
|
||||
access |= SYS_FILE_ACCESS_READ;
|
||||
}
|
||||
|
||||
SYS_OPEN_FILE_REQUEST req = SysMakeOpenFileRequest(SysSvFromCstr(path),
|
||||
access,
|
||||
disposition,
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&handle);
|
||||
result = SysOpenFile(&req);
|
||||
if (result != 0) return 0;
|
||||
|
||||
DOOM_FILE_HANDLE* f = (DOOM_FILE_HANDLE*)malloc(sizeof(DOOM_FILE_HANDLE));
|
||||
@@ -69,9 +78,17 @@ static void* doom_open_wrapper(const char* path, const char* mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t size = 0;
|
||||
result = SysGetFileSize(handle, &size);
|
||||
if (result != 0) {
|
||||
SysCloseHandle(handle);
|
||||
free(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f->Handle = handle;
|
||||
f->Pos = 0;
|
||||
f->Size = SysGetFileSize(handle);
|
||||
f->Size = size;
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -155,9 +172,16 @@ static int doom_eof_wrapper(void* handle)
|
||||
// ---------------------------------------------------------------------------
|
||||
static void doom_gettime_wrapper(int* sec, int* usec)
|
||||
{
|
||||
uint64_t t = SysGetTick();
|
||||
*sec = (int)(t / 1000000); // 1,000,000 us = 1 second
|
||||
*usec = (int)(t % 1000000); // Remainder in microseconds
|
||||
uint64_t frequency = 0;
|
||||
if (SysGetTickFrequency(&frequency) != STATUS_SUCCESS || !frequency) {
|
||||
*sec = 0;
|
||||
*usec = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t totalUs = SysTicksToMicroseconds(SysGetTick(), frequency);
|
||||
*sec = (int)(totalUs / 1000000);
|
||||
*usec = (int)(totalUs % 1000000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -169,7 +193,7 @@ static void doom_exit_wrapper(int code)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// doom_getenv_fn
|
||||
// doom_getenv_fn
|
||||
// ---------------------------------------------------------------------------
|
||||
static char* doom_getenv_wrapper(const char* name)
|
||||
{
|
||||
@@ -204,7 +228,7 @@ static const KeyMap g_keymap[] = {
|
||||
{ INPUT_KEY_LEFT, DOOM_KEY_LEFT_ARROW },
|
||||
{ INPUT_KEY_RIGHT, DOOM_KEY_RIGHT_ARROW },
|
||||
|
||||
// Action keys
|
||||
// Action keys
|
||||
{ INPUT_KEY_LEFT_CTRL, DOOM_KEY_CTRL },
|
||||
{ INPUT_KEY_SPACE, DOOM_KEY_SPACE },
|
||||
{ INPUT_KEY_LEFT_SHIFT, DOOM_KEY_SHIFT },
|
||||
@@ -250,10 +274,17 @@ static const KeyMap g_keymap[] = {
|
||||
|
||||
static bool g_prev_key[KEYMAP_COUNT];
|
||||
|
||||
// Returns whether one NTLite input key is currently held.
|
||||
static bool ntlite_key_down(INPUT_KEY key)
|
||||
{
|
||||
bool down = false;
|
||||
return SysIsKeyDown(key, &down) == STATUS_SUCCESS && down;
|
||||
}
|
||||
|
||||
static void poll_input(void)
|
||||
{
|
||||
for (int i = 0; i < (int)KEYMAP_COUNT; i++) {
|
||||
bool cur_down = (SysIsKeyDown(g_keymap[i].inputKey) != 0);
|
||||
bool cur_down = ntlite_key_down(g_keymap[i].inputKey);
|
||||
bool prev_down = g_prev_key[i];
|
||||
|
||||
if (cur_down && !prev_down) doom_key_down(g_keymap[i].key);
|
||||
@@ -280,7 +311,7 @@ static void init_surface(void)
|
||||
{
|
||||
uint32_t s = SysCreateSurface(DISP_W, DISP_H, SYS_SURFACE_FORMAT_XRGB8888,
|
||||
SYS_SURFACE_FLAG_NONE, &g_surface_handle);
|
||||
if (s != SYS_STATUS_SUCCESS || !g_surface_handle) {
|
||||
if (s != STATUS_SUCCESS || !g_surface_handle) {
|
||||
doom_print_wrapper("doom: SysCreateSurface failed\n");
|
||||
SysExitProcess(1);
|
||||
}
|
||||
@@ -288,7 +319,7 @@ static void init_surface(void)
|
||||
void* base = 0;
|
||||
uint32_t pitchBytes = 0;
|
||||
s = SysMapSurface(g_surface_handle, &base, &pitchBytes);
|
||||
if (s != SYS_STATUS_SUCCESS || !base || pitchBytes < DISP_W * sizeof(uint32_t)) {
|
||||
if (s != STATUS_SUCCESS || !base || pitchBytes < DISP_W * sizeof(uint32_t)) {
|
||||
doom_print_wrapper("doom: SysMapSurface failed\n");
|
||||
SysExitProcess(1);
|
||||
}
|
||||
@@ -328,7 +359,7 @@ static void render_frame(const uint8_t* rgba)
|
||||
|
||||
DISPLAY_RECT rect = { 0, 0, DISP_W, DISP_H };
|
||||
uint32_t code = SysPresentSurface(g_surface_handle, &rect, 1);
|
||||
if (code != SYS_STATUS_SUCCESS) {
|
||||
if (code != STATUS_SUCCESS) {
|
||||
SysExitProcess(code);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user