[wip, win32] wip implementing missing win32 platform functions

This commit is contained in:
martinfouilleul 2023-06-16 20:07:26 +02:00
parent e884b14b25
commit f5f7c5d8ff
4 changed files with 133 additions and 82 deletions

@ -1 +1 @@
Subproject commit 6499bcd2a213028577f9543f50e84563a6695141 Subproject commit e93bf76adcf8e26b4d039da1066847bdf7b80d1f

View File

@ -35,7 +35,7 @@ io_cmp orca_io_wait_single_req(io_req* wasmReq)
{ {
//NOTE: change root to app local folder //NOTE: change root to app local folder
req.handle = orca->rootDir; req.handle = orca->rootDir;
req.openFlags |= FILE_OPEN_RESTRICT; req.open.flags |= FILE_OPEN_RESTRICT;
} }
} }
cmp = io_wait_single_req_with_table(&req, &orca->fileTable); cmp = io_wait_single_req_with_table(&req, &orca->fileTable);

View File

@ -357,7 +357,7 @@ void* orca_runloop(void* user)
M3Result res = m3_CompileModule(app->runtime.m3Module); M3Result res = m3_CompileModule(app->runtime.m3Module);
if(res) if(res)
{ {
M3ErrorInfo errInfo = {}; M3ErrorInfo errInfo = {0};
m3_GetErrorInfo(app->runtime.m3Runtime, &errInfo); m3_GetErrorInfo(app->runtime.m3Runtime, &errInfo);
log_error("wasm error: %s\n", errInfo.message); log_error("wasm error: %s\n", errInfo.message);
@ -424,7 +424,7 @@ void* orca_runloop(void* user)
str8 localRootPath = path_executable_relative(mem_scratch(), STR8("../app/data")); str8 localRootPath = path_executable_relative(mem_scratch(), STR8("../app/data"));
io_req req = {.op = IO_OP_OPEN_AT, io_req req = {.op = IO_OP_OPEN_AT,
.openFlags = FILE_OPEN_READ, .open.rights = FILE_ACCESS_READ,
.size = localRootPath.len, .size = localRootPath.len,
.buffer = localRootPath.ptr}; .buffer = localRootPath.ptr};
io_cmp cmp = io_wait_single_req_with_table(&req, &app->fileTable); io_cmp cmp = io_wait_single_req_with_table(&req, &app->fileTable);

View File

@ -8,6 +8,8 @@
#ifndef __ORCA_RUNTIME_H_ #ifndef __ORCA_RUNTIME_H_
#define __ORCA_RUNTIME_H_ #define __ORCA_RUNTIME_H_
#include"platform/platform_io_internal.h"
#include"wasm3.h" #include"wasm3.h"
#include"m3_env.h" #include"m3_env.h"
#include"m3_compile.h" #include"m3_compile.h"
@ -40,7 +42,6 @@ typedef struct g_event_handler_desc
} g_event_handler_desc; } g_event_handler_desc;
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = { const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
#define STR8LIT(s) {sizeof(s), s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant... #define STR8LIT(s) {sizeof(s), s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant...
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)}, #define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)},
@ -71,7 +72,57 @@ typedef struct orca_runtime
} orca_runtime; } orca_runtime;
typedef struct log_entry
{
list_elt listElt;
u64 cap;
log_level level;
str8 file;
str8 function;
int line;
str8 msg;
u64 recordIndex;
} log_entry;
typedef struct orca_debug_overlay
{
bool show;
mg_surface surface;
mg_canvas canvas;
mg_font fontReg;
mg_font fontBold;
ui_context ui;
mem_arena logArena;
list_info logEntries;
list_info logFreeList;
u32 entryCount;
u32 maxEntries;
u64 logEntryTotalCount;
bool logScrollToLast;
} orca_debug_overlay;
typedef struct orca_app
{
mp_window window;
mg_surface surface;
mg_canvas canvas;
file_table fileTable;
file_handle rootDir;
orca_runtime runtime;
orca_debug_overlay debugOverlay;
} orca_app;
orca_app* orca_app_get();
orca_runtime* orca_runtime_get(); orca_runtime* orca_runtime_get();