native.cpp
native.cpp
CPP1/* Copyright Statement:2 *3 * (C) 2021-2024 Cubios Inc. All rights reserved.4 */5#include <stdint.h>6#include "native_access.h"7#include "native.h"8#include <stdarg.h>9#include "AppManager.h"1011namespace Cubios {12uint32_t cubeN = 0;13}1415Cubios::AppManager mngr;1617extern void OnInit(Cubios::AppManager& mngr);181920WASM_EXPORT21void on_init(uint32_t cid) {22 Cubios::cubeN = cid;23 OnInit(mngr);24}2526WASM_EXPORT27void run() {28 mngr.Main();29}3031namespace Cubios {3233#define LOG_LINE_BUF_SIZE 1283435static char log_buf[LOG_LINE_BUF_SIZE] = { 0 };3637void log(uint8_t logLvl, const char *format, ...) {38 va_list args;39 va_start(args, format);40 vsnprintf(log_buf, LOG_LINE_BUF_SIZE, format, args);41 va_end(args);42 LOG(logLvl, log_buf);4344}4546}4748
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.