repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
|---|---|---|
mincrmatt12/MSign
|
esp/main/dupm.h
|
#ifndef MSN_DUPM_H
#define MSN_DUPM_H
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
#include <type_traits>
#include "common/bheap.h"
#include "common/heapsize.h"
#include "common/slots.h"
namespace serial {
struct DataUpdateRequest {
enum : uint16_t {
// sent from servicer as packets
TypeSetTemp,
TypeMarkDirty,
// sent by grabbers
TypeChangeSize,
TypePatch,
TypeSync
} type;
union {
struct {
uint16_t slotid;
uint8_t newtemperature;
} d_temp;
struct {
uint16_t slotid;
uint16_t offset;
const void * data;
uint16_t length;
} d_patch;
struct {
uint16_t slotid;
uint16_t size;
} d_chsize;
struct {
TaskHandle_t with;
TickType_t by;
} d_sync;
struct {
uint16_t slotid;
uint16_t offset;
uint16_t size;
} d_dirty;
};
};
struct DataUpdateManager {
// Put a request into the queue.
bool queue_request(const DataUpdateRequest &req);
void run();
// PACKET API
// Returns true if a) a packet is pending in and
// b) the passed packet should be processed by us.
bool is_packet_in_pending(const uint8_t *packet_to_check);
// Actually process a packet, returning whether or not we actually parsed it.
// This will clobber some bits in the task notification word.
bool process_input_packet(uint8_t *packet);
// Initialize queues
void init();
private:
QueueHandle_t pending{};
TaskHandle_t dupm_task, waiting_task;
// Pending input stuff
// Type-erasure for packet-pend
struct PacketFilter {
virtual bool wants(const uint8_t *packet_to_check) const = 0;
};
template<typename Func>
struct PacketFilterWrapper : PacketFilter {
static_assert(
std::is_invocable_r_v<bool, Func, const uint8_t *> ||
std::is_invocable_r_v<bool, Func, const slots::PacketWrapper<>&>
);
bool wants(const uint8_t *packet_to_check) const override {
if constexpr (std::is_invocable_r_v<bool, Func, const uint8_t *>) {
return functor(packet_to_check);
}
else {
return functor(*reinterpret_cast<const slots::PacketWrapper<> *>(packet_to_check));
}
}
PacketFilterWrapper(const Func& functor) : functor(functor) {}
const Func& functor;
};
// Internal helpers
template<typename Func>
slots::PacketWrapper<>& wait_for_packet(Func&& filter, TickType_t timeout=portMAX_DELAY) {
PacketFilterWrapper<Func> f{filter};
pending_packet_in = &f;
return wait_for_packet(timeout);
}
slots::PacketWrapper<>& wait_for_packet(TickType_t timeout);
void finished_with_last_packet(bool processed=true);
const PacketFilter *pending_packet_in;
uint8_t *pkt_buf;
bheap::Arena<ESP_HEAP_SIZE> arena;
bool sync_pending;
// Handlers
void change_size_handler(DataUpdateRequest &dur);
void set_temp_handler(DataUpdateRequest &dur, bool send_pkt=true);
void patch_handler(DataUpdateRequest &dur);
void mark_dirty_handler(DataUpdateRequest &dur);
// Sends all dirty blocks out
void send_pending_dirty_blocks();
// Allocation subroutines
enum UseIntent {
UseForRemoteStorage, // Make space for a remote chunk due to no local space
UseForRemoteDisplay, // Make space for hot chunk
TryForRemoteCache, // Attempt to make space for warm chunk
TryForLocalDedup // Attempt to make space for local blocks by moving stuff to the STM (specifically warm/hot blocks to avoid duplicating them)
};
// Ensure there's a bit more space (at least enough to store 1 remote header) in our local heap. This is separate from TryForLocalDedup as that doesn't
// try to evict cold blocks (since it's designed for trying to optimize for really low mem situations)
void cleanout_esp_space();
// Perform single DATA_STORE/DATA_FULFILL "cycle" (i.e. no retry handling), and return the status code (or a timeout).
//
// The data to send is either taken from a pointer (which you're supposed to find from the heap first), or can be null which
// will just send zeroes.
slots::protocol::DataStoreFulfillResult single_store_fulfill(uint16_t slotid, uint16_t offset, uint16_t length, const void * datasource, bool is_store);
// Calculate the current "stm memory budget"
struct StmMemoryBudgetInfo {
// Space that nothing is using, can be allocated to anything else.
uint16_t unused_space{};
// Space currently used by hot blocks.
uint16_t hot_remote{}, hot_ephemeral{};
// Space currently used by unsupressed warm blocks
uint16_t warm_remote{}, allocated_warm_ephemeral{};
// Space used by all cold remote blocks (since hot/warm are already considered)
uint16_t cold_remote{};
// Helpers
size_t free_by(uint16_t& parameter, size_t amount) {return xfer_into(parameter, amount, unused_space);}
size_t use_for(uint16_t ¶meter, size_t amount) {return xfer_into(unused_space, amount, parameter);}
size_t xfer_into(uint16_t ¶meter, size_t by, uint16_t& into) {
if (parameter < by) by = parameter;
parameter -= by;
into += by;
return by;
}
uint16_t hot() { return hot_remote + hot_ephemeral; }
uint16_t allocated_warm() { return warm_remote + allocated_warm_ephemeral; }
uint16_t remote() { return cold_remote + warm_remote + hot_remote; }
};
// Move stuff around such that there's space available or reclaim used space from a certain slotid.
//
// RemoteStorage: the "extra space" portion of the budget
// RemoteDisplay: the "hot" portion of the budget
// RemoteCache: try to move old stuff to give at least "delta_size_change" more bytes in the warm region, returning true if any change was made.
bool ensure_budget_space(UseIntent reason, uint16_t slotid, ssize_t delta_size_change);
bool ensure_budget_space(UseIntent reason, uint16_t slotid, ssize_t delta_size_change, StmMemoryBudgetInfo& use_budget);
StmMemoryBudgetInfo calculate_memory_budget();
// "Free" up space by searching for blocks that match "from_blocks_matching", by doing "by_doing" to them.
// This function might free more than target_amount if there's more space in the blocks and it decides that not keeping
// all of them is better for fragmentation reasons.
template<typename Pred, typename Handler>
std::enable_if_t<
std::is_invocable_r_v<bool, Pred, const bheap::Block&> &&
std::is_invocable_r_v<ssize_t, Handler, bheap::Block&, size_t>,
size_t> free_space_matching_using(size_t target_amount, Pred&& from_blocks_matching, Handler&& by_doing);
// Free entire slots (but potentially only reaping the rewards of part of them) by calling a function.
template<typename Pred, typename Handler>
std::enable_if_t<
std::is_invocable_r_v<bool, Pred, const bheap::Block&> &&
std::is_invocable_r_v<bool, Handler, uint16_t>,
size_t> free_slots_matching_using(size_t target_amount, Pred&& from_blocks_matching, Handler&& by_doing);
// Various free routines
void perform_warm_ephemeral_reclaim(StmMemoryBudgetInfo& budget, size_t amount, uint16_t ignore_slotid=0xfff);
void perform_cold_remote_reclaim(StmMemoryBudgetInfo& budget, size_t amount, uint16_t ignore_slotid=0xfff);
// Call after freeing up space for more warm blocks on STM to send them out.
void try_reclaim_supressed_warm();
// Inform the STM that the temperature has been reduced
void inform_temp_change(uint16_t slotid, uint8_t temp);
// Move a block to the STM (useable as a handler for free_space_using)
bool move_block_to_stm(const bheap::Block& tgt, size_t subsection_length);
};
};
#endif
|
mincrmatt12/MSign
|
stm/src/color.h
|
#ifndef MSN_COLOR_H
#define MSN_COLOR_H
#include <stdint.h>
#include <utility>
#include <algorithm>
namespace led {
struct color_t {
constexpr color_t(uint16_t r, uint16_t g, uint16_t b) :
r(r), g(g), b(b) {}
constexpr color_t() : r(0), g(0), b(0) {}
constexpr color_t(uint16_t gray) : r(gray), g(gray), b(gray) {}
union {
struct {
uint16_t r;
uint16_t g;
uint16_t b;
};
uint16_t components[3];
};
uint16_t get_spare() const {
return ((r & 0xf000) >> 4) | ((g & 0xf000) >> 8) | ((b & 0xf000) >> 12);
}
void set_spare(uint16_t value) {
r = (r & 0x0fff) | (value & 0x0f00) << 4;
g = (g & 0x0fff) | (value & 0x00f0) << 8;
b = (b & 0x0fff) | (value & 0x000f) << 12;
}
#define make_op(x) color_t operator x(const color_t& other) const {return color_t(r x other.r, g x other.g, b x other.b);} \
color_t& operator x##= (const color_t& other) {r x##= other.r; g x##= other.g; b x##= other.b; return *this;}
make_op(+)
make_op(-)
make_op(/)
make_op(*)
#undef make_op
color_t mix(const color_t& other, uint8_t factor /* from 0-255 */) const {
return color_t(
r + ((((int)other.r - (int)this->r) * (int)factor) / 255),
g + ((((int)other.g - (int)this->g) * (int)factor) / 255),
b + ((((int)other.b - (int)this->b) * (int)factor) / 255)
);
}
};
}
#endif
|
mincrmatt12/MSign
|
sim/src/esp/esp_log.c
|
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdarg.h>
#include <stdlib.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <stdio.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>
#include "esp_log.h"
#include <FreeRTOS.h>
#include <semphr.h>
#define LOG_COLOR_HEAD "\033[0;%dm"
#define LOG_BOLD_HEAD "\033[1;%dm"
#define LOG_COLOR_END "\033[0m"
static const uint32_t s_log_color[ESP_LOG_MAX] = {
0, // ESP_LOG_NONE
31, // ESP_LOG_ERROR
33, // ESP_LOG_WARN
34, // ESP_LOG_INFO
0, // ESP_LOG_DEBUG
0, // ESP_LOG_VERBOSE
};
static const char s_log_prefix[ESP_LOG_MAX] = {
'N', // ESP_LOG_NONE
'E', // ESP_LOG_ERROR
'W', // ESP_LOG_WARN
'I', // ESP_LOG_INFO
'D', // ESP_LOG_DEBUG
'V', // ESP_LOG_VERBOSE
};
static SemaphoreHandle_t semaphore = NULL;
static int log_putchar(int c) {
if (semaphore == NULL) {
semaphore = xSemaphoreCreateMutex();
}
xSemaphoreTake(semaphore, portMAX_DELAY);
fputc(c, stderr);
xSemaphoreGive(semaphore);
return 1;
}
static putchar_like_t s_putchar_func = &log_putchar;
static int esp_log_write_str(const char *s)
{
int ret;
do {
ret = s_putchar_func(*s);
} while (ret != EOF && *++s);
return ret;
}
static uint32_t fake_Timer = 0;
uint32_t esp_log_timestamp() {
return fake_Timer++;
}
/**
* @brief Write message into the log
*/
void esp_log_write(esp_log_level_t level, const char *tag, const char *fmt, ...)
{
int ret;
va_list va;
char *pbuf;
char prefix;
static char buf[16];
uint32_t color = level >= ESP_LOG_MAX ? 0 : s_log_color[level];
if (color) {
sprintf(buf, LOG_COLOR_HEAD, color);
ret = esp_log_write_str(buf);
if (ret == EOF)
goto exit;
}
prefix = level >= ESP_LOG_MAX ? 'N' : s_log_prefix[level];
ret = asprintf(&pbuf, "%c (%d) %s: ", prefix, esp_log_early_timestamp(), tag);
if (ret < 0)
goto out;
ret = esp_log_write_str(pbuf);
free(pbuf);
if (ret == EOF)
goto exit;
va_start(va, fmt);
ret = vasprintf(&pbuf, fmt, va);
va_end(va);
if (ret < 0)
goto out;
ret = esp_log_write_str(pbuf);
free(pbuf);
if (ret == EOF)
goto exit;
out:
if (color) {
ret = esp_log_write_str(LOG_COLOR_END);
if (ret == EOF)
goto exit;
}
if (ret > 0)
s_putchar_func('\n');
exit:
;
}
/**
* @brief Set function used to output log entries
*/
putchar_like_t esp_log_set_putchar(putchar_like_t func)
{
putchar_like_t tmp;
tmp = s_putchar_func;
s_putchar_func = func;
return tmp;
}
|
mincrmatt12/MSign
|
stm/src/pins.h
|
<reponame>mincrmatt12/MSign<gh_stars>1-10
#ifndef PINS_H
#define PINS_H
// Define a bunch of names depending on the active build target
#ifdef STM32F207xx
#define ESP_USART USART6
#define ESP_USART_Port GPIOG
#define ESP_USART_TX LL_GPIO_PIN_14
#define ESP_USART_RX LL_GPIO_PIN_9
#define ESP_USART_IRQ_NAME USART6_IRQn
#define ESP_USART_IRQ_HANDLER USART6_IRQHandler
#define SIGN_DATA_Port GPIOD
#define SIGN_GPIO_PERIPH LL_AHB1_GRP1_PERIPH_GPIOD
#define UART_DMA DMA2
#define UART_DMA_TX_Stream LL_DMA_STREAM_7
#define UART_DMA_RX_Stream LL_DMA_STREAM_1
#define UART_DMA_Channel LL_DMA_CHANNEL_5
#define UART_DMA_PERIPH LL_AHB1_GRP1_PERIPH_DMA2
#define UART_GPIO_PERIPH LL_AHB1_GRP1_PERIPH_GPIOG
#define UART_UART_PERIPH LL_APB2_GRP1_PERIPH_USART6
#define UART_ENABLE_CALL LL_APB2_GRP1_EnableClock
#define UART_Af LL_GPIO_AF_8
#define NVIC_SRV_RX_IRQ_NAME DMA2_Stream1_IRQn
#define NVIC_SRV_TX_IRQ_NAME DMA2_Stream7_IRQn
#define NVIC_SRV_RX_IRQ_HANDLER DMA2_Stream1_IRQHandler
#define NVIC_SRV_TX_IRQ_HANDLER DMA2_Stream7_IRQHandler
#define NVIC_SRV_RX_ACTV LL_DMA_IsActiveFlag_TC1
#define NVIC_SRV_RXE_ACTV LL_DMA_IsActiveFlag_TE1
#define NVIC_SRV_TX_ACTV LL_DMA_IsActiveFlag_TC7
#define NVIC_SRV_RX_CLRF LL_DMA_ClearFlag_TC1
#define NVIC_SRV_RXE_CLRF LL_DMA_ClearFlag_TE1
#define NVIC_SRV_TX_CLRF LL_DMA_ClearFlag_TC7
#define UI_BUTTON_PORT GPIOA
#define UI_BUTTON_PERIPH LL_AHB1_GRP1_PERIPH_GPIOA
#endif
#ifdef STM32F205xx
#define ESP_USART USART2
#define ESP_USART_Port GPIOA
#define ESP_USART_TX LL_GPIO_PIN_2
#define ESP_USART_RX LL_GPIO_PIN_3
#define ESP_USART_IRQ_NAME USART2_IRQn
#define ESP_USART_IRQ_HANDLER USART2_IRQHandler
#define SIGN_DATA_Port GPIOC
#define SIGN_GPIO_PERIPH LL_AHB1_GRP1_PERIPH_GPIOC
#define UART_DMA DMA1
#define UART_DMA_TX_Stream LL_DMA_STREAM_6
#define UART_DMA_RX_Stream LL_DMA_STREAM_5
#define UART_DMA_Channel LL_DMA_CHANNEL_4
#define UART_DMA_PERIPH LL_AHB1_GRP1_PERIPH_DMA1
#define UART_GPIO_PERIPH LL_AHB1_GRP1_PERIPH_GPIOA
#define UART_UART_PERIPH LL_APB1_GRP1_PERIPH_USART2
#define UART_ENABLE_CALL LL_APB1_GRP1_EnableClock
#define UART_Af LL_GPIO_AF_7
#define NVIC_SRV_RX_IRQ_NAME DMA1_Stream5_IRQn
#define NVIC_SRV_TX_IRQ_NAME DMA1_Stream6_IRQn
#define NVIC_SRV_RX_IRQ_HANDLER DMA1_Stream5_IRQHandler
#define NVIC_SRV_TX_IRQ_HANDLER DMA1_Stream6_IRQHandler
#define NVIC_SRV_RX_ACTV LL_DMA_IsActiveFlag_TC5
#define NVIC_SRV_RXE_ACTV LL_DMA_IsActiveFlag_TE5
#define NVIC_SRV_TX_ACTV LL_DMA_IsActiveFlag_TC6
#define NVIC_SRV_RX_CLRF LL_DMA_ClearFlag_TC5
#define NVIC_SRV_RXE_CLRF LL_DMA_ClearFlag_TE5
#define NVIC_SRV_TX_CLRF LL_DMA_ClearFlag_TC6
#define UI_BUTTON_PORT GPIOA
#define UI_BUTTON_PERIPH LL_AHB1_GRP1_PERIPH_GPIOA
#endif
#endif
|
mincrmatt12/MSign
|
esp/main/serial.h
|
#ifndef SERIAL_H
#define SERIAL_H
#include <stdint.h>
#include <stddef.h>
#include "common/slots.h"
#include "common/bheap.h"
#include "common/heapsize.h"
#include "dupm.h"
#include "protocol.h"
#include <type_traits>
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
namespace serial {
struct SerialInterface final : private protocol::ProtocolImpl {
friend DataUpdateManager;
// Initialize all queues (must be called before run())
void init();
// Task entry point
void run();
// Reset, informing the STM beforehand.
void reset();
// SLOT UPDATE
// Replace a slot with the data pointed to by ptr and of length length
void update_slot_raw(uint16_t slotid, const void * ptr, size_t length, bool should_sync=true);
// Replace a slot with the contents of the object referenced by obj
template<typename T>
inline void update_slot(uint16_t slotid, const T& obj, bool should_sync=true) {
// Specially defer for array types
static_assert(!std::is_pointer_v<T> || (
std::is_array_v<T> && std::extent_v<T, 0> != 0
), "This will not work with pointers, use update_slot_raw instead, or derefence the pointer. For bounded arrays, pass them directly or use update_slot_range");
update_slot_raw(slotid, &obj, sizeof(T), should_sync);
}
// Replace a slot with a null-terminated string
inline void update_slot(uint16_t slotid, const char *str, bool should_sync=true) {
update_slot_raw(slotid, str, strlen(str) + 1, should_sync); // include null terminator
}
// Replace a slot with an initializer-list of objects. No nosync version is provided since the init list
// is almost certainly going to need syncing.
template<typename T>
inline void update_slot(uint16_t slotid, const std::initializer_list<T>& arr) {
update_slot_raw(slotid, arr.begin(), arr.size() * sizeof(T));
}
template<typename ...Args>
inline void update_slot_nosync(Args&&... args) {
update_slot(std::forward<Args>(args)..., false);
}
// Update slotid as if it were an array of T[], setting T[index] = obj
template<typename T>
inline void update_slot_at(uint16_t slotid, const T& obj, size_t index, bool should_sync=true) {
update_slot_partial(slotid, index * sizeof(T), &obj, sizeof(T), should_sync);
}
// Update many entries in slotid, setting T[index..index+quantity] = obj[0..quantity].
template<typename T>
inline void update_slot_range(uint16_t slotid, const T* obj, size_t index, size_t quantity, bool should_sync=true) {
update_slot_partial(slotid, index * sizeof(T), obj, quantity * sizeof(T), should_sync);
}
// Clear out a slot
inline void delete_slot(uint16_t slotid) {
allocate_slot_size(slotid, 0);
}
// MANUAL SLOT UPDATE
// Set the slot slotid's size to size, adding/truncating space if necessary.
void allocate_slot_size(uint16_t slotid, size_t size);
// Update part of a slot
void update_slot_partial(uint16_t slotid, uint16_t offset, const void * ptr, size_t length, bool should_sync=true);
// Operation sync barrier (not per slot as requests are processed strictly in-order)
void sync();
// SLEEP MODE
bool is_sleeping() const {return in_sleep_mode;}
private:
// Data update manager: handles requests for data separately
DataUpdateManager dum;
TaskHandle_t srv_task;
// Handle checking for loss of comms
void send_pings();
// Handle a packet in the class directly, bypassing subtasks.
void process_packet();
// Last time we received comms with the STM (for autoreset)
TickType_t last_comms = 0;
bool waiting_for_ping = false, in_sleep_mode = false;
};
extern SerialInterface interface;
}
#endif /* ifndef SERIAL_H */
|
mincrmatt12/MSign
|
stm/src/common/bootcmd.c
|
#include "bootcmd.h"
// really just present here to check for STM and i couldn't be bothered to add a define
#if (defined(STM32F205xx) || defined(STM32F207xx)) && !defined(SIM)
#include "stm32f2xx_ll_rtc.h"
#include "stm32f2xx_ll_pwr.h"
#include "stm32f2xx_ll_rcc.h"
#include "stm32f2xx_ll_bus.h"
void bootcmd_init() {
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
LL_RCC_EnableRTC(); // enable the RTC so we can play with it's goodies :)
LL_PWR_EnableBkUpAccess();
LL_RTC_DisableWriteProtection(RTC);
}
bool bootcmd_did_just_update() {
bool x = LL_RTC_BAK_GetRegister(RTC, 1) != 0;
LL_RTC_BAK_SetRegister(RTC, 1, 0x0);
return x;
}
bootcmd_t bootcmd_get_cmd() {
return (bootcmd_t)LL_RTC_BAK_GetRegister(RTC, 0);
}
uint32_t bootcmd_update_size() {
return LL_RTC_BAK_GetRegister(RTC, 2);
}
void bootcmd_request_update(uint32_t size) {
LL_RTC_BAK_SetRegister(RTC, 0, BOOTCMD_UPDATE);
LL_RTC_BAK_SetRegister(RTC, 2, size);
}
void bootcmd_service_update() {
LL_RTC_BAK_SetRegister(RTC, 0, BOOTCMD_RUN);
LL_RTC_BAK_SetRegister(RTC, 1, 0xfece5);
}
void bootcmd_set_silent(bool on) {
LL_RTC_BAK_SetRegister(RTC, 4, on);
}
bool bootcmd_get_silent() {
return LL_RTC_BAK_GetRegister(RTC, 4) != 0;
}
const char * bootcmd_get_bl_revision() {
return (const char *)&RTC->BKP3R;
}
#else
// mock interface
void bootcmd_init() {
}
bool bootcmd_did_just_update() {
return false;
}
bootcmd_t bootcmd_get_cmd() {
return 0;
}
uint32_t bootcmd_update_size() {
return 0;
}
void bootcmd_request_update(uint32_t size) {
}
void bootcmd_service_update() {
}
const char * bootcmd_get_bl_revision() {
return "fake";
}
#ifdef SIM
static bool fakesilent = false;
bool bootcmd_get_silent() {
return fakesilent;
}
void bootcmd_set_silent(bool c) {
fakesilent = c;
}
#else
bool bootcmd_get_silent() {
return false;
}
void bootcmd_set_silent(bool c) {
}
#endif
#endif
|
mincrmatt12/MSign
|
stm/src/common/bheap.h
|
<reponame>mincrmatt12/MSign<filename>stm/src/common/bheap.h<gh_stars>1-10
#ifndef MSN_BHEAP_H
#define MSN_BHEAP_H
#include <stdint.h>
#include <string.h>
#include <type_traits>
#include <iterator>
#include "lru.h"
#if __cpp_inline_variables >= 201603
#define MSN_BHEAP_INLINE_V const inline static
#else
#define MSN_BHEAP_INLINE_V constexpr static
#endif
#if defined(STM32F205xx) || defined(STM32F207xx)
#include "../crash/main.h"
#define ms_assert msign_assert
#else
#ifdef BHEAP_TEST
#include <cassert>
#define ms_assert(x, r) assert((r, x))
#else
#define ms_assert(x, r) (void)0
#endif
#endif
#define MAX_BHEAP_BLOCK_SIZE ((1 << 14) - 1)
// "Block-HEAP"
//
// The datastructure which implements stuff in the README
namespace bheap {
template<typename T>
struct TypedBlock;
template<size_t Size, typename Cache=lru::Cache<8, 3>>
struct Arena;
// Represents a block header
struct Block {
uint32_t slotid : 12;
uint32_t datasize : 14;
uint32_t temperature : 2;
uint32_t location : 2;
uint32_t flags : 2;
MSN_BHEAP_INLINE_V uint32_t TemperatureHot = 0b11;
MSN_BHEAP_INLINE_V uint32_t TemperatureWarm = 0b10;
MSN_BHEAP_INLINE_V uint32_t TemperatureColdWantsWarm = 0b01; // block that wants to be warm but no space for it
MSN_BHEAP_INLINE_V uint32_t TemperatureCold = 0b00;
//MSN_BHEAP_INLINE_V uint32_t LocationHotPotato = 0b00;
MSN_BHEAP_INLINE_V uint32_t LocationCanonical = 0b01;
MSN_BHEAP_INLINE_V uint32_t LocationEphemeral = 0b10;
MSN_BHEAP_INLINE_V uint32_t LocationRemote = 0b11;
MSN_BHEAP_INLINE_V uint32_t SlotEmpty = 0xff0;
MSN_BHEAP_INLINE_V uint32_t SlotEnd = 0xff1;
MSN_BHEAP_INLINE_V uint32_t FlagDirty = 1;
MSN_BHEAP_INLINE_V uint32_t FlagSupressed = 2;
// DATA ACCESS
// Get the next block (4 byte alignment)
const Block *adjacent() const {
if (this->slotid == SlotEnd)
return nullptr;
if (this->location == LocationRemote && *this)
return this + 1;
if (datasize % 4) {
return this + 2 + (datasize / 4);
}
else {
return this + 1 + (datasize / 4);
}
}
Block *adjacent() {
if (this->slotid == SlotEnd)
return nullptr;
if (this->location == LocationRemote && *this)
return this + 1;
if (datasize % 4) {
return this + 2 + (datasize / 4);
}
else {
return this + 1 + (datasize / 4);
}
}
// Get the next block of the same type (4 byte alignment)
const Block *next() const {
const Block *adj = this;
while ((adj = adj->adjacent()) != nullptr && adj->slotid != this->slotid) {}
return adj;
}
Block * next() {
Block * adj = this;
while ((adj = adj->adjacent()) != nullptr && adj->slotid != this->slotid) {}
return adj;
}
// Get the data of this block
void * data() {
return (this + 1);
}
// Get the data of this block
const void * data() const {
return (this + 1);
}
// Get this as a typedblock
template<typename T>
TypedBlock<T>& as() {
return *reinterpret_cast<TypedBlock<T>*>(this);
}
// Get this as a typedblock
template<typename T>
const TypedBlock<T>& as() const {
return *reinterpret_cast<const TypedBlock<T>*>(this);
}
// MUTATION
// Shrink this block, adding an empty block if necessary.
// This is invalid for end blocks.
// For empty blocks this will effectively split them into two segments.
void shrink(uint32_t newsize) {
// Store the previous next block
auto prev = adjacent();
// Do the shrink
this->datasize = newsize;
if (adjacent() != prev) {
// Create a new block with size = prev - next() - 4
//
// Since prev and next are aligned to 4 bytes, the
// next() ptr will align properly
*adjacent() = Block{};
adjacent()->slotid = SlotEmpty;
adjacent()->datasize = (reinterpret_cast<uintptr_t>(prev) - reinterpret_cast<uintptr_t>(adjacent()) - 4);
}
}
// Insert a new block. Only valid for empty blocks.
// Allows for inserting at any offset, but doesn't check for errors.
//
// Use will_fit for that. (or build with asserts on or something)
//
// Offset is relative to the block header (i.e. offset = 0 will overwrite the block, offset = 4 will zero-size this block, etc.)
void insert(const Block& b, uint32_t offset) {
ms_assert(offset % 4 == 0 && offset < datasize + 4, "invalid location for insert");
// Use the power of recursion to make this only have to deal with the case for offset = 0
if (offset != 0) {
// Shrink this block to size = offset - 4
this->shrink(offset - 4);
// Overwrite next
adjacent()->insert(b, 0);
}
else {
// Shrink this block so that there's a new end.
this->shrink((b && b.location == LocationRemote) ? 0 : b.datasize);
// Overwrite this
*this = b;
}
}
// HELPERS
// Check if that block will fit in this location
bool will_fit(const Block& b, uint32_t offset) const {
uint32_t length = offset + b.total_size();
return length <= total_size();
}
operator bool() const {
return this->slotid != SlotEnd && this->slotid != SlotEmpty;
}
// in bytes
ptrdiff_t total_size() const {
return (uintptr_t)adjacent() - (uintptr_t)this;
}
// total rounded datasize (ignoring remote/etc.)
size_t rounded_datasize() const {
size_t result = datasize;
if (result % 4) result += (4 - result % 4);
return result;
}
template<size_t, typename> friend struct Arena;
private:
Block& operator=(const Block& other) = default;
Block& operator=(Block&& other) = default;
Block(const Block& other) = default;
Block(Block&& other) = default;
Block() = default;
};
static_assert(sizeof(Block) == 4, "Block is not 4 bytes");
// Helper type to access blocks of a known type
template<typename T>
struct TypedBlock : protected Block {
#if __cpp_if_constexpr >= 201603
using data_type = std::conditional_t<std::is_pointer<std::decay_t<T>>::value, T, T&>;
using const_data_type = std::conditional_t<std::is_pointer<std::decay_t<T>>::value, std::add_pointer_t<const std::remove_pointer_t<T>>, const T&>;
// Get the data of this block.
// If T is a pointer type, return a pointer to that type at the beginning of the data block (useful for variable length arrays / strings)
const_data_type data() const {
if constexpr (std::is_pointer_v<std::decay_t<T>>) {
return reinterpret_cast<std::add_pointer_t<const std::remove_pointer_t<T>>>(Block::data());
}
else {
return *reinterpret_cast<std::add_pointer_t<const std::decay_t<T>>>(Block::data());
}
}
data_type data() {
if constexpr (std::is_pointer_v<std::decay_t<T>>) {
return reinterpret_cast<T>(Block::data());
}
else {
return *reinterpret_cast<std::add_pointer_t<std::decay_t<T>>>(Block::data());
}
}
// Allow use as a pointer type
T* operator->() {return &data();}
const T* operator->() const {return &data();}
data_type operator*() {return data();}
const_data_type operator*() const {return data();}
template<typename Idx>
auto operator[](Idx idx) const {return (*(*this))[idx];}
template<typename Idx>
auto operator[](Idx idx) {return (*(*this))[idx];}
#endif
using Block::next;
// Allow access to the metadata
using Block::datasize;
using Block::slotid;
using Block::location;
using Block::temperature;
operator bool() const {
return Block::operator bool() && this->datasize && this->location != bheap::Block::LocationRemote;
}
};
// An arena of blocks (fight!)
template<size_t Size, typename Cache>
struct Arena {
static_assert(Size % 4 == 0, "Arena must have a size aligned to 4 bytes");
template<typename T, bool Adjacent>
struct Iterator {
static_assert(!(Adjacent && !std::is_same<typename std::decay<T>::type, Block>::value), "Using Arena::Iterator in adjacent mode on TypedBlocks is invalid.");
using iterator_category = std::forward_iterator_tag;
using value_type = T;
using difference_type = ptrdiff_t;
using reference = T&;
using pointer = T*;
Iterator(T& f) {
ptr = &f;
#if __cpp_if_constexpr >= 201603
if constexpr (!Adjacent) {
#else
if (!Adjacent) {
#endif
if (!f) ptr = nullptr;
}
}
Iterator() {
ptr = nullptr;
}
pointer operator->() const {return ptr;}
reference operator*() const {return *ptr;}
Iterator& operator++() {
#if __cpp_if_constexpr >= 201603
if constexpr (Adjacent)
ptr = ptr->adjacent();
else
ptr = ptr->next();
#else
ptr = Adjacent ? ptr->adjacent() : ptr->next();
#endif
return *this;
}
Iterator operator++(int) {
// Copy
auto copy = *this;
++this;
return copy;
}
operator Iterator<const T, Adjacent>() const {
return Iterator<const T, Adjacent>(*ptr);
}
bool operator==(const Iterator& other) const {
return other.ptr == ptr;
}
bool operator!=(const Iterator& other) const {
return other.ptr != ptr;
}
operator T*() const {
return ptr;
}
private:
T* ptr;
};
static_assert(Size >= 8, "Not large enough to hold an end and empty marker block");
union {
Block first;
uint8_t region[Size]{};
};
Arena() {
first.slotid = Block::SlotEmpty;
first.datasize = Size - 4;
// Create a handy dandy end block
first.shrink(Size - 8);
*first.adjacent() = Block();
first.adjacent()->datasize = 0;
first.adjacent()->slotid = Block::SlotEnd;
}
// MODIFICATION OPERATIONS
// Add a new block of this size somewhere after the last block of this slot.
//
// If this is the first block, the temperature is initialized to cold, otherwise it is kept correct
bool add_block(uint32_t slotid, uint32_t datalocation, size_t datasize) {
ms_assert(datasize < MAX_BHEAP_BLOCK_SIZE, "block too big");
// First, check if there's enough space to fit in this block.
uint32_t free_space = this->free_space();
if (contains(slotid)) {
free_space = this->free_space(this->get(slotid), FreeSpaceAllocatable); // explicitly use the second one to avoid a warning
}
else {
// If this is a new block, clear the cache since it might have an end block polluting it
bcache.evict(slotid);
}
uint32_t required_space = 4;
if (datalocation != Block::LocationRemote) required_space += datasize;
if (required_space > free_space) {
// TODO: try to relocate the blocks earlier (if there is space earlier, anyways)
return false;
}
// There is space somewhere after the last block.
// Find the next free space. We always allocate at the beginning of free spaces.
Block newb;
newb.slotid = slotid;
newb.datasize = static_cast<uint32_t>(datasize);
newb.temperature = Block::TemperatureCold;
newb.location = datalocation;
newb.flags = 0;
if (contains(slotid)) newb.temperature = get(slotid).temperature;
for (Block* x = contains(slotid) ? &last(slotid) : &first; x->adjacent(); x = x->adjacent()) {
if (x->slotid == Block::SlotEnd) return false; // end; fragmented
if (*x) continue; // non-empty
// empty block, is there space?
if (x->will_fit(newb, 0)) {
// place this block there
x->insert(newb, 0);
// note we don't have to update the cache since it'll get filled at the next lookup anyways.
return true;
}
}
// If we're here, then there isn't a big enough empty block to place this chunk.
return false; // Broken heap
}
// Update the contents of the data at that offset + length with data.
bool update_contents(uint32_t slotid, uint32_t offset, uint32_t length, const void *data) {
return update_contents(slotid, offset, length, data, true);
}
// Update the contents of the data at that offset + length with data.
//
// This function will convert remote chunks to either canonical + flush or ephemeral depending on the set_flush
// parameter. For more control, use the overload that takes a functor.
bool update_contents(uint32_t slotid, uint32_t offset, uint32_t length, const void *data, bool fulfill_with_ephemeral) {
return update_contents(slotid, offset, length, data, [this, slotid, fulfill_with_ephemeral](uint32_t off, uint32_t len, const void *dat){
if (!fulfill_with_ephemeral) return false;
if (!set_location(slotid, off, len, Block::LocationEphemeral)) return false;
return update_contents(slotid, off, len, dat);
});
}
template<typename RemoteHandler>
std::enable_if_t<
std::is_invocable_r_v<bool, RemoteHandler, uint32_t /* offset */, uint32_t /* length */, const void * /* data */>,
bool> update_contents(uint32_t slotid, uint32_t offset, uint32_t length, const void *data, RemoteHandler&& rh) {
if (offset + length > contents_size(slotid) || !contains(slotid)) return false;
// Check if the region crosses the boundary between two segments, if so, split the function into two calls.
Block& containing_block = get(slotid, offset);
auto begin_pos = block_offset(containing_block);
if (offset + length > begin_pos + containing_block.datasize) {
// Region starting at offset has size begin_pos + containing_block.datasize + 1 - offset
// | x | |
// 0123456
// Region starting at begin_pos + containing_block.datasize has size offset + length - begin_pos + containing_block.datasize
auto sublength = begin_pos + containing_block.datasize - offset;
return update_contents(slotid, offset, begin_pos + containing_block.datasize - offset, data, std::forward<RemoteHandler>(rh)) &&
update_contents(slotid, offset + sublength, length - sublength, static_cast<const uint8_t*>(data) + sublength, std::forward<RemoteHandler>(rh));
}
// Check if this is a remote region, in which case we have to convert it
if (containing_block.location == Block::LocationRemote) {
return std::forward<RemoteHandler>(rh)(offset, length, data);
}
// Otherwise, just patch the block content
memcpy((uint8_t *)(containing_block.data()) + (offset - begin_pos), data, length);
containing_block.flags |= Block::FlagDirty;
return true;
}
// Check if the range given is stored at the given location.
bool check_location(uint32_t slotid, uint32_t offset, uint32_t length, uint32_t location) const {
if (offset + length > contents_size(slotid) || !contains(slotid)) return false;
// This isn't particularly fast but probably has less problems than the old implementation
for (auto x = cbegin(slotid); x != cend(slotid); ++x) {
if ((offset+length) <= block_offset(*x) || offset >= (block_offset(*x) + x->datasize)) continue;
if (x->location != location) return false;
}
return true;
}
// Change the storage location of a given region
//
// If told to convert to remote, will create the necessary block.
// If told to convert _from_ remote, will create necessary blocks and shrink/replace remote sections.
bool set_location(uint32_t slotid, uint32_t offset, uint32_t length, uint32_t location) {
if (offset + length > contents_size(slotid) || !contains(slotid)) return false;
// Strategy for normal locations:
// - find beginning block and ending block (min max, possibly overshooting)
// - over all "inner" blocks just change value
// - if begin == end:
// - split block up (moving over 4 bytes)
// - add new block
// - split again (moving over another 4 bytes)
// - else:
// - split block only once
// Strategy for remote blocks:
// - find beginning and ending block, split if required
// - nullify all inner blocks
// - insert remote block
// Check if the region crosses the boundary between two segments, if so, split the function into two calls.
{
Block& containing_block = get(slotid, offset);
auto begin_pos = block_offset(containing_block);
if (offset + length > begin_pos + containing_block.datasize) {
// Region starting at offset has size begin_pos + containing_block.datasize + 1 - offset
// | x | |
// 0123456
// Region starting at begin_pos + containing_block.datasize has size offset + length - begin_pos + containing_block.datasize
auto sublength = begin_pos + containing_block.datasize - offset;
return set_location(slotid, offset, begin_pos + containing_block.datasize - offset, location) &&
set_location(slotid, offset + sublength, length - sublength, location);
}
// Check if the region is not the entire block
if (begin_pos != offset) {
// Split block once
if (!split_block(containing_block, offset - begin_pos)) return false;
}
}
{
Block& containing_block = get(slotid, offset);
auto begin_pos = block_offset(containing_block);
// Check if the region is not the entire block (end)
if (begin_pos + containing_block.datasize != offset + length) {
// Split block once again
if (!split_block(containing_block, (offset + length) - begin_pos)) return false;
}
}
Block& containing_block = get(slotid, offset);
if (containing_block.location == location) return true;
if (location == Block::LocationRemote) {
// shrink block to 0
containing_block.shrink(0);
containing_block.datasize = length;
goto finish_setting;
}
else {
if (containing_block.location == Block::LocationRemote) {
// Allocate space for entire chunk.
// I will admit this wastes 4 bytes, but eh it's the easiest and cleanest way to do this
invalidate(&containing_block);
// Delete block contents
containing_block.shrink(0);
// Ensure space exists for the block
if (!make_space_after(containing_block, length)) {
// If there's not enough space, do at least ensure we don't invalidate the length
containing_block.datasize = length;
return false;
}
// Copy relevant portions of block info
auto& new_contain = *containing_block.adjacent();
new_contain.slotid = slotid;
new_contain.temperature = containing_block.temperature;
new_contain.datasize = length;
new_contain.flags = containing_block.flags;
new_contain.location = location;
// Null out old contents
containing_block.slotid = Block::SlotEmpty;
// Evict cache for this block
return true;
}
else {
finish_setting:
containing_block.location = location;
return true;
}
}
}
// Set the temperature of data
bool set_temperature(uint32_t slotid, uint32_t temperature) {
if (!contains(slotid)) return false;
// Change the temperature of all blocks
for (auto x = begin(slotid); x != end(slotid); ++x) {
x->temperature = temperature;
}
return true;
}
// Trim data blocks so that the total size is truncated
bool truncate_contents(uint32_t slotid, uint32_t size) {
if (!contains(slotid)) return true;
if (contents_size(slotid) < size) return false; // also does npos
// if the actual size == size, we just do nothing
while (contents_size(slotid) > size) {
auto& endptr = last(slotid);
uint32_t should_reclaim = contents_size(slotid) - size;
if (should_reclaim >= endptr.datasize && (&endptr != &get(slotid) || endptr.temperature == Block::TemperatureCold)) {
// delete the block
if (endptr.location == Block::LocationRemote) endptr.datasize = 0;
else {
bcache.evict(slotid);
}
endptr.slotid = Block::SlotEmpty;
}
else {
// truncate
endptr.shrink(endptr.datasize - should_reclaim);
}
}
return true;
}
// Homogenize data: ensure all of its blocks are in order, and (if possible) merge their data together
// This does it's "best effort":
// - it'll try to merge blocks as it can
// - it'll also remove 0-size placeholders
void homogenize(uint32_t slotid) {
// Remove 0-size placeholders
for (auto x = this->begin(slotid); x != this->end(slotid); ++x) {
if (x->next() && x->location == Block::LocationRemote && x->datasize == 0) {
invalidate(x);
auto nextptr = x;
++nextptr;
x->slotid = Block::SlotEmpty;
x->location = Block::LocationCanonical;
x = nextptr;
}
}
// Rearrange all of the blocks
for (auto x = this->begin(slotid); x != this->end(slotid); ++x) {
if (x->next()) {
move_left(*x->next(), *x);
// Try to merge
//
// We can merge if:
// - the location is equal
// - the flush flag is equal (if the dirty flag is unequal, or it)
while (x->location == x->next()->location && (x->flags & Block::FlagSupressed) == (x->next()->flags & Block::FlagSupressed)) {
// If this is a remote block, just increase the size
if (x->location == Block::LocationRemote) {
x->datasize += x->next()->datasize;
x->next()->location = Block::LocationCanonical;
x->next()->datasize = 0;
x->next()->slotid = Block::SlotEmpty;
}
else {
// Copy the data
Block old = *x->next();
void * append_data = x->next()->data();
char * append_data_to = ((char*)x->data()) + x->datasize;
Block *should_end_at = x->next()->adjacent();
x->datasize += old.datasize;
// Append data
memmove(append_data_to, append_data, old.datasize);
// If we need to insert a block?
if (x->adjacent() != should_end_at) {
// Re-update old
old.slotid = Block::SlotEmpty;
old.location = Block::LocationCanonical;
old.temperature = Block::TemperatureCold;
old.datasize = (should_end_at - x->adjacent())*sizeof(Block) - 4;
*x->adjacent() = old;
}
}
if (x->next()) move_left(*x->next(), *x);
else break;
}
}
}
}
// Defragment this Arena
//
// Does the following actions:
// - Homogenizes all slots
// - Condenses adjacent empties and moves all empty space to the end of the arena.
// - This can reduce performance but allows for more blocks to be allocated
void defrag() {
// Remove unnecessary placeholders
for (auto& x : *this) {
if (x && x.datasize == 0 && x.next()) {
x.datasize = 0;
x.slotid = Block::SlotEmpty;
x.location = Block::LocationCanonical;
}
}
bcache.evict();
// Homogenize all slots
for (auto& x : *this) {
if (x && x.next()) homogenize(x.slotid);
}
// Condense empty slots (simplifies next section)
for (auto& x : *this) {
while (x.adjacent() && x.slotid == Block::SlotEmpty && x.adjacent()->slotid == Block::SlotEmpty) {
x.datasize += x.adjacent()->total_size();
}
}
{
auto last_empty = &last(Block::SlotEmpty);
if (last_empty->slotid != Block::SlotEnd) {
for (auto& x : *this) {
if (x.slotid == Block::SlotEmpty && &x != last_empty) {
// Shift everything from x->adjacent() of size (&last_empty - x->adjacent()) over to x, then move the empty header
Block *begin_region = x.adjacent();
Block *copy_to = &x;
Block old_empty = *last_empty;
memmove(copy_to, begin_region, (last_empty - begin_region)*sizeof(Block));
// Add a new block header
last_empty -= (begin_region - copy_to);
*last_empty = old_empty;
last_empty->datasize += (begin_region - copy_to)*sizeof(Block);
// Continue evicting the cache
bcache.evict();
}
}
}
}
// Move all content to the right of the last empty
{
Block * last_empty = &last(Block::SlotEmpty);
if (last_empty->slotid != Block::SlotEnd && last_empty->adjacent()->slotid != Block::SlotEnd) {
Block *begin_location = last_empty;
Block old_empty = *last_empty;
uint8_t *target_area = (uint8_t *)last_empty->adjacent();
uint8_t *end = region + Size - 4;
size_t moved_size = end - target_area;
memmove(begin_location, target_area, moved_size);
// Rewrite empty
Block *new_empty = begin_location + moved_size / 4;
*new_empty = old_empty;
}
}
// Completely wipe the entire cache
bcache.evict();
}
// Ensure a certain subsection of a slot is in its own block. This only ever splits blocks, not merges them, so if the region given
// is not already in a single block, we will return false.
bool ensure_single_block(uint32_t slotid, uint32_t offset, uint32_t length) {
if (offset + length > contents_size(slotid) || !contains(slotid)) return false;
// Ensure single block.
if (&get(slotid, offset) != &get(slotid, offset + length - 1)) return false;
// If offset is not the start of a block, split.
{
Block& containing_block = get(slotid, offset);
auto begin_pos = block_offset(containing_block);
if (begin_pos != offset) {
if (!split_block(containing_block, offset - begin_pos)) return false;
}
}
// If length is not the size of the containing block, split (possibly again)
{
Block& containing_block = get(slotid, offset);
if (containing_block.datasize != length) {
if (!split_block(containing_block, length)) return false;
}
}
return true;
}
// DATA ACCESS OPERATIONS
// Size/offset for something that doesn't exist
MSN_BHEAP_INLINE_V uint32_t npos = ~0u;
// Return the offset into the slot id this block is at.
//
// If this block is not present in this Arena return npos.
uint32_t block_offset(const Block& block) const {
uint32_t pos = 0;
for (auto x = this->cbegin(block.slotid); x != this->cend(block.slotid); ++x) {
if (x == &block) return pos;
pos += x->datasize;
}
return npos;
}
// Get the total size of a given slotid (returns 0 if not found _or_ empty)
uint32_t contents_size(uint32_t slotid) const {
uint32_t total = 0;
for (auto x = cbegin(slotid); x != cend(slotid); ++x) {
total += x->datasize;
}
return total;
}
// Get the total free space (with various flags for what counts as "free" space)
MSN_BHEAP_INLINE_V uint32_t FreeSpaceEmpty = 1; // Total size of empty regions + their headers
MSN_BHEAP_INLINE_V uint32_t FreeSpaceZeroSizeCanonical = 2; // Headers for empty canonical blocks
MSN_BHEAP_INLINE_V uint32_t FreeSpaceEphemeral = 4; // Headers + data for ephemeral blocks (cold + warm)
MSN_BHEAP_INLINE_V uint32_t FreeSpaceHomogenizeable = 8; // Headers for noncontiguous regions.
MSN_BHEAP_INLINE_V uint32_t FreeSpaceAllocatable = FreeSpaceEmpty; // Free space for new allocations
MSN_BHEAP_INLINE_V uint32_t FreeSpaceCleanup = FreeSpaceAllocatable | FreeSpaceZeroSizeCanonical | FreeSpaceEphemeral; // Free space after removing stuff
MSN_BHEAP_INLINE_V uint32_t FreeSpaceDefrag = FreeSpaceAllocatable | FreeSpaceHomogenizeable; // Free space after defrag()
inline uint32_t free_space(uint32_t mode=FreeSpaceAllocatable) const {
return free_space(first, mode);
}
uint32_t free_space(const Block& after, uint32_t mode) const {
uint32_t total = 0;
if (mode & FreeSpaceEmpty) {
for (auto blk = const_iterator(after); blk != cend(); ++blk) {
if (blk->slotid == Block::SlotEmpty) {
total += blk->total_size();
}
}
}
if (mode & FreeSpaceZeroSizeCanonical) {
for (auto blk = const_iterator(after); blk != cend(); ++blk) {
if (blk->slotid < Block::SlotEmpty && blk->location == Block::LocationCanonical && blk->datasize == 0) total += 4 ;
}
}
if (mode & FreeSpaceEphemeral) {
for (auto blk = const_iterator(after); blk != cend(); ++blk) {
if (blk->slotid < Block::SlotEmpty && blk->location == Block::LocationEphemeral && blk->temperature < Block::TemperatureHot && !blk->flags) total += 4 + blk->datasize;
}
}
if (mode & FreeSpaceHomogenizeable) {
for (auto blk = const_iterator(after); blk != cend(); ++blk) {
if (*blk && blk->next() && blk->location == blk->next()->location && (blk->flags & Block::FlagSupressed) == (blk->next()->flags & Block::FlagSupressed)) total += 4;
}
}
return total;
}
// Is this data ID represented in this arena
inline bool contains(uint32_t slotid) const {return get(slotid);}
// Is this data ID in the cache (i.e. has it been used recently)
inline bool cached(uint32_t slotid) const {return bcache.contains(slotid);}
// Get the first block of that SlotID (returning the end block if not present, whose bool() is false)
const Block& get(uint32_t slotid) const {
if (slotid == Block::SlotEmpty) return get(slotid, 0); // bypass cache
// Can we use the cache?
if (bcache.contains(slotid)) {
const Block& result = get_from_cache(bcache.lookup(slotid));
if (result.slotid != slotid && result) { // be resistant against cache corruption
return result;
}
}
for (const Block& x : *this) {
if (x.slotid == slotid || x.slotid == Block::SlotEnd) return x;
}
ms_assert(false, "no end blk");
__builtin_unreachable();
}
Block& get(uint32_t slotid) {
if (slotid == Block::SlotEmpty) return get(slotid, 0); // bypass cache
Block& result = get_from_cache(
bcache.lookup_or_calculate(slotid, [&](){
for (Block& x : *this) {
if (x.slotid == slotid || x.slotid == Block::SlotEnd) return bptr_to_cache(&x);
}
ms_assert(false, "no end blk");
__builtin_unreachable();
})
);
if (result.slotid != slotid && result) { // be resistant against cache corruption
bcache.evict();
return get(slotid);
}
return result;
}
const Block& get(uint32_t slotid, uint32_t offset) const {
uint32_t pos = 0;
for (const Block& x : *this) {
if (x.slotid == Block::SlotEnd) return x;
if (x.slotid != slotid) continue;
if (offset >= pos && offset < pos + x.datasize) return x;
pos += x.datasize;
}
ms_assert(false, "no end blk");
__builtin_unreachable();
}
Block& get(uint32_t slotid, uint32_t offset) {
uint32_t pos = 0;
for (Block& x : *this) {
if (x.slotid == Block::SlotEnd) return x;
if (x.slotid != slotid) continue;
if (offset >= pos && offset < pos + x.datasize) return x;
pos += x.datasize;
}
ms_assert(false, "no end blk");
__builtin_unreachable();
}
// Get the last block of that SlotID
const Block& last(uint32_t slotid) const {
const Block* ptr = &get(slotid);
while (ptr->next()) ptr = ptr->next();
return *ptr;
}
Block& last(uint32_t slotid) {
Block* ptr = &get(slotid);
while (ptr->next()) ptr = ptr->next();
return *ptr;
}
// Get the first block of that SlotID as a TypedBlock
template<typename T>
inline const TypedBlock<T>& get(uint32_t slotid) {return get(slotid).template as<T>();}
template<typename T>
inline TypedBlock<T>& get(uint32_t slotid) {return get(slotid).template as<T>();}
// HELPERS
inline const Block& operator[](uint32_t slotid) const {return get(slotid);}
inline Block& operator[](uint32_t slotid) {return get(slotid);}
// ITERATION
// Iterate over all blocks
using iterator = Iterator<Block, true>;
using const_iterator = Iterator<const Block, true>;
using nonadj_iterator = Iterator<Block, false>;
using nonadj_const_iterator = Iterator<const Block, false>;
inline iterator begin() {return iterator(first);}
inline const_iterator begin() const {return const_iterator(first);}
inline const_iterator cbegin() const {return const_iterator(first);}
inline iterator end() {return iterator();}
inline const_iterator end() const {return const_iterator();}
inline const_iterator cend() const {return const_iterator();}
// Iterate over blocks for slotid without type
inline nonadj_iterator begin(uint32_t slotid) {return nonadj_iterator(this->get(slotid));}
inline nonadj_const_iterator begin(uint32_t slotid) const {return nonadj_const_iterator(this->get(slotid));}
inline nonadj_const_iterator cbegin(uint32_t slotid) const {return nonadj_const_iterator(this->get(slotid));}
inline nonadj_iterator end(uint32_t slotid) {return nonadj_iterator();}
inline nonadj_const_iterator end(uint32_t slotid) const {return nonadj_const_iterator();}
inline nonadj_const_iterator cend(uint32_t slotid) const {return nonadj_const_iterator();}
// Iterate over typed
template<typename T>
using data_iterator = Iterator<TypedBlock<T>, false>;
template<typename T>
using data_const_iterator = Iterator<const TypedBlock<T>, false>;
template<typename T>
inline data_iterator<T> begin(uint32_t slotid) {return data_iterator<T>(this->get(slotid));}
template<typename T>
inline data_const_iterator<T> begin(uint32_t slotid) const {return data_const_iterator<T>(this->get(slotid));}
template<typename T>
inline data_const_iterator<T> cbegin(uint32_t slotid) const {return data_const_iterator<T>(this->get(slotid));}
template<typename T>
inline data_iterator<T> end(uint32_t slotid) {return data_iterator<T>();}
template<typename T>
inline data_const_iterator<T> end(uint32_t slotid) const {return data_const_iterator<T>();}
template<typename T>
inline data_const_iterator<T> cend(uint32_t slotid) const {return data_const_iterator<T>();}
private:
// Slot get() cache
Cache bcache;
// INTERNAL HELPERS
// Get a block from a cache value
Block &get_from_cache(uint16_t offset) {
return *reinterpret_cast<Block *>(®ion[offset * 4]);
}
const Block &get_from_cache(uint16_t offset) const {
return *reinterpret_cast<const Block *>(®ion[offset * 4]);
}
// Get the cache value from a slot
uint16_t bptr_to_cache(const Block * ptr) const {
return ptr - &first;
}
// Invalidate all blocks in a range
template<typename Iterator>
void invalidate(Iterator begin, Iterator end) {
for (; begin != end; ++begin) {
invalidate(begin);
}
}
void invalidate(const Block *ptr) {
bcache.evict_if(ptr->slotid, bptr_to_cache(ptr));
}
// Ensure there's an empty block of exactly new_alloc_space after the specified block (block->adjacent())
bool make_space_after(Block& containing_block, uint32_t new_alloc_space) {
if (new_alloc_space % 4) new_alloc_space += 4 - (new_alloc_space % 4);
while (containing_block.adjacent()->slotid != Block::SlotEmpty || containing_block.adjacent()->datasize < new_alloc_space) {
// Operates as a loop:
// - find empty block
// - shift prior contents into it by units of 4
if (containing_block.adjacent()->slotid == Block::SlotEnd) return false;
// If we're appending to an existing empty block, start searching for the next one after it.
Block* next_empty = containing_block.adjacent()->slotid != Block::SlotEmpty ? containing_block.adjacent() : containing_block.adjacent()->adjacent();
// We need to move stuff starting after the empty.
Block* move_region_start = next_empty;
while (*next_empty) {
next_empty = next_empty->adjacent();
}
if (next_empty->slotid == Block::SlotEnd) return false; // No more empties, return false.
// Evict everything in the move region
invalidate(iterator(containing_block), iterator(*next_empty));
// Now we have the following situation:
// | cb | xxxx | e |
// where cb is containing_block and e is an empty block (next_empty).
//
// We want to swap cb->adjacent() with the empty block, effectively (or insert it, etc.)
//
// The total space we can reclaim is new_alloc_space, minus the header.
// If cb->adjacent() is empty, the space we have to reclaim is new_alloc_space - cb->adjacent()->datasize
// otherwise, we have to reclaim the entire new_alloc_space + 4.
//
// The total space we can reclaim from e = 4 + its size.
//
// If the remaining space in e is more than 4 (rounded to the nearest 4), we shrink the datasize, otherwise we delete the chunk entirely.
// After reclaiming we memmove
uint32_t remaining_new_alloc_space = *containing_block.adjacent() ? new_alloc_space + 4 : (new_alloc_space - containing_block.adjacent()->datasize);
uint32_t reclaimable_space = next_empty->total_size();
uint32_t total_reclaimed = 0;
// If we reclaim the entire thing...
if (reclaimable_space - 4 <= remaining_new_alloc_space) {
// Just do a boring memmove
memmove(((uint8_t *)move_region_start) + reclaimable_space, move_region_start, reinterpret_cast<uintptr_t>(next_empty) - reinterpret_cast<uintptr_t>(move_region_start));
total_reclaimed = reclaimable_space;
}
else {
// Be slightly more intelligent, do the same as above but write a new block at the end.
Block old_empty = *next_empty;
ms_assert(old_empty.datasize >= remaining_new_alloc_space, "bad space");
old_empty.datasize -= remaining_new_alloc_space;
memmove(((uint8_t *)move_region_start) + remaining_new_alloc_space, move_region_start, reinterpret_cast<uintptr_t>(next_empty) - reinterpret_cast<uintptr_t>(move_region_start));
total_reclaimed = remaining_new_alloc_space;
*(next_empty + (remaining_new_alloc_space / 4)) = old_empty;
}
if (*containing_block.adjacent()) {
// Replace it with a block
*containing_block.adjacent() = Block{};
containing_block.adjacent()->slotid = Block::SlotEmpty;
containing_block.adjacent()->datasize = total_reclaimed - 4;
containing_block.adjacent()->location = Block::LocationCanonical;
}
else {
// Expand the size of the block
containing_block.adjacent()->datasize += total_reclaimed;
}
} // this loop naturally ends at the right point.
containing_block.adjacent()->shrink(new_alloc_space);
return true;
}
// Split a block into two equally labelled but separate chunks
bool split_block(Block& block, uint32_t offset_in_block) {
// Compute and store length of new block
uint32_t new_length = block.datasize - offset_in_block;
// If the block is remote, do something very simple
if (block.location == Block::LocationRemote) {
// Create an empty empty block after the remote block (which will turn into the second remote)
if (!make_space_after(block, 0)) return false;
block.shrink(offset_in_block);
goto copy_data;
}
// Create an empty space after the block with enough space to fit the block's contents after offset_in_block + 4 bytes + alignment including the null space
{
uint32_t shift_required = 4;
if (offset_in_block % 4) {
shift_required += 4 - (offset_in_block % 4);
}
uint32_t space_required = shift_required - (block.rounded_datasize() - block.datasize);
if (new_length % 4) {
space_required += 4 - (new_length % 4);
}
// Create that much space
if (!make_space_after(block, space_required - 4)) return false;
// Shift with memmove
char * starting_pos = ((char *)block.data()) + offset_in_block;
memmove(starting_pos + shift_required, starting_pos, block.datasize - offset_in_block);
// Shrink block to generate header in right place
block.shrink(offset_in_block);
}
copy_data:
// Copy other header details.
block.adjacent()->slotid = block.slotid;
block.adjacent()->location = block.location;
block.adjacent()->temperature = block.temperature;
block.adjacent()->flags = block.flags;
block.adjacent()->datasize = new_length;
return true;
}
// Move a block to the left of another, reorganizing the rest of the array properly.
void move_left(Block& to_move, Block& in_front_of) {
if (in_front_of.adjacent() == &to_move) return;
ms_assert(&to_move > &in_front_of, "move_left backwards");
// Invalidate everything between in_front_of.adjacent() and to_move inclusive
invalidate(iterator(*in_front_of.adjacent()), iterator(*to_move.adjacent()));
uint32_t * middle_start = reinterpret_cast<uint32_t *>(in_front_of.adjacent());
uint32_t * middle_end = reinterpret_cast<uint32_t *>(&to_move);
uint32_t * paste_from = middle_end;
uint32_t * paste_to = middle_start;
// Try to find some free space.
uint32_t * scratch_area = nullptr;
size_t scratch_size = 0;
// Search for empty space outside the region that will be trashed
for (const Block *b = &first; b; b = b->adjacent()) {
if (b->slotid != Block::SlotEmpty) continue;
// How much space is there?
size_t amount = b->rounded_datasize();
if (amount < 4 || amount < scratch_size) continue;
// Check if this region overlaps the move region
if ((uintptr_t)b->data() >= (uintptr_t)in_front_of.data() && (uintptr_t)b->data() <= (uintptr_t)to_move.adjacent()->data()) continue;
// Update scratch area
scratch_area = (uint32_t *)b->data();
scratch_size = amount;
// Do we have enough space?
if (scratch_size >= (to_move.adjacent() - &to_move) * 4) {
scratch_size = (to_move.adjacent() - &to_move) * 4;
break;
}
}
// If we don't have any free space, make up some
if (scratch_area == nullptr || scratch_size < 4) {
scratch_area = (uint32_t *)alloca(4);
scratch_size = 4;
}
// Compute total length
uint32_t paste_amount = (to_move.adjacent() - &to_move) * 4;
while (paste_amount) {
// Shrink as appropriate
if (paste_amount < scratch_size) {
scratch_size = paste_amount;
}
// Read in scratch_size bytes from paste from
memcpy(scratch_area, paste_from, scratch_size);
paste_from += (scratch_size / 4);
// Shift over the middle region
memmove(middle_start + (scratch_size / 4), middle_start, (middle_end - middle_start) * 4);
// Move the pointers by scratch size
middle_start += (scratch_size / 4);
middle_end += (scratch_size / 4);
// Write out scratch_size bytes back to the paste pointer
memcpy(paste_to, scratch_area, scratch_size);
paste_to += (scratch_size / 4);
paste_amount -= scratch_size;
}
}
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/screens/clock.h
|
<gh_stars>1-10
#ifndef CLOCK_S_H
#define CLOCK_S_H
#include "base.h"
#include "../matrix.h"
#include <stdint.h>
namespace screen {
struct ClockScreen : public Screen {
ClockScreen();
void draw();
private:
led::color_t bg_color;
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/dwhttp.h
|
#ifndef MSE_UTIL_H
#define MSE_UTIL_H
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <functional>
#define MAX_LOG_FILE_SIZE 64 * 1024 * 1024
namespace dwhttp {
/* TODO: nothing uses this right now
struct RawDownload {
int16_t status_code;
char * buf;
uint32_t length;
bool error;
};
// Mallocs a buffer, and downloads.
// Also occasionally runs the serial buffer.
// Does not make a c_str, returns the length in a struct however. The response may be less than length if error is set.
RawDownload download_from(const char * host, const char * path);
RawDownload download_from(const char * host, const char * path, const char * const headers[][2]);
RawDownload download_from(const char * host, const char * path, const char * const headers[][2], const char * method, const char * body=nullptr);
*/
struct Download {
Download(const Download&) = delete;
Download& operator=(const Download&) = delete;
Download(Download&& other) : recvpending(other.recvpending) {
adapter = std::exchange(other.adapter, nullptr);
recvbuf = std::exchange(other.recvbuf, nullptr);
}
~Download();
// Internal use only.
Download(void * adapter) : adapter(adapter) {}
// Read single char
int16_t operator()();
size_t operator()(uint8_t * buf, size_t length);
int result_code() const;
int content_length() const;
bool is_unknown_length() const;
void make_nonclose() {nonclose = true;}
bool ok() const {return result_code() >= 200 && result_code() < 300;}
private:
uint8_t * recvbuf {};
uint8_t recvpending{};
uint8_t recvread{};
uint8_t nonclose = false;
void * adapter{};
};
Download download_with_callback(const char * host, const char * path);
Download download_with_callback(const char * host, const char * path, const char * const headers[][2]);
Download download_with_callback(const char * host, const char * path, const char * const headers[][2]);
Download download_with_callback(const char * host, const char * path, const char * const headers[][2], const char * method, const char * body);
void close_connection(bool ssl);
}
#endif
|
mincrmatt12/MSign
|
stm/src/nvic.h
|
#ifndef NVIC_H
#define NVIC_H
namespace nvic {
void init();
}
#endif
|
mincrmatt12/MSign
|
esp/main/upd.h
|
#ifndef UPD_H
#define UPD_H
namespace upd {
enum UpdateKind {
FULL_SYSTEM = 0x01,
WEB_UI,
CERTIFICATE_FILE,
NO_UPDATE = 0x00
};
UpdateKind needed(); // is an update needed, based on the state of the SD card
void update_cacerts();
void update_website();
void update_system();
}
#endif /* ifndef UPD_H */
|
mincrmatt12/MSign
|
stm/src/screens/threed/fixed.h
|
#ifndef MSN_FXDMATH_H
#define MSN_FXDMATH_H
#include <stdint.h>
#include <stddef.h>
#include "../../intmath.h"
#include <bit>
// m for math
namespace threed::m {
struct fixed_t {
const static size_t Fac = 15;
constexpr static int32_t Mul = (1 << Fac);
int32_t value;
constexpr fixed_t(int non_fixed) : value(non_fixed * Mul) {}
constexpr fixed_t(int64_t scaled_value, int factor) : value((scaled_value * Mul) / factor) {}
constexpr fixed_t(int fixed_val, std::nullptr_t) : value(fixed_val) {}
// fixed_t(float f) : value(f * (1 << Fac)) {}
constexpr fixed_t() : value{} {};
constexpr int32_t round() const {
return intmath::round10(value, Mul);
}
constexpr int32_t ceil() const {
return intmath::ceil10(value, Mul);
}
constexpr int32_t floor() const {
return intmath::floor10(value, Mul);
}
constexpr int32_t trunc() const {
return value / Mul;
}
constexpr explicit operator int32_t() const {
return trunc();
}
#define make_op(x) constexpr inline fixed_t operator x(int other) const { return fixed_t(value x other * Mul, nullptr); } \
constexpr inline fixed_t& operator x##= (int other) {value x##= other * Mul; return *this;}
make_op(+);
make_op(-);
#undef make_op
#define make_op(x) constexpr inline fixed_t operator x(int other) const { return fixed_t(value x other, nullptr); } \
constexpr inline fixed_t& operator x##= (int other) {value x##= other; return *this;}
make_op(/);
make_op(*);
#undef make_op
#define make_op(x) constexpr inline fixed_t operator x(fixed_t other) const { return fixed_t(value x other.value, nullptr); } \
constexpr inline fixed_t& operator x##= (fixed_t other) {value x##= other.value; return *this;}
make_op(+)
make_op(-)
#undef make_op
constexpr fixed_t operator*(fixed_t other) const {
// Converted to assembly because gcc is dumb and doesn't know how to use shift rights properly..
//
// Implements:
#ifdef SIM
int64_t res = (int64_t)value * (int64_t)other.value;
return fixed_t(res / Mul, nullptr);
#else
if (std::is_constant_evaluated()) {
int64_t res = (int64_t)value * (int64_t)other.value;
return fixed_t(res / Mul, nullptr);
}
uint32_t result_value;
uint32_t _scratch;
// implemented without naked to try and let gcc optimize out loads
asm (
"smull %[ResultValue], %[ClobberB], %[InputA], %[InputB]\n\t" // (ClobberB:ResultValue) [res] = (a*b)
"bfi %[ResultValue], %[ClobberB], #0, %[Fac]\n\t" // copy low Fac bits of the high word into the low word
: [ResultValue] "=r" (result_value), [ClobberB] "=r"(_scratch) // output
: [InputA] "r" (value), [InputB] "r" (other.value), [Fac] "i" (Fac) // input
);
return fixed_t((int32_t)std::rotr(result_value, Fac), nullptr); // This rotate is performed in c to let gcc potentially optimize it into a following alu op2
#endif
}
constexpr fixed_t operator/(fixed_t other) const {
int64_t a = (int64_t)value * (int64_t)Mul; // done here to try and get the compiler to use SMULL
int64_t b = other.value;
return fixed_t(a / b, nullptr);
}
#define make_op(x) inline constexpr fixed_t& operator x##= (fixed_t other) {return (*this = *this x other);}
make_op(*)
make_op(/)
#undef make_op
constexpr fixed_t operator-() const {
return fixed_t{-value, nullptr};
}
#define make_op(x) constexpr inline bool operator x (fixed_t other) const {return value x other.value;} \
constexpr inline bool operator x (int other) const {return value x (other * Mul);}
make_op(<)
make_op(>)
make_op(<=)
make_op(>=)
make_op(==)
make_op(!=)
#undef make_op
};
constexpr inline fixed_t PI = fixed_t(31415926, 10e6);
constexpr inline fixed_t TWOPI = fixed_t(62831853, 10e6);
constexpr inline fixed_t HALFPI = fixed_t(15707963, 10e6);
fixed_t sin(fixed_t v);
fixed_t cos(fixed_t v);
fixed_t tan(fixed_t v);
fixed_t sqrt(fixed_t v);
fixed_t random(fixed_t min, fixed_t max);
}
#define make_op(x) inline threed::m::fixed_t operator x (int a, threed::m::fixed_t b) { return b x a; }
make_op(+)
make_op(*)
#undef make_op
#define make_op(x) inline auto operator x (int a, threed::m::fixed_t b) { return threed::m::fixed_t(a) x b; }
make_op(-)
make_op(/)
make_op(<)
make_op(>)
make_op(<=)
make_op(>=)
make_op(==)
make_op(!=)
#undef make_op
#endif
|
mincrmatt12/MSign
|
esp/main/webui.cfg.h
|
namespace webui {
enum struct WebuiMode {
DISABLED,
LOCAL,
PROXIED
};
//!cfg: holds .webui.mode, default webui::WebuiMode::LOCAL
extern WebuiMode mode;
//!cfg: holds .webui.login.user, default "admin"
extern const char * login_user;
//!cfg: holds .webui.login.password, default "<PASSWORD>"
extern const char * login_password;
}
|
mincrmatt12/MSign
|
esp/main/grabber/grab.h
|
<gh_stars>1-10
#ifndef MSN_GRAB_H
#define MSN_GRAB_H
#include <FreeRTOS.h>
#include "../common/slots.h"
namespace grabber {
// Start the timer that ensure grabber is running when requested.
void start();
struct Grabber {
void (*init_func)(){};
bool (*grab_func)(){}; // returns true for normal timeout, false for failure timeout
TickType_t loop_time = pdMS_TO_TICKS(10000);
TickType_t fail_time = pdMS_TO_TICKS(1000);
bool ssl = false;
slots::protocol::GrabberID associated{};
bool refreshable = false;
};
constexpr Grabber make_http_grabber(void (*_if)(), bool (*_gf)(), TickType_t loop, TickType_t fail=pdMS_TO_TICKS(5000)) {
Grabber g;
g.init_func = _if;
g.grab_func = _gf;
g.loop_time = loop;
g.fail_time = fail;
g.ssl = false;
return g;
}
constexpr Grabber make_https_grabber(void (*_if)(), bool (*_gf)(), TickType_t loop, TickType_t fail=pdMS_TO_TICKS(8000)) {
Grabber g;
g.init_func = _if;
g.grab_func = _gf;
g.loop_time = loop;
g.fail_time = fail;
g.ssl = true;
return g;
}
constexpr Grabber make_refreshable_grabber(const Grabber& base, slots::protocol::GrabberID gid) {
Grabber g = base;
g.refreshable = true;
g.associated = gid;
return g;
}
void refresh(slots::protocol::GrabberID gid);
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/transit/common.cfg.h
|
<filename>esp/main/grabber/transit/common.cfg.h
#pragma once
namespace transit {
enum TransitImplementation {
NONE,
TTC,
GTFS
};
//!cfg: holds .transit_implementation, default transit::TTC
extern TransitImplementation impl;
enum TransitDirectionCode : char {
NA = '\x00',
WEST = 'W',
EAST = 'E',
NORTH = 'N',
SOUTH = 'S'
};
}
|
mincrmatt12/MSign
|
esp/main/wifitime.h
|
#ifndef WIFI_H
#define WIFI_H
#include <FreeRTOS.h>
#include <portmacro.h>
#include <event_groups.h>
namespace wifi {
bool init();
extern EventGroupHandle_t events;
uint64_t get_localtime();
uint64_t millis_to_local(uint64_t millis);
enum Events : EventBits_t {
WifiConnected = 1,
TimeSynced = 2,
StmConnected = 4,
GrabRequested = 8,
GrabTaskStop = 16, // set when the task should stop
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/common/slots.h
|
#ifndef SLOTS_H
#define SLOTS_H
#include <stdint.h>
#include <string.h>
namespace slots {
// The comments here are important, as they get parsed by the dissector.
// They _must_ be in the format
// <type>; [optionalparameter] (stuff)
// or
// ''
// to indicate the same as previous
// the structs with flags must be in the form uint<>_t something_bla, enum SomethingBla
enum DataID : uint16_t {
WIFI_STATUS = 0x01, // STRUCT; WifiStatus, info about wifi connection
WEBUI_STATUS = 0x02, // STRUCT; WebuiStatus, flag bitmask
VIRTUAL_BUTTONMAP = 0x10, // UINT16_T; bitmap, override of the data on GPIOA for the buttons
TTC_INFO = 0x20, // STRUCT; TTCInfo
TTC_NAME_1 = 0x21, // STRING; name of bus/tram in slot 1; polled
TTC_NAME_2 = 0x22, // ''
TTC_NAME_3 = 0x23, // ''
TTC_NAME_4 = 0x24, // ''
TTC_NAME_5 = 0x25, // ''
TTC_TIME_1a = 0x30, // UINT64_T[]; TTCTime - time of next up to six buses (row a)
TTC_TIME_2a = 0x31, // ''
TTC_TIME_3a = 0x32, // ''
TTC_TIME_4a = 0x33, // ''
TTC_TIME_5a = 0x34, // ''
TTC_TIME_1b = 0x3a, // UINT64_T[]; TTCTime - time of next up to six buses (row b)
TTC_TIME_2b = 0x3b, // ''
TTC_TIME_3b = 0x3c, // ''
TTC_TIME_4b = 0x3d, // ''
TTC_TIME_5b = 0x3e, // ''
TTC_ALERTSTR = 0x2a, // STRING; current alerts
WEATHER_ICON = 0x40, // STRING; icon name from darksky
WEATHER_INFO = 0x44, // STRUCT; WeatherInfo
WEATHER_STATUS = 0x45, // STRING; weather status string
WEATHER_ARRAY = 0x46, // STRING; list of ENUMS for the state per-hour
WEATHER_TIME_SUN = 0x42, // STRUCT; WeatherTimes - time for sunrise/sunset, used to show the info for hourlybar
WEATHER_TEMP_GRAPH = 0x4a, // INT16_T[]; feels like temp data per hour (/100)
WEATHER_RTEMP_GRAPH = 0x4b, // INT16_T[]; real temp data per hour (/100)
WEATHER_WIND_GRAPH = 0x4c, // INT16_T[]; wind strength per hour (/100)
WEATHER_HPREC_GRAPH = 0x4d, // STRUCT[]; PrecipData, temp data per hour
WEATHER_MPREC_GRAPH = 0x4e, // STRUCT[]; PrecipData, temp data per minute (decimated to every 2 minutes)
MODEL_INFO = 0x900, // STRUCT; ModelInfo; number of triangles in the model
MODEL_DATA = 0x901, // STRUCT[]; Tri; entire model data
MODEL_CAM_MINPOS = 0x905, // STRUCT; Vec3; minimum position of the camera
MODEL_CAM_MAXPOS = 0x906, // ''; maximum position of the camera
MODEL_CAM_FOCUS = 0x907, // STRUCT[]; Vec3; lookat points of camera
SCCFG_INFO = 0xb0, // STRUCT; ScCfgInfo, enabled screen bitmask, screen on/off
SCCFG_TIMING = 0xb1, // STRUCT[]; ScCfgTime, how long to enable a certain screen
};
#pragma pack (push, 1)
struct WebuiStatus {
uint16_t flags;
enum Flags : uint16_t {
RECEIVING_SYSUPDATE = 1,
RECEIVING_WEBUI_PACK = 2,
RECEIVING_CERT_PACK = 4,
LAST_RX_FAILED = 16,
};
};
struct WifiStatus {
bool connected;
uint8_t ipaddr[4];
uint8_t gateway[4];
};
struct TTCInfo {
uint32_t flags;
char altdircodes_a[5]; // direction code for times_a
char altdircodes_b[5]; // direction code for times_b (if null, no data should be present there)
uint8_t stopdistance[5]; // minutes to walk to a given stop. if 0, assume a sane default.
enum Flags : uint32_t {
EXIST_0 = (1 << 0),
EXIST_1 = (1 << 1), // the slot has data r.n.
EXIST_2 = (1 << 2),
EXIST_3 = (1 << 3),
EXIST_4 = (1 << 4),
SUBWAY_ALERT = (1 << 20), // there is an alert for the subway
SUBWAY_DELAYED = (1 << 21), // we think the alert means there's a delay
SUBWAY_OFF = (1 << 22), // we think the alert means the subway is currently broken / out of service / off
};
const static inline uint32_t EXIST_MASK = 0b11111;
};
struct WeatherInfo {
// all temperatures are stored in centidegrees celsius
int16_t ctemp;
int16_t ltemp;
int16_t htemp;
int16_t crtemp;
};
struct WeatherTimes {
uint64_t sunrise, sunset;
};
struct VStr {
uint8_t index;
uint8_t size;
uint8_t data[14];
};
struct ScCfgTime {
uint32_t millis_enabled;
enum ScreenId : uint8_t {
TTC = 0,
WEATHER = 1,
MODEL = 2,
PARCELS = 3,
JENKINS = 4,
PRINTER = 5
} screen_id;
};
struct ScCfgInfo {
uint16_t enabled_mask;
bool display_on;
enum EnabledMask : uint16_t {
TTC = 1 << ScCfgTime::TTC,
WEATHER = 1 << ScCfgTime::WEATHER,
MODEL = 1 << ScCfgTime::MODEL,
PARCELS = 1 << ScCfgTime::PARCELS,
JENKINS = 1 << ScCfgTime::JENKINS,
PRINTER = 1 << ScCfgTime::PRINTER
};
};
struct ModelInfo {
uint16_t tri_count;
bool use_lighting;
};
struct PrecipData {
uint8_t is_snow; // is this preciptation snowy
uint8_t probability; // from 0-255 as 0.0-1.0
int16_t stddev; // precipitation error (0 if unknown) * 100
int16_t amount; // mm / hr * 100
};
struct Vec3 {
int16_t x;
int16_t y;
int16_t z;
//!cfg: receives .x
void set_x(float value) {
x = (int16_t)(value * 512.f);
}
//!cfg: receives .y
void set_y(float value) {
y = (int16_t)(value * 512.f);
}
//!cfg: receives .z
void set_z(float value) {
z = (int16_t)(value * 512.f);
}
};
struct Tri { // effective declaration for ESP only; actual triangle struct is used and declared in threed.h
Vec3 p1, p2, p3;
uint8_t r, g, b;
uint8_t pad; // perhaps something relating to optimizations or some bs at some point, but this needs to align properly
};
#pragma pack (pop)
enum struct WeatherStateArrayCode : uint8_t {
UNK = 0,
CLEAR = 0x10,
PARTLY_CLOUDY,
MOSTLY_CLOUDY,
OVERCAST,
DRIZZLE = 0x20,
LIGHT_RAIN,
RAIN,
HEAVY_RAIN,
SNOW = 0x30,
HEAVY_SNOW,
FOG = 0x40
};
// PROTOCOL DEFINITIONS
namespace protocol {
enum Command : uint8_t {
HANDSHAKE_INIT = 0x10,
HANDSHAKE_RESP,
HANDSHAKE_OK,
HANDSHAKE_UOK,
DATA_TEMP = 0x20,
DATA_FULFILL,
DATA_RETRIEVE,
DATA_REQUEST,
DATA_SET_SIZE,
DATA_STORE,
ACK_DATA_TEMP = 0x30,
ACK_DATA_FULFILL,
ACK_DATA_RETRIEVE,
ACK_DATA_REQUEST,
ACK_DATA_SET_SIZE,
ACK_DATA_STORE,
QUERY_TIME = 0x40,
RESET = 0x50,
PING,
PONG,
UPDATE_CMD = 0x60,
UPDATE_IMG_DATA,
UPDATE_IMG_START,
UPDATE_STATUS,
CONSOLE_MSG = 0x70,
REFRESH_GRABBER = 0x80,
SLEEP_ENABLE = 0x81
};
enum struct TimeStatus : uint8_t {
Ok = 0,
NotSet = 1,
Timeout = 0xff
};
enum struct DataStoreFulfillResult : uint8_t {
Ok = 0,
NotEnoughSpace_TryAgain,
NotEnoughSpace_Failed,
IllegalState = 0x10,
InvalidOrNak = 0x11,
Timeout = 0xff
};
enum struct UpdateStatus : uint8_t {
ENTERED_UPDATE = 0x10,
READY_FOR_IMAGE = 0x12,
READY_FOR_CHUNK = 0x13,
BEGINNING_COPY = 0x20,
COPY_COMPLETED,
RESEND_LAST_CHUNK_CSUM = 0x30,
ABORT_CSUM = 0x40,
PROTOCOL_ERROR
};
enum struct UpdateCmd : uint8_t {
CANCEL_UPDATE = 0x10,
PREPARE_FOR_IMAGE,
ERR_IMG_READ = 0x30,
ERR_IMG_CSUM,
ERR_STATUS,
UPDATE_COMPLETED_OK = 0x40,
ESP_WROTE_SECTOR = 0x50,
ESP_COPYING
};
enum struct GrabberID : uint8_t {
TRANSIT = 0,
WEATHER = 1,
MODELSERVE = 2,
CFGPULL = 3,
ALL = 0xfa,
NONE = 0xfb
};
}
// PACKET WRAPPER
template<uint8_t CS=0> struct PacketWrapper;
template<>
struct PacketWrapper<0> {
uint8_t direction;
uint8_t size;
uint8_t cmd_byte;
const static inline uint8_t FromStm = 0xa5;
const static inline uint8_t FromEsp = 0xa6;
// Lots of helpers
inline bool from_stm() const {return direction == FromStm;}
inline bool from_esp() const {return direction == FromEsp;}
inline operator bool() const {return direction >= 0xa5;}
inline protocol::Command cmd() const {return static_cast<protocol::Command>(cmd_byte);}
inline uint8_t * data() {return reinterpret_cast<uint8_t *>(this) + 3;}
inline const uint8_t * data() const {return reinterpret_cast<const uint8_t *>(this) + 3;}
// These could just be R& things, but i'm trying to avoid breaking aliasing.
// Read helpers
template<typename R>
R at(uint8_t byte_offset) const {
// for now, we use memcpy since it's more correct re: aliasing rules
R res;
memcpy(&res, data() + byte_offset, sizeof(R));
return res;
}
// Write helper
template<typename T>
void put(T value, uint8_t byte_offset) {
memcpy(data() + byte_offset, &value, sizeof(T));
}
PacketWrapper& operator=(const PacketWrapper& other) = delete;
PacketWrapper& operator=(PacketWrapper&& other) = delete;
PacketWrapper(const PacketWrapper& other) = delete;
PacketWrapper(PacketWrapper&& other) = delete;
PacketWrapper() = default;
};
// NOTE: this (the layout of inherited members) is fairly unstandardized, _however_ in c++23 this will be enforced.
template<uint8_t ConstantSize>
struct PacketWrapper : public PacketWrapper<0> {
uint8_t _data[ConstantSize];
inline void init(uint8_t cmd) {
#if (defined(STM32F205xx) || defined(STM32F207xx))
direction = FromStm;
#else
direction = FromEsp;
#endif
cmd_byte = cmd;
size = ConstantSize;
}
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/srv.h
|
<filename>stm/src/srv.h
#ifndef SRV_H
#define SRV_H
#include <stdint.h>
#include <type_traits>
#include "common/slots.h"
#include "protocol.h"
#include "common/bheap.h"
#include "common/heapsize.h"
#include <FreeRTOS.h>
#include <stream_buffer.h>
#include <semphr.h>
#include <queue.h>
#include <task.h>
namespace srv {
// Talks to the ESP8266
//
// Manages slots of arbitrary length data using the bheap.
//
// NOTE: the result of a call to data() may become invalid at any point, unless
// the lock is held, in which case they will remain valid until the lock is next given.
//
// This class also handles the update procedure.
struct Servicer final : private ProtocolImpl {
// Init HW & RTOS stuff.
void init();
bool ready(); // is the esp talking?
bool updating() {return is_updating;} // are we in update mode?
using ProtocolImpl::dma_finish;
// Runs the servicer blocking.
void run();
// Update state introspections
const char * update_status();
// Data request methods
void set_temperature(uint16_t slotid, uint32_t temperature);
void set_temperature_group(uint32_t temperature, uint16_t len, const uint16_t * slotids, bool sync=false);
template<uint16_t ...Slots>
void set_temperature_all(uint32_t temperature) {
const static uint16_t sidlist[] = {Slots...};
set_temperature_group(temperature, sizeof...(Slots), sidlist);
}
template<typename... Args>
void set_temperature_all(uint32_t temperature, Args... args) {
(set_temperature(args, temperature), ...);
immediately_process();
}
const bheap::TypedBlock<uint8_t *>& slot(uint16_t slotid) {return slot<uint8_t *>(slotid);}
inline const bheap::TypedBlock<uint8_t *>& operator[](uint16_t slotid) {return slot<uint8_t *>(slotid);}
// Data access methods
template<typename T>
inline const bheap::TypedBlock<T>& slot(uint16_t slotid) {return _slot(slotid).as<T>();}
// Helpers
bool slot_dirty(uint16_t slotid, bool clear=true);
// Locking operations.
//
// You must have a lock to access slot/set_temperature.
//
// Once the lock is given, all references returned by slot become invalid.
//
// Note the lock is only on _data_; temperature updates will still occur.
void take_lock();
void give_lock();
// Read from the debug log. Will block for the timeout amount of ticks and will return up to the amount of data requested.
// Returns the amount of data read
size_t read_dbg(uint8_t *buf, size_t len, TickType_t timeout);
// Write to the debug output. Will block until there is space to queue the data. Normally always flushes, if flush is set to false but
// there is no space in the buffer we still trigger a flush to avoid deadlocking.
//
// Always writes the entire buffer or times out.
bool write_dbg(uint8_t *buf, size_t len, TickType_t timeout, bool should_flush=true);
// Request time information from the ESP
slots::protocol::TimeStatus request_time(uint64_t& reponse, uint64_t &time_when_sent);
// Ask ESP to refresh a specific grabber (dataset)
void refresh_grabber(slots::protocol::GrabberID which);
// Reset system
[[noreturn]]
void reset();
// Enter/exit sleep mode
void set_sleep_mode(bool enabled);
// Immediately request that the servicer respond to all pending requests, instead of every 400ms
void immediately_process();
private:
const bheap::Block& _slot(uint16_t slotid);
bheap::Arena<STM_HEAP_SIZE, lru::Cache<4, 8>> arena;
// Called from ISR and populates queue.
void process_command() override;
// Wait send to complete (or return if not sending)
void wait_for_not_sending(); // uses notification
// Update specific routines
// Handle a single packet in update mode
void process_update_packet(uint8_t cmd, uint8_t len);
// Handle an UPDATE_CMD
void process_update_cmd(slots::protocol::UpdateCmd cmd);
// Send a single UPDATE_STATUS
void send_update_status(slots::protocol::UpdateStatus status);
// Main loop in update mode.
void do_update_logic();
// Connect to the ESP
void do_handshake();
// full_cleanup is whether or not to allow doing anything that could evict packets (but still allow locking/invalidating the cache)
void try_cleanup_heap(ssize_t space_to_clear); // returns done
void check_connection_ping(); // verify we're still connected with last_transmission
void send_data_requests(); // send DATA_REQUEST for all "dirty" remote blocks.
// Are we currently doing an update? If so, we _won't_ process _any_ data requests.
bool is_updating = false;
uint8_t update_state = 0;
// status shown on screen
char update_status_buffer[16];
// buffer of the last update package
uint8_t update_pkg_buffer[256];
// size of update pkg
uint32_t update_pkg_size = 0;
// update total size (new bin length)
uint32_t update_total_size = 0;
// checksum of entire update
uint16_t update_checksum = 0;
// how many chunks remaining in update
uint16_t update_chunks_remaining = 0;
// Sync primitives + log buffers + dma buffer
SemaphoreHandle_t bheap_mutex;
StaticSemaphore_t bheap_mutex_private;
// Queue for incoming set temperature requests. 16 elements long (or 64 bytes)
// The format of these requests is this struct:
struct PendRequest {
struct TimeRequest {
TaskHandle_t notify;
slots::protocol::TimeStatus &status_out;
uint64_t ×tamp_out;
uint64_t &start_out;
// used to avoid writing into weird memory
volatile int magic = 0x1234abcd;
~TimeRequest() {magic = 0;}
operator bool() const {return magic == 0x1234abcd;}
};
// Does _not_ sync, intended for "groups" in flash -- see set_temperature_all's template version
struct MultiTempRequest {
uint16_t temperature : 2;
uint16_t amount : 14;
const uint16_t * entries;
};
union {
struct {
uint16_t slotid : 12;
uint16_t temperature : 2;
};
TimeRequest * rx_req;
MultiTempRequest mt_req;
slots::protocol::GrabberID refresh;
bool sleeping;
TaskHandle_t sync_with;
};
enum PendRequestType : uint8_t {
TypeNone = 0,
TypeChangeTemp,
TypeDumpLogOut,
TypeRxTime,
TypeChangeTempMulti,
TypeRefreshGrabber,
TypeSleepMode,
TypeReset,
TypeSync
} type;
};
QueueHandle_t pending_requests;
// Static queue allocation
StaticQueue_t pending_requests_private;
uint8_t pending_requests_data[40 * sizeof(PendRequest)];
// Returns if no continuation is requred
bool start_pend_request(PendRequest &req);
bool needs_temperature_update(uint16_t slotid, uint16_t temperature);
// Stream buffers for dma-ing
//
// Specifically only receive as [citation needed] we don't need to queue up transmissions.
StreamBufferHandle_t dma_rx_queue;
uint8_t dma_rx_queue_data[2048];
StaticStreamBuffer_t dma_rx_queue_private;
// Stream buffers for sending/rx-ing debug stuff
StreamBufferHandle_t log_in, log_out;
uint8_t log_in_data[176], log_out_data[128];
StaticStreamBuffer_t log_in_private, log_out_private;
// The task to notify whenever we add something to the queue.
//
// This (ab)uses a fun property of stream buffers in that they use tasknotifications to work
// and due to how the function is implemented (to deal with timeouts) if we send a bogus notification
// ourselves whenever we update the queue we can avoid having to do weird hacks.
//
// We also store a bool that is only true when waiting in the main xStreamBufferReceive to avoid interrupting ones
// that are designed not to be interrupted.
TaskHandle_t this_task;
volatile bool can_interrupt_with_notification = false;
};
struct ServicerLockGuard {
ServicerLockGuard(Servicer& srv) :
srv(srv) {
srv.take_lock();
}
~ServicerLockGuard() {
srv.give_lock();
}
private:
Servicer& srv;
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/tasks/timekeeper.h
|
#ifndef TIMEKEEPER_H
#define TIMEKEEPER_H
#include <stdint.h>
namespace tasks {
struct Timekeeper {
Timekeeper(uint64_t ×tamp) :
timestamp(timestamp) {
}
void loop();
void systick_handler();
// Current time; as in the systick time. Useful if you don't want the clock going backwards when the ESP updates / animation.
uint32_t current_time = 0;
private:
uint32_t last_run_time = 0;
bool first = true;
uint64_t ×tamp;
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/common/bootcmd.h
|
#ifndef BOOTCMD_H
#define BOOTCMD_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
void bootcmd_init();
enum _bootcmd_t {
BOOTCMD_RUN = 0x00ull,
BOOTCMD_UPDATE = 0x01,
BOOTCMD_NEW_LOADER = 0x02
};
typedef enum _bootcmd_t bootcmd_t;
bool bootcmd_did_just_update();
bootcmd_t bootcmd_get_cmd();
uint32_t bootcmd_update_size();
void bootcmd_request_update(uint32_t size);
void bootcmd_service_update();
void bootcmd_set_silent(bool on);
bool bootcmd_get_silent();
const char * bootcmd_get_bl_revision();
// BOOTCMD is implemented using the RTC backup registers, similar to the ESP8266's eboot.
//
// Register Map
// 00 - bootcmd
// 01 - did just update flag, cleared by application
// 02 - requested update size
// 03 - bootloader revision string (max 4 chars)
// 04 - is silent/sleep mode (do updates/reboots without turning on the screen)
#ifdef __cplusplus
};
#endif
#endif
|
mincrmatt12/MSign
|
esp/components/libb64/include/b64/ccommon.h
|
/*
ccommon.h - common header for encoding and decoding algorithm
This is part of the libb64 project, and has been placed in the public domain.
For details, see http://sourceforge.net/projects/libb64
*/
#ifndef BASE64_CCOMMON_H
#define BASE64_CCOMMON_H
#define BASE64_VER_MAJOR 2
#define BASE64_VER_MINOR 0
#endif /* BASE64_CCOMMON_H */
|
mincrmatt12/MSign
|
stm/src/crash/decode.h
|
<filename>stm/src/crash/decode.h
#ifndef MSN_CRASH_DECODE_H
#define MSN_CRASH_DECODE_H
#include <stddef.h>
#include <stdint.h>
namespace crash::decode {
constexpr inline size_t max_length_size = 100;
void fill_backtrace(uint32_t backtrace[], uint16_t &backtrace_length, uint32_t PC, uint32_t LR, uint32_t SP);
void resolve_symbols(char resolved[][max_length_size], const uint32_t backtrace[], uint16_t length);
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/modelserve.h
|
<reponame>mincrmatt12/MSign<filename>esp/main/grabber/modelserve.h<gh_stars>1-10
#ifndef MSIGN_MSR_H
#define MSIGN_MSR_H
#include "grab.h"
namespace modelserve {
void init();
bool loop();
// Every 200 seconds (or 3m20 seconds) we change the model
constexpr static auto modelserve_grabber = grabber::make_refreshable_grabber(
grabber::make_http_grabber(init, loop, pdMS_TO_TICKS(200*1000)),
slots::protocol::GrabberID::MODELSERVE
);
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/dejavu_8.h
|
#ifndef FONT_DEJAVUSANS_8_H
#define FONT_DEJAVUSANS_8_H
namespace font::dejavusans_8 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
#endif
|
mincrmatt12/MSign
|
stm/src/common/lru.h
|
<filename>stm/src/common/lru.h
#ifndef LRU_H
#define LRU_H
#include <stdint.h>
#include <stddef.h>
#include <type_traits>
namespace lru {
template<size_t Buckets, size_t ChainLength>
struct Cache {
static_assert(!(Buckets & (Buckets - 1)), "Buckets must be power of two");
bool contains(uint16_t key) const {
for (int i = 0; i < ChainLength; ++i) {
if (bucket_for(key)[i] >> 16 == key) return true;
}
return false;
}
// Lookup while updating LRU
uint16_t lookup(uint16_t key) {
int i = 0;
for (; i < ChainLength; ++i) {
if (bucket_for(key)[i] >> 16 == key) break;
}
if (i == ChainLength) return 0;
if (i) std::swap(bucket_for(key)[0], bucket_for(key)[i]);
return bucket_for(key)[0] & 0xffff;
}
// Lookup without updating LRU
uint16_t lookup(uint16_t key) const {
for (int i = 0; i < ChainLength; ++i) {
if (bucket_for(key)[i] >> 16 == key) {
return bucket_for(key)[i] & 0xffff;
}
}
return 0;
}
// Evict all values
void evict() {
memset(values, 0, sizeof values);
}
// Evict value for key
void evict(uint16_t key) {
for (int i = 0; i < ChainLength; ++i) {
if (bucket_for(key)[i] >> 16 == key) bucket_for(key)[i] = 0;
}
}
// Evict value for key if it matches a value
void evict_if(uint16_t key, uint16_t invalidated) {
for (int i = 0; i < ChainLength; ++i) {
if (bucket_for(key)[i] == ((static_cast<uint32_t>(key) << 16) | invalidated)) bucket_for(key)[i] = 0;
}
}
// Set the value for a key
void insert(uint16_t key, uint16_t value) {
int i = 0;
for (; i < ChainLength; ++i) {
if (bucket_for(key)[i] == 0) break;
}
if (i == ChainLength) {
--i;
}
if (i) std::swap(bucket_for(key)[0], bucket_for(key)[i]);
bucket_for(key)[0] = (static_cast<uint32_t>(key) << 16) | value;
}
// Either retrieve the value for a key or calculate it and insert it with a provided functor.
template<typename Func>
uint16_t lookup_or_calculate(uint16_t key, Func&& provider) {
if (contains(key)) return lookup(key);
else {
uint16_t value = provider();
insert(key, value);
return value;
}
}
private:
uint32_t* bucket_for(uint16_t key) {
const uint16_t constant = 40503;
constexpr int shift = 16 - __builtin_ctz(Buckets);
return values[static_cast<uint16_t>(key * constant) >> shift];
}
const uint32_t* bucket_for(uint16_t key) const {
const uint16_t constant = 40503;
constexpr int shift = 16 - __builtin_ctz(Buckets);
return values[static_cast<uint16_t>(key * constant) >> shift];
}
uint32_t values[Buckets][ChainLength]{};
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/common/heapsize.h
|
#pragma once
#define ESP_HEAP_SIZE (15*1024)
#define STM_HEAP_SIZE (13*1024)
|
mincrmatt12/MSign
|
esp/main/protocol.h
|
#ifndef MSN_PROTOCOL_H
#define MSN_PROTOCOL_H
// Re-pluggable protocol layer:
//
// Contains simple functions to wait for a packet header and wait for packet body.
#include <stdint.h>
#include <FreeRTOS.h>
#include <task.h>
#include "common/slots.h"
namespace protocol {
struct ProtocolImpl {
void init_hw(); // Setup hardware settings and begin RX processing task.
// This entire class will call on_pkt whenever it gets a packet from a
// blockable thread.
void send_pkt(const void *packet); // Send a packet out blocking.
inline void send_pkt(const slots::PacketWrapper<>& pw) {
send_pkt(&pw);
}
bool wait_for_packet(TickType_t timeout=portMAX_DELAY);
protected:
union {
uint8_t rx_buf[258];
slots::PacketWrapper<255> rx_pkt;
};
unsigned get_processing_delay(); // return the number of milliseconds (rounded down) from when we received the header of the last packet.
private:
unsigned last_received_at;
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/latob_11.h
|
#ifndef FONT_LATO_BOLD_11_H
#define FONT_LATO_BOLD_11_H
namespace font::lato_bold_11 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /usr/share/fonts/truetype/lato/Lato-Bold.ttf
#endif
|
mincrmatt12/MSign
|
sim/src/esp/esp_system.h
|
<gh_stars>1-10
#ifndef ESP_SYSTEM_FAKE
#define ESP_SYSTEM_FAKE
#define heap_caps_get_free_size(x) 10000
#define esp_get_free_heap_size() 10000
#include <stdlib.h>
#include <stddef.h>
static void esp_restart() {
exit(1);
}
static void esp_fill_random(void *buf, size_t len) {}
#define esp_random random
#define IRAM_ATTR
#endif
|
mincrmatt12/MSign
|
stm/src/tasks/debug.h
|
<reponame>mincrmatt12/MSign
#ifndef MSS_DEBUG_H
#define MSS_DEBUG_H
#include <stdint.h>
#include "timekeeper.h"
namespace tasks {
struct DebugConsole {
DebugConsole(Timekeeper &tim) : tim(tim) {
}
void run();
private:
Timekeeper& tim;
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/sccfg.h
|
#ifndef MSIGN_SC_H
#define MSIGN_SC_H
#include "grab.h"
#include "../common/slots.h"
namespace sccfg {
// This is both a grabber and module for other grabbers to tie into.
void init();
bool loop();
void set_force_disable_screen(slots::ScCfgInfo::EnabledMask e, bool on);
void set_force_enable_screen(slots::ScCfgInfo::EnabledMask e, bool on);
constexpr static auto sccfg_grabber = grabber::make_https_grabber(init, loop, pdMS_TO_TICKS(30*1000));
}
#endif
|
mincrmatt12/MSign
|
stm/src/screens/threed.h
|
<gh_stars>1-10
#ifndef THREED_H
#define THREED_H
#include <stdint.h>
#include "../draw.h"
#include "base.h"
#include <string.h>
#include <cmath>
#include "../common/slots.h"
#include "threed/fixed.h"
namespace threed {
struct Vec3 {
m::fixed_t x, y, z;
constexpr Vec3() : x(0), y(0), z(0) {}
constexpr Vec3(m::fixed_t a, m::fixed_t b, m::fixed_t c) : x(a), y(b), z(c) {}
constexpr Vec3(m::fixed_t a) : x(a), y(a), z(a) {}
constexpr Vec3(const slots::Vec3& v) : x(v.x, 512), y(v.y, 512), z(v.z, 512) {}
m::fixed_t length() const;
Vec3 normalize() const;
Vec3 & operator+=(const Vec3& rhs) {
this->x += rhs.x;
this->y += rhs.y;
this->z += rhs.z;
return *this;
}
Vec3 & operator-=(const Vec3& rhs) {
this->x -= rhs.x;
this->y -= rhs.y;
this->z -= rhs.z;
return *this;
}
Vec3& operator*=(const m::fixed_t rhs) {
this->x *= rhs;
this->y *= rhs;
this->z *= rhs;
return *this;
}
Vec3& operator/=(const m::fixed_t rhs) {
this->x /= rhs;
this->y /= rhs;
this->z /= rhs;
return *this;
}
Vec3& operator*=(const int rhs) {
this->x *= rhs;
this->y *= rhs;
this->z *= rhs;
return *this;
}
Vec3& operator/=(const int rhs) {
this->x /= rhs;
this->y /= rhs;
this->z /= rhs;
return *this;
}
Vec3 operator+(const Vec3& rhs) const { return (Vec3(*this) += rhs); }
Vec3 operator-(const Vec3& rhs) const{ return (Vec3(*this) -= rhs); }
Vec3 operator/(const m::fixed_t rhs) const { return (Vec3(*this) /= rhs); }
Vec3 operator*(const m::fixed_t rhs) const { return (Vec3(*this) *= rhs); }
Vec3 operator/(const int rhs) const { return (Vec3(*this) /= rhs); }
Vec3 operator*(const int rhs) const { return (Vec3(*this) *= rhs); }
Vec3 operator-() const {
return Vec3(-x, -y, -z);
}
m::fixed_t dot(const Vec3& other) const;
Vec3 cross(const Vec3& other) const;
};
struct Vec4 {
m::fixed_t x, y, z, w;
Vec4() : x(0), y(0), z(0), w(0) {}
Vec4(const Vec3 & a, m::fixed_t w) : x(a.x), y(a.y), z(a.z), w(w) {}
Vec4(m::fixed_t a, m::fixed_t b, m::fixed_t c, m::fixed_t d) : x(a), y(b), z(c), w(d) {}
Vec4(slots::Vec3 & a) : x(a.x), y(a.y), z(a.z), w(1) {}
operator Vec3() const {return Vec3(x, y, z);}
Vec4 & operator+=(const Vec4& rhs) {
this->x += rhs.x;
this->y += rhs.y;
this->z += rhs.z;
this->w += rhs.w;
return *this;
}
Vec4 & operator-=(const Vec4& rhs) {
this->x -= rhs.x;
this->y -= rhs.y;
this->z -= rhs.z;
this->w -= rhs.w;
return *this;
}
Vec4& operator*=(const m::fixed_t& rhs) {
this->x *= rhs;
this->y *= rhs;
this->z *= rhs;
this->w *= rhs;
return *this;
}
Vec4& operator/=(const m::fixed_t& rhs) {
this->x /= rhs;
this->y /= rhs;
this->z /= rhs;
this->w /= rhs;
return *this;
}
Vec4& operator*=(const int& rhs) {
this->x *= rhs;
this->y *= rhs;
this->z *= rhs;
this->w *= rhs;
return *this;
}
Vec4& operator/=(const int& rhs) {
this->x /= rhs;
this->y /= rhs;
this->z /= rhs;
this->w /= rhs;
return *this;
}
Vec4 operator+(const Vec4& rhs) const { return (Vec4(*this) += rhs); }
Vec4 operator-(const Vec4& rhs) const{ return (Vec4(*this) -= rhs); }
Vec4 operator/(const m::fixed_t& rhs) const { return (Vec4(*this) /= rhs); }
Vec4 operator*(const m::fixed_t& rhs) const { return (Vec4(*this) *= rhs); }
Vec4 operator/(const int& rhs) const { return (Vec4(*this) /= rhs); }
Vec4 operator*(const int& rhs) const { return (Vec4(*this) *= rhs); }
Vec4 operator-() const {
return Vec4(-x, -y, -z, -w);
}
};
struct Mat4 {
m::fixed_t a[4], b[4], c[4], d[4];
Mat4() : a{1, 0, 0, 0}, b{0, 1, 0, 0}, c{0, 0, 1, 0}, d{0, 0, 0, 1} {}
Mat4(m::fixed_t x) : a{x, 0, 0, 0}, b{0, x, 0, 0}, c{0, 0, x, 0}, d{0, 0, 0, x} {}
Mat4(m::fixed_t m00, m::fixed_t m01, m::fixed_t m02, m::fixed_t m03,
m::fixed_t m10, m::fixed_t m11, m::fixed_t m12, m::fixed_t m13,
m::fixed_t m20, m::fixed_t m21, m::fixed_t m22, m::fixed_t m23,
m::fixed_t m30, m::fixed_t m31, m::fixed_t m32, m::fixed_t m33)
: a{m00, m01, m02, m03}, b{m10, m11, m12, m13}, c{m20, m21, m22, m23}, d{m30, m31, m32, m33} {}
static Mat4 translate(const Vec3 &by);
static Mat4 perspective(m::fixed_t aspect, m::fixed_t fov, m::fixed_t zn, m::fixed_t zf);
static Mat4 rotate(const Vec3& a, m::fixed_t rad);
static Mat4 lookat(const Vec3& from, const Vec3& to, const Vec3& up);
Mat4& operator*=(const Mat4& other) {*this = *this * other; return *this;}
Vec4 operator*(const Vec4& other) const;
Mat4 operator*(const Mat4 &rhs) const;
};
struct Tri {
Vec3 p1, p2, p3;
uint8_t r, g, b;
};
struct Renderer : public screen::Screen {
static void prepare(bool);
Renderer();
~Renderer();
void draw();
bool interact();
constexpr static inline bool require_clearing() {return false;}
void refresh();
private:
void draw_triangle(const Tri& t, bool enable_lighting);
void update_matricies();
int current_tri = 0;
Mat4 perpview;
Vec3 camera_pos, camera_target;
Vec3 current_pos, current_look, current_lookdir;
Vec3 camera_look, camera_look_target;
uint16_t interp_progress = 20000;
uint64_t last_update, last_new_data;
enum InteractMode : uint8_t {
MOVE_POS,
MOVE_LOOK
} im=MOVE_POS;
};
extern size_t tri_count;
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/lcdpixel_6.h
|
#ifndef FONT_LCDPIXEL_6_H
#define FONT_LCDPIXEL_6_H
namespace font::lcdpixel_6 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /home/matthew/projects/stm32-leds/bmap/testfnt/build/lcdpixel.bdf
#endif
|
mincrmatt12/MSign
|
stm/src/crash/rtos.h
|
#ifndef MSN_CRASH_RTOS_H
#define MSN_CRASH_RTOS_H
#include <stdint.h>
namespace crash::rtos {
// Try to figure out the active thread name _safely_, otherwise return null.
const char * guess_active_thread_name();
// Is the RTOS active?
bool is_rtos_running();
void get_task_regs(uint32_t *topofstack, uint32_t& PC, uint32_t& SP, uint32_t &LR);
}
#endif
|
mincrmatt12/MSign
|
stm/src/crash/simplematrix.h
|
<gh_stars>1-10
#ifndef SIMPLMATRIX_H
#define SIMPLMATRIX_H
#include "../gpio.h"
#include <stdint.h>
#include <string.h>
#include "stm32f2xx.h"
#include "stm32f2xx_ll_tim.h"
#include "stm32f2xx_ll_bus.h"
#include "stm32f2xx_ll_gpio.h"
#include "stm32f2xx_ll_dma.h"
#include "../pins.h"
namespace crash {
// Lookup table for color->bitplane conversion
template<size_t Bit>
struct MatrixBitLookupTable {
uint8_t table[256]{};
constexpr MatrixBitLookupTable() {
for (int i = 0; i < 256; ++i) {
bool r = i & (1 << Bit);
bool g = i & (1 << (Bit + 2));
bool b = i & (1 << (Bit + 4));
table[i] = r | (g << 1) | (b << 2);
}
}
};
constexpr MatrixBitLookupTable<0> mblt0{};
constexpr MatrixBitLookupTable<1> mblt1{};
// Minimal version of the real matrix code, only supporting 2-bit color and single-buffered.
struct Matrix {
Matrix() {}
void init() {
// Enable clocks
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1 | LL_APB2_GRP1_PERIPH_TIM9); // timer
LL_AHB1_GRP1_EnableClock(SIGN_GPIO_PERIPH | LL_AHB1_GRP1_PERIPH_GPIOB | LL_AHB1_GRP1_PERIPH_DMA2); // gpios
// Reset GPIO / DMA / TIMER
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1 | LL_APB2_GRP1_PERIPH_TIM9);
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2); // gpios
asm volatile ("nop");
asm volatile ("nop");
asm volatile ("nop");
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1 | LL_APB2_GRP1_PERIPH_TIM9);
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2); // gpios
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1 | LL_APB2_GRP1_PERIPH_TIM9); // timer
LL_AHB1_GRP1_EnableClock(SIGN_GPIO_PERIPH | LL_AHB1_GRP1_PERIPH_GPIOB | LL_AHB1_GRP1_PERIPH_DMA2); // gpios
// Setup the timer.
LL_TIM_InitTypeDef tim_init{};
LL_TIM_DisableCounter(TIM9);
LL_TIM_DisableCounter(TIM1);
tim_init.Prescaler = 8; // Set the timer to run at around 6Mhz, since it's stupid to do it any faster
tim_init.Autoreload = 1;
tim_init.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
LL_TIM_Init(TIM1, &tim_init);
tim_init.Prescaler = 5;
tim_init.Autoreload = 1;
tim_init.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
LL_TIM_Init(TIM9, &tim_init);
LL_TIM_DisableARRPreload(TIM9);
LL_TIM_EnableDMAReq_UPDATE(TIM1);
LL_TIM_EnableIT_UPDATE(TIM9);
// setup gpios
LL_GPIO_InitTypeDef gpio_init{};
gpio_init.Pin = LL_GPIO_PIN_0 | LL_GPIO_PIN_1 | LL_GPIO_PIN_2 | LL_GPIO_PIN_3 | LL_GPIO_PIN_4 | LL_GPIO_PIN_5 | LL_GPIO_PIN_6 | LL_GPIO_PIN_7;
gpio_init.Mode = LL_GPIO_MODE_OUTPUT;
gpio_init.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
gpio_init.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
gpio_init.Pull = LL_GPIO_PULL_DOWN;
LL_GPIO_Init(SIGN_DATA_Port, &gpio_init);
gpio_init.Pin = LL_GPIO_PIN_0 | LL_GPIO_PIN_1 | LL_GPIO_PIN_2 | LL_GPIO_PIN_3 | LL_GPIO_PIN_5 | LL_GPIO_PIN_6;
gpio_init.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOB, &gpio_init);
memset(frame, 0, sizeof(frame));
row = 0;
bitplane = false;
oe = true;
strobe = false;
}
uint8_t frame[256*32];
uint8_t & color(uint16_t x, uint16_t y) {
x = 127 - x;
y = 63 - y;
if (y > 31) {
x += 128;
}
y &= 0x1f;
return frame[x + y*256];
}
void dma_finished() {
// Stop DMA
LL_DMA_DisableStream(DMA2, LL_DMA_STREAM_5);
LL_TIM_DisableCounter(TIM1);
// Set strobe
strobe = true;
// Configure timer 9 (and give panels a bit to respond to the strobe signal)
LL_TIM_SetAutoReload(TIM9, bitplane ? 1800 : 800);
LL_TIM_SetCounter(TIM9, 0);
// Finish strobe
strobe = false;
// Start counting
LL_TIM_EnableCounter(TIM9);
// Enable panels
oe = false;
}
void timer_finished() {
// Stop timer
LL_TIM_DisableCounter(TIM9);
// Stop output
oe = true;
// Can we send the next row?
if (row == 15) {
// No, send next bitplane
bitplane = !bitplane;
row = 0;
}
else {
++row;
}
// Start DMA-ing the next row
start_dmaing_row();
// Setup the next row
GPIOB->ODR = (GPIOB->ODR & 0xfff0) | (row & 0x000f);
}
void start_display() {
// Set row to 0 (matches initial state)
GPIOB->ODR = (GPIOB->ODR & 0xfff0);
// Start dma
start_dmaing_row();
}
private:
uint8_t dma_buffer[513];
uint8_t row;
bool bitplane;
// pins
gpio::Pin<GPIOB_BASE, 5> strobe;
gpio::Pin<GPIOB_BASE, 6> oe;
// Start dma-ing a row.
void start_dmaing_row() {
// Set up the dma buffer
for (int i = 0, j = 0; i < 256; ++i, j+=2) {
dma_buffer[j] = (bitplane ? mblt1.table : mblt0.table)[frame[row*256 + i]] |
((bitplane ? mblt1.table : mblt0.table)[frame[(row+16)*256 + i]]) << 3;
dma_buffer[j+1] = dma_buffer[j] | 64; // set clock
}
dma_buffer[512] = 0;
// Setup the DMA
LL_DMA_SetChannelSelection(DMA2, LL_DMA_STREAM_5, LL_DMA_CHANNEL_6);
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_5, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_5, LL_DMA_PRIORITY_VERYHIGH);
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_5, LL_DMA_MODE_NORMAL);
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_5, LL_DMA_PERIPH_NOINCREMENT);
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_5, LL_DMA_MEMORY_INCREMENT);
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_5, LL_DMA_PDATAALIGN_BYTE);
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_5, LL_DMA_MDATAALIGN_BYTE);
LL_DMA_DisableFifoMode(DMA2, LL_DMA_STREAM_5);
LL_DMA_ConfigAddresses(DMA2, LL_DMA_STREAM_5, (uint32_t)dma_buffer, (uint32_t)(&SIGN_DATA_Port->ODR), LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
LL_DMA_SetDataLength(DMA2, LL_DMA_STREAM_5, 513);
LL_DMA_DisableIT_HT(DMA2, LL_DMA_STREAM_5);
LL_DMA_EnableIT_TC(DMA2, LL_DMA_STREAM_5);
LL_DMA_EnableIT_TE(DMA2, LL_DMA_STREAM_5);
// Start sending bits
LL_DMA_EnableStream(DMA2, LL_DMA_STREAM_5);
LL_TIM_EnableCounter(TIM1);
}
};
}
#endif
|
mincrmatt12/MSign
|
sim/src/stm/crash/main.h
|
#ifndef MSN_SIM_CRASH_H
#define MSN_SIM_CRASH_H
namespace crash {
[[noreturn]] void panic(const char* errcode);
[[noreturn]] void panic_nonfatal(const char* errcode);
};
#endif
|
mincrmatt12/MSign
|
esp/main/config.h
|
<gh_stars>1-10
#ifndef CONFIG_H
#define CONFIG_H
#include <stdint.h>
#include "json.h"
namespace config {
// Slightly less posessive unique_ptr, "lazy" as in "lazily allocated"
template<typename T>
struct lazy_t {
const T* get() const {return ptr;}
const T* get(const T& def) const {return (*this) ? get() : def;}
T* get() {return ptr;}
T* get(const T& def) {return (*this) ? get() : def;}
operator bool() const {return ptr != nullptr;}
operator const T*() const {return ptr;}
operator T*() {return ptr;}
T* operator->() {return ptr;}
T& operator*() {return *ptr;}
const T* operator->() const {return ptr;}
const T& operator*() const {return *ptr;}
~lazy_t() {
if (ptr) {
delete ptr;
ptr = nullptr;
}
}
template<typename I>
lazy_t& operator=(I x) {
static_assert(std::is_same_v<std::decay_t<I>, T*> || (std::is_array_v<T> && std::is_same_v<std::decay_t<I>, std::decay_t<T>>));
if (ptr) delete ptr;
ptr = (T*)x;
return *this;
}
using inner = T;
private:
T* ptr{nullptr};
};
bool parse_config(json::TextCallback&& tcb);
bool parse_config_from_sd();
}
#endif
|
mincrmatt12/MSign
|
stm/src/crash/mindraw.h
|
#ifndef MSN_MINDRAW_H
#define MSN_MINDRAW_H
// bare minimum draw functions
#include <stdint.h>
#include "simplematrix.h"
namespace crash::draw {
// Draw a bitmap image to the framebuffer. Mirroring is based on bit ordering.
void bitmap(Matrix &fb, const uint8_t * bitmap, uint8_t width, uint8_t height, uint8_t stride, uint16_t x, uint16_t y, uint8_t color);
// Draw text to the framebuffer, returning the position where the next character would go.
uint16_t text(Matrix &fb, const uint8_t *text, uint16_t x, uint16_t y, uint8_t color);
uint16_t text(Matrix &fb, const char * text, uint16_t x, uint16_t y, uint8_t color);
// Get number of characters printed until end of line
size_t break_line(const char* text, uint16_t start);
// Draw a filled rectangle using exclusive coordinates (occupies x0 to x1 but not including x1)
void rect(Matrix &fb, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t color);
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/dejavu_12.h
|
<reponame>mincrmatt12/MSign
#ifndef FONT_DEJAVUSANS_12_H
#define FONT_DEJAVUSANS_12_H
namespace font::dejavusans_12 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
#endif
|
mincrmatt12/MSign
|
stm/src/tskmem.h
|
<reponame>mincrmatt12/MSign
#ifndef MSN_TSKMEM_H
#define MSN_TSKMEM_H
#include <FreeRTOS.h>
#include <task.h>
namespace tskmem {
template<size_t Stack>
struct TaskHolder {
TaskHandle_t create(
TaskFunction_t code_ptr,
const char * const name,
void * const parameter,
UBaseType_t priority
) {
return xTaskCreateStatic(
code_ptr,
name,
Stack,
parameter,
priority,
task_stack,
&task_buffer
);
}
template<typename Object>
TaskHandle_t create(Object& obj, const char * const name, UBaseType_t priority) {
return create([](void *arg){((Object *)arg)->run();}, name, &obj, priority);
}
private:
StaticTask_t task_buffer;
StackType_t task_stack[Stack]{};
};
extern TaskHolder<256> srvc;
extern TaskHolder<512> screen;
extern TaskHolder<176> dbgtim;
}
#endif
|
mincrmatt12/MSign
|
sim/src/stm/stm32f2xx_ll_usart.h
|
<reponame>mincrmatt12/MSign
// mock various ll_usart calls
#include "pins.h"
#ifndef MOCK_USART_H
#define MOCK_USART_H
void LL_USART_ClearFlag_ORE(void *) {};
void LL_USART_ClearFlag_PE(void *) {};
#define ESP_USART nullptr
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/vera_8.h
|
<gh_stars>1-10
#ifndef FONT_VERA_8_H
#define FONT_VERA_8_H
namespace font::vera_8 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
#endif
|
mincrmatt12/MSign
|
stm/src/common/util.h
|
#ifndef MSN_UTIL_H
#define MSN_UTIL_H
#include <stddef.h>
#include <stdint.h>
namespace util {
uint16_t compute_crc(uint8_t * buffer, size_t length, uint16_t crc_previous=0);
bool crc_valid(uint8_t * buffer, size_t length_including_crc);
};
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/transit/ttc.h
|
#ifndef TTC_H
#define TTC_H
#include "../grab.h"
namespace transit::ttc {
void init();
bool loop();
// There's no rate limit so....
constexpr static auto ttc_grabber = grabber::make_refreshable_grabber(
grabber::make_https_grabber(init, loop, pdMS_TO_TICKS(45000)),
slots::protocol::GrabberID::TRANSIT
);
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/tahoma_9.h
|
#ifndef FONT_TAHOMA_9_H
#define FONT_TAHOMA_9_H
namespace font::tahoma_9 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /home/matthew/Downloads/tahoma.ttf
#endif
|
mincrmatt12/MSign
|
esp/main/utf.h
|
#ifndef MSN_UTF_H
#define MSN_UTF_H
// Very minimal UTF8 parser and Unicode "normalizer": converts a few select utf8-encoded unicode codepoints to normal ascii.
namespace utf8 {
void process(char * str_in_out);
};
#endif
|
mincrmatt12/MSign
|
stm/src/rng.h
|
#ifndef RNG_H
#define RNG_H
#include <stdint.h>
namespace rng {
void init();
uint32_t get();
uint16_t getclr();
}
#endif
|
mincrmatt12/MSign
|
stm/src/screens/weather.h
|
#ifndef WEATHER_H
#define WEATHER_H
#include "base.h"
#include <stdint.h>
#include "../common/slots.h"
namespace screen {
struct WeatherScreen : public Screen {
WeatherScreen();
~WeatherScreen();
static void prepare(bool);
void draw();
void refresh();
bool interact();
private:
void draw_currentstats();
void draw_hourlybar_header();
void draw_hourlybar(uint8_t hour);
void draw_status();
void fill_hourlybar(int16_t x0, int16_t y0, int16_t x1, int16_t y1, slots::WeatherStateArrayCode wsac, const char *& desc_out, int64_t hourstart, bool vertical_sunrise=false);
void draw_graph_yaxis(int16_t x, int16_t y0, int16_t y1, int32_t &ymin, int32_t &ymax, bool show_decimal=false);
void draw_graph_xaxis(int16_t y, int16_t x0, int16_t y1, int min, bool interpret_as_hours=true);
void draw_graph_lines(int16_t x0, int16_t y0, int16_t x1, int16_t y1, const int16_t * data, size_t amount, int32_t ymin, int32_t ymax, bool show_temp_colors=false);
void draw_graph_precip(int16_t x0, int16_t y0, int16_t x1, int16_t y1, const slots::PrecipData * data, size_t amount, int32_t ymin, int32_t ymax);
void draw_small_tempgraph();
void draw_small_precgraph();
void draw_big_graphs();
void draw_big_hourlybar();
enum Subscreen : uint8_t {
MAIN,
BIG_GRAPH,
BIG_HOURLY,
MAX_SUBSCREEN
} subscreen=MAIN, highlight=BIG_GRAPH;
enum GraphType : uint8_t {
FEELS_TEMP,
REAL_TEMP,
WIND,
PRECIP_HOUR,
PRECIP_DAY,
MAX_GTYPE
} graph = FEELS_TEMP;
TickType_t show_graph_selector_timer = 0;
int expanded_hrbar_scroll = 0;
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/wifitime.cfg.h
|
namespace wifi {
//!cfg: receives .wifi.conn.$field
void receive_config(const char *field, const char *value);
//!cfg: holds .time.zone, default "EST5EDT,M3.2.0/2:00:00,M11.1.0/2:00:00"
extern const char * time_zone_str;
//!cfg: holds .time.server, default "pool.ntp.org"
extern const char * time_server;
}
|
mincrmatt12/MSign
|
esp/main/grabber/transit/ttc.cfg.h
|
#include <stddef.h>
#include <stdint.h>
#include "../../config.h"
#include "./common.cfg.h"
namespace transit::ttc {
//!cfg: holds .ttc.alert_search
extern const char * alert_search;
//!cfg: holds .ttc.agency_code, default "ttc"
extern const char * agency_code;
//!cfg: receives .ttc.entries[$n].name
void update_ttc_entry_name(size_t n, const char * value);
struct TTCEntry {
//!cfg: holds .dirtag, default nullptr
const char * dirtag[4];
//!cfg: holds .stopid
int stopid = -1;
//!cfg: holds .dirtag_alt, default nullptr
const char * alt_dirtag[4];
//!cfg: holds .stopid_alt
int alt_stopid = -1;
//!cfg: holds .distance
uint8_t distance_minutes = 5;
operator bool() const {return stopid != -1;}
bool has_alt() {return alt_stopid != -1;}
//!cfg: holds .dircode[0]
TransitDirectionCode dir_a = NA;
//!cfg: holds .dircode[1]
TransitDirectionCode dir_b = NA;
};
//!cfg: holds .ttc.entries
extern config::lazy_t<TTCEntry> entries[5];
}
|
mincrmatt12/MSign
|
sim/src/stm/gpio.h
|
<filename>sim/src/stm/gpio.h
#ifndef GPIO_H
#define GPIO_H
#include <stdint.h>
namespace gpio {
template<uint32_t Port, uint32_t Mask>
struct Pin {
inline Pin& operator=(const bool& on) {
return *this;
}
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/cfgpull.h
|
#ifndef MSIGN_CFGPL_H
#define MSIGN_CFGPL_H
#include "grab.h"
namespace cfgpull {
void init();
bool loop();
// Check every 5 minutes for a new config update
constexpr static auto cfgpull_grabber = grabber::make_refreshable_grabber(
grabber::make_https_grabber(init, loop, pdMS_TO_TICKS(5*60*1000)),
slots::protocol::GrabberID::CFGPULL
);
}
#endif
|
mincrmatt12/MSign
|
stm/src/protocol.h
|
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include "common/slots.h"
#include <stdint.h>
#include <FreeRTOS.h>
#include <task.h>
namespace srv {
enum struct ProtocolState {
UNINIT,
HANDSHAKE_RECV,
HANDSHAKE_SENT,
UPDATE_STARTING,
DMA_WAIT_SIZE,
DMA_GOING
};
// Actually does the UART comms with the ESP
struct ProtocolImpl {
// Buffers for DMA
uint8_t dma_buffer[258];
union {
uint8_t dma_out_buffer[67]{};
slots::PacketWrapper<> dma_out_pkt;
};
// Implementation
void setup_uart_dma();
void send();
void start_recv(srv::ProtocolState target_state=ProtocolState::DMA_WAIT_SIZE, int offset=0);
void recv_full();
// State
bool is_sending = false;
ProtocolState state = ProtocolState::UNINIT;
uint64_t last_comm = 0;
bool sent_ping = false;
TaskHandle_t notify_on_send_done = nullptr;
// Interrupt
void dma_finish(bool incoming); // returns whether or not we should call process_command
// Switch to "fast mode" for update: 230400 baud
void switch_fast();
protected:
virtual void process_command() = 0;
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/screens/base.h
|
<reponame>mincrmatt12/MSign
#ifndef MSN_SCREEN_BASE_H
#define MSN_SCREEN_BASE_H
#include <utility>
#include <tuple>
#include <stdint.h>
#include <stddef.h>
#include "../ui.h"
namespace screen {
// Override these (and the destructor/constructor); not virtual because we use a tagged union
struct Screen {
// Set necessary slots to warm here. Note that only a minimum of slots should be enabled here.
//
// This is called twice, once when it's the next screen to appear and once a second before we
// initialize the screen (this allows you to do stuff like pre-load data conditionally)
static void prepare(bool which_run /* true if first call */) {};
// Draw to the screen
void draw() {};
// Does this screen require clearing?
constexpr static inline bool require_clearing() { return true; }
// Handle button interactions. Only called if interaction is occuring; return value
// is whether or not to exit interaction. Typically this is bound to the top of the "back" tree -- usually from the power button.
//
// Note that calls to interact() can end whenever due to both inactivity timeouts and the catch all exit shortcut (hold power for 1.5 seconds)
bool interact() {return ui::buttons[ui::Buttons::POWER];};
void refresh() {};
};
// A screen which layers multiple other screens
template<typename ...Layered>
struct LayeredScreen : Screen {
static void prepare(bool which_run) {
(Layered::prepare(which_run), ...);
}
void draw() {
(std::get<Layered>(screens).draw(), ...);
}
void refresh() {
(std::get<Layered>(screens).refresh(), ...);
}
constexpr static inline bool require_clearing() {
return require_clearing_impl<Layered...>();
}
bool interact() {
return std::get<0>(screens).interact();
}
private:
std::tuple<Layered...> screens;
template<typename Bottom, typename ...Args>
constexpr static inline bool require_clearing_impl() {
return Bottom::require_clearing();
}
};
// Screen IDs are order in template parameters.
//
// Starts with showing no screen at all (state can be induced with shutoff)
template<typename ...Screens>
class ScreenSwapper {
typename std::aligned_union<0, Screens...>::type storage;
constexpr inline static size_t npos = ~0u;
size_t selected = npos;
template<size_t ...Idx>
inline void _destruct(size_t idx, std::index_sequence<Idx...>) {
(void)((idx == Idx && (reinterpret_cast<Screens *>(&storage)->~Screens(), true)) || ...);
}
template<size_t ...Idx>
inline void _construct(size_t idx, std::index_sequence<Idx...>) {
(void)((idx == Idx && (new (&storage) Screens{}, true)) || ...);
}
template<size_t ...Idx>
inline bool _require_clearing(size_t idx, std::index_sequence<Idx...>) {
return ((idx == Idx ? Screens::require_clearing() : false) || ...);
}
template<size_t ...Idx>
inline void _notify(size_t idx, bool param, std::index_sequence<Idx...>) {
(void)((idx == Idx && (Screens::prepare(param), true)) || ...);
}
template<size_t ...Idx>
inline void _draw(size_t idx, std::index_sequence<Idx...>) {
(void)((idx == Idx && (reinterpret_cast<Screens *>(&storage)->draw(), true)) || ...);
}
template<size_t ...Idx>
inline void _refresh(size_t idx, std::index_sequence<Idx...>) {
(void)((idx == Idx && (reinterpret_cast<Screens *>(&storage)->refresh(), true)) || ...);
}
template<size_t ...Idx>
inline bool _interact(size_t idx, std::index_sequence<Idx...>) {
return ((idx == Idx ? reinterpret_cast<Screens *>(&storage)->interact() : false) || ...);
}
public:
void shutoff() { // disable screenswapper and have draw return nothing
if (selected != npos) {
_destruct(selected, std::index_sequence_for<Screens...>{});
}
selected = npos;
}
void draw() {
if (selected != npos)
_draw(selected, std::index_sequence_for<Screens...>{});
}
bool interact() {
if (selected != npos)
return _interact(selected, std::index_sequence_for<Screens...>{});
return true;
}
void refresh() {
if (selected != npos)
_refresh(selected, std::index_sequence_for<Screens...>{});
}
void transition(size_t which) {
if (selected != npos) {
_destruct(selected, std::index_sequence_for<Screens...>{});
}
selected = which;
_construct(which, std::index_sequence_for<Screens...>{});
}
void notify_before_transition(size_t id, bool which_run) {
_notify(id, which_run, std::index_sequence_for<Screens...>{});
}
bool require_clearing() {
return _require_clearing(selected, std::index_sequence_for<Screens...>{});
}
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/sd.h
|
<gh_stars>1-10
#ifndef MSN_SD_H
#define MSN_SD_H
#include <ff.h>
#include <FreeRTOS.h>
#include <stream_buffer.h>
namespace sd {
enum struct InitStatus {
Ok,
NoCard,
FormatError,
UnusableCard,
UnkErr
};
// Sets up FatFS with this.
InitStatus init();
void init_logger();
void log_putc(char c);
extern FATFS fs;
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/cfgpull.cfg.h
|
<gh_stars>1-10
#include <stdint.h>
#include "../config.h"
namespace cfgpull {
//!cfg: holds .cfgpull.enabled, default false
extern bool enabled;
//!cfg: holds .cfgpull.only_firm, default false
extern bool only_firm;
//!cfg: holds .cfgpull.host
extern const char * pull_host;
//!cfg: holds .cfgpull.secret
extern const char * pull_secret;
//!cfg: holds .cfgpull.version, default 0
extern int32_t version_id;
}
|
mincrmatt12/MSign
|
stm/src/rcc.h
|
<filename>stm/src/rcc.h
#ifndef RCC_H
#define RCC_H
namespace rcc {
void init();
}
#endif
|
mincrmatt12/MSign
|
sim/src/stm/matrix.h
|
#ifndef MATRIX_H
#define MATRIX_H
#include "gpio.h"
#include <stdint.h>
#include <string.h>
#include <iostream>
#include <chrono>
#include <cmath>
#include <FreeRTOS.h>
#include <task.h>
#include "tskmem.h"
#include "color.h"
namespace led {
template<uint16_t Width, uint16_t Height>
struct FrameBuffer {
FrameBuffer() {
memset(data, 0x0, sizeof(data));
}
void clear() {
memset(data, 0x0, sizeof(data));
}
void show() {
portENTER_CRITICAL();
std::cout << "\e[;H\e[?25l";
for (size_t y = 0; y < Height; ++y) {
for (size_t x = 0; x < Width; ++x) {
std::cout << "\x1b[48;2;" << std::to_string(_remap(_at(x, y).r)) << ";" << std::to_string(_remap(_at(x, y).g)) << ";" << std::to_string(_remap(_at(x, y).b)) << "m ";
}
std::cout << std::endl;
}
portEXIT_CRITICAL();
}
color_t & at(uint16_t x, uint16_t y) {
if (on_screen(x, y))
return _at(x, y);
return junk;
}
const color_t & at(uint16_t x, uint16_t y) const {
if (on_screen(x, y))
return _at(x, y);
return junk;
}
color_t & at_unsafe(uint16_t x, uint16_t y) {
return _at(x, y);
}
const color_t & at_unsafe(uint16_t x, uint16_t y) const {
return _at(x, y);
}
inline bool on_screen(uint16_t x, uint16_t y) const {
return (x < Width && y < Height);
}
uint8_t * byte_stream;
static constexpr uint16_t width = Width;
static constexpr uint16_t effective_width = Width;
static constexpr uint16_t height = Height;
static constexpr uint16_t stb_lines = Height / 2;
private:
color_t data[Width*Height*3];
inline color_t & _at(uint16_t x, uint16_t y) {
return data[x + y*Width];
}
inline uint8_t _remap(uint16_t prev) {
return std::pow((prev & 0xFFF) / 4095.0, (1/2.6)) * 255;
}
color_t junk; // used as failsafe for read/write out of bounds
};
template<typename FB>
struct Matrix {
typedef FB framebuffer_type;
Matrix() : fb0(), fb1() {
}
void init() {
}
void start_display() {
should_swap = false;
me = dispinttask.create([](void *arg){((Matrix<FB> *)arg)->disptask();}, "dispint", this, 6);
}
// This should only be called from an RTOS task
void swap_buffers() {
//active_buffer = !active_buffer;
notify_when_swapped = xTaskGetCurrentTaskHandle();
should_swap = true;
// This uses the task notification value to wait for something to happen.
// This _does_ preclude the use of notification values for anything else.
xTaskNotifyWait(0, 0xffffffffUL, NULL, portMAX_DELAY);
}
void swap_buffers_from_isr() {
swap_buffers();
}
FB& get_inactive_buffer() {return active_buffer ? fb1 : fb0;}
const FB& get_active_buffer() {return active_buffer ? fb0 : fb1;}
volatile bool force_off = false;
private:
tskmem::TaskHolder<1024> dispinttask;
void disptask() {
while (true) {
if (!force_off) _get_active_buffer().show();
vTaskDelay(pdMS_TO_TICKS(1000/60));
// We have finished clocking out a row, process buffer swaps
if (should_swap) {
active_buffer = !active_buffer;
if (notify_when_swapped) xTaskNotifyFromISR(notify_when_swapped, 1, eSetValueWithOverwrite, NULL);
}
}
}
FB fb0, fb1;
bool active_buffer = false;
uint8_t pos = 0;
uint16_t row = 0;
uint8_t dma_buffer[(FB::width * 2) + 1];
// impl for the wait system
uint16_t delay_counter = 0;
bool delaying = false;
// show variable
bool show = false;
// clock is tied to tim2_ch3
FB& _get_active_buffer() {return active_buffer ? fb0 : fb1;}
TaskHandle_t me, notify_when_swapped = nullptr;
bool should_swap = false;
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/fonts/latob_15.h
|
#ifndef FONT_LATO_BOLD_15_H
#define FONT_LATO_BOLD_15_H
namespace font::lato_bold_15 {
extern const void * const info[4]; // metrics, data, pointer to kern_size, kerning
}
// generated by fnter w/ /usr/share/fonts/truetype/lato/Lato-Bold.ttf
#endif
|
mincrmatt12/MSign
|
stm/src/gpio.h
|
#ifndef GPIO_H
#define GPIO_H
#include "stm32f2xx.h"
#include "stm32f2xx_ll_gpio.h"
#include <stdint.h>
namespace gpio {
template<uint32_t Port, uint32_t Mask>
struct Pin {
inline Pin& operator=(const bool& on) {
if (on) {
((GPIO_TypeDef *)Port)->BSRR |= (1 << Mask);
}
else {
((GPIO_TypeDef *)Port)->BSRR |= (1 << (Mask+16));
}
return *this;
}
};
}
#endif
|
mincrmatt12/MSign
|
stm/src/system.c
|
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <FreeRTOSConfig.h>
int __attribute__((used)) _close(int file) {return -1;}
int __attribute__((used)) _fstat(int file, struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}
int __attribute__((used)) _isatty(int file) {return 1;}
int __attribute__((used)) _lseek(int file, int ptr, int dir) {return 0;}
int __attribute__((used)) _open(const char *name, int flags, int mode) {return -1;}
int __attribute__((used)) _read(int file, char *ptr, int len) {
// Read len bytes from the debug UART3
return 0;
}
caddr_t __attribute__((used)) _sbrk(int incr)
{
extern char end asm("end");
static char *heap_end;
char *prev_heap_end,*min_stack_ptr;
if (heap_end == 0)
heap_end = &end;
prev_heap_end = heap_end;
/* Use the NVIC offset register to locate the main stack pointer. */
min_stack_ptr = (char*)(*(unsigned int *)*(unsigned int *)0xE000ED08);
/* Locate the STACK bottom address */
min_stack_ptr -= 100;
if (heap_end + incr > min_stack_ptr)
{
errno = ENOMEM;
return (caddr_t) -1;
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}
void __attribute__((used)) _exit(int status) {
while (1) {;}
}
int __attribute__((used)) _kill(int a, int b) {
errno = EINVAL;
return -1;
}
int __attribute__((used)) _getpid() {
return 1;
}
// Make debugging work with rtos
const int __attribute__((used)) uxTopUsedPriority = configMAX_PRIORITIES - 1;
void __cxa_pure_virtual() {}
|
mincrmatt12/MSign
|
stmboot/src/main.c
|
#include <stm32f2xx.h>
#include "common/bootcmd.h"
#include <stdbool.h>
#include "string.h"
// BOOTLOADER REVISION CONSTANT
const char BL_REV[4] = {'2', 'b', 0, 0};
extern const void * _sirtext;
extern void * _srtext, *_ertext;
#define RAMFUNC __attribute__((section(".rtext")))
#define FLASH_KEY1 <KEY>
#define FLASH_KEY2 0xCDEF89ABU
#ifdef STM32F205xx
// board
#define LED_DATA_PORT GPIOC
#define LED_DATA_BLOCK RCC_AHB1ENR_GPIOCEN
#else
// nucleo
#define LED_DATA_PORT GPIOD
#define LED_DATA_BLOCK RCC_AHB1ENR_GPIODEN
#endif
// BASIC SCREEN DRIVER
//
// Only controls one row of monochrome pixels
void init_scrn() {
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN | LED_DATA_BLOCK;
asm volatile ("nop");
asm volatile ("nop");
asm volatile ("nop");
GPIOB->MODER = (
GPIO_MODER_MODE5_0 |
GPIO_MODER_MODE6_0 |
GPIO_MODER_MODE0_0 |
GPIO_MODER_MODE1_0 |
GPIO_MODER_MODE2_0 |
GPIO_MODER_MODE3_0
);
LED_DATA_PORT->MODER = (
GPIO_MODER_MODE6_0 |
GPIO_MODER_MODE0_0 |
GPIO_MODER_MODE1_0 |
GPIO_MODER_MODE2_0 |
GPIO_MODER_MODE3_0 |
GPIO_MODER_MODE4_0 |
GPIO_MODER_MODE5_0
);
GPIOB->PUPDR = 0;
GPIOB->ODR = (1 << 6);
LED_DATA_PORT->ODR = 0;
}
void show_line(bool data[64]) {
#include "showline.inc"
}
RAMFUNC void show_line_ram(bool data[64]) {
#include "showline.inc"
}
void jump_to_program() {
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
SCB->VTOR = 0x4000;
__set_MSP(*(uint32_t *)(0x08004000));
((void(*)(void))(*(uint32_t *)(0x08004004)))();
}
RAMFUNC void do_update_app() {
uint8_t sector_count = 0;
bool sp[64] = {1, 0, 0, 0}; // 1, 0, 0, 0 - status UPDATE
memset(sp + 4, 0, 60);
// Erase sectors
uint32_t size = bootcmd_update_size();
if (size > 0) {sector_count++; sp[4] = 1;}
if (size > 16384) {sector_count++; sp[5] = 1;}
if (size > 32768) {sector_count++; sp[6] = 1;}
if (size > 49152) {sector_count++; sp[7] = 1;}
if (size > 114688) {sector_count++; sp[8] = 1;}
if (size > 245760) {sector_count++; sp[9] = 1;}
if (size > 376832) {sector_count++; sp[10] = 1;}
sp[12] = 0;
sp[13] = 1;
sp[14] = 1;
sp[15] = 0; // status code 0, 1, 1, 0, leds indicate erase count
show_line_ram(sp);
// set PSIZE
CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
FLASH->CR |= 2 << FLASH_CR_PSIZE_Pos;
sp[13] = 0; // status code 0, 0, 1, 0, leds indicate erase remaining
for (uint8_t i = 0; i < sector_count; ++i) {
CLEAR_BIT(FLASH->CR, FLASH_CR_SNB);
FLASH->CR |= FLASH_CR_SER /* section erase */ | ((1 + i) << FLASH_CR_SNB_Pos);
FLASH->CR |= FLASH_CR_STRT;
while (READ_BIT(FLASH->SR, FLASH_SR_BSY)) {}
sp[i+4] = 0;
show_line_ram(sp);
}
CLEAR_BIT(FLASH->CR, FLASH_CR_SER);
// Sectors erased, program flash
memset(sp, 0, 64);
sp[0] = 1;
if (size % 4 != 0) {
size += (4 - (size % 4)); // round to next 4
}
int sp_pos = 2;
int counter = 0;
for (uint32_t i = 0; i < size; i += 4) {
counter += 4;
FLASH->CR |= FLASH_CR_PG;
*(uint32_t *)(0x08004000 + i) = *(uint32_t *)(0x08080000 + i);
while (READ_BIT(FLASH->SR, FLASH_SR_BSY)) {}
if (counter > (size / 64)) {
counter = 0;
sp_pos += 1;
if (sp_pos == 64) {
memset(sp + 2, 0, 62);
sp_pos = 2;
}
sp[sp_pos] = 1;
show_line_ram(sp);
}
}
FLASH->CR |= FLASH_CR_LOCK;
memset(sp + 1, 0, 63);
sp[4] = 1;
sp[5] = 0;
sp[6] = 1;
sp[7] = 1; // status 1 0 1 1 - comparing
if (memcmp((const void *)(0x08004000), (const void *)(0x08080000), bootcmd_update_size()) != 0) {
sp[0] = 1;
sp[3] = 1;
sp[4] = 1;
sp[5] = 1;
sp[6] = 1;
sp[7] = 1; // ERROR - compare fail
show_line_ram(sp);
for (int i = 0; i < 30000; ++i) {
asm volatile ("nop");
}
// UHOH
NVIC_SystemReset(); // retry
}
// verify is ok, we can now erase the update partition and mark everything as hunkidory.
// this also means that a program can check a
bootcmd_service_update();
// the system is now updated, reset
NVIC_SystemReset();
}
RAMFUNC void do_update_bootloader() {
bool sp[64] = {1, 1, 0, 0}; // 1, 0, 0, 0 - status RELOAD
memset(sp + 4, 0, 60);
show_line_ram(sp);
if (bootcmd_update_size() > 16384) {
sp[1] = 0;
sp[3] = 1;
sp[4] = 1;
sp[5] = 1;
sp[6] = 0;
sp[7] = 0; // 1 1 0 0 - error in size of bootloader
show_line_ram(sp);
for (int i = 0; i < 30000; ++i) {
asm volatile ("nop");
}
// UHOH
NVIC_SystemReset(); // retry
}
volatile uint32_t update_size = bootcmd_update_size();
// bootloader update loop
// erase original bootloader
//
// NO FLASH FUNCTIONS CAN COME AFTER THIS
CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
FLASH->CR |= 2 << FLASH_CR_PSIZE_Pos;
sp[4] = 1;
sp[5] = 1; // 1, 1, 0, 0 - erasing sector
show_line_ram(sp);
CLEAR_BIT(FLASH->CR, FLASH_CR_SNB);
FLASH->CR |= FLASH_CR_SER /* section erase + 0 sector */;
FLASH->CR |= FLASH_CR_STRT; // WE are now gone
while (READ_BIT(FLASH->SR, FLASH_SR_BSY)) {}
CLEAR_BIT(FLASH->CR, FLASH_CR_SER);
sp[5] = 0;
sp[6] = 1;
show_line_ram(sp); // erase OK, copying
for (uint32_t ptr = 0x08000000, src = 0x08080000; ptr < (0x08000000 + update_size); ptr += 4, src += 4) {
FLASH->CR |= FLASH_CR_PG;
*((uint32_t *)ptr) = *((uint32_t *)src);
while (FLASH->SR & FLASH_SR_BSY) {;}
}
sp[5] = 1;
show_line_ram(sp); // 1, 1, 1 - OK
FLASH->CR &= ~FLASH_CR_PG;
// Set the BOOT MODE back to a normal value
RTC->BKP0R = BOOTCMD_RUN;
RTC->BKP1R = 0xd0d3;
for (int i = 0; i < 30000; ++i) {asm volatile ("nop");}
// Manually jump to the bootloader again
__set_MSP(*(uint32_t *)(0x08000000));
((void(*)(void))(*(uint32_t *)(0x08000004)))();
// Did it return?
sp[0] = 1;
sp[1] = 0;
sp[2] = 1;
sp[3] = 0;
sp[4] = 0;
sp[5] = 0;
sp[6] = 0;
sp[7] = 0;
sp[8] = 1; // ERROR 0, 0, 0, 0, 1 - new bootloader died
show_line_ram(sp);
while (1) {;}
}
int __attribute__((noreturn)) main() {
bootcmd_init();
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, FLASH_ACR_LATENCY_3WS);
if (bootcmd_get_cmd() == BOOTCMD_RUN) {
// Set bootloader revision
RTC->BKP3R = *(uint32_t *)(BL_REV);
jump_to_program();
while (1) {;}
}
// Enable screen
init_scrn();
if (bootcmd_get_cmd() != BOOTCMD_UPDATE && bootcmd_get_cmd() != BOOTCMD_NEW_LOADER) {
// Show test pattern
bool tp[64] = {1, 0, 1, 0, 0, 1, 1, 0}; // 1, 0, 1, 0 - error
// 0, 1, 1, 0 - invalid command
show_line(tp);
}
bool sp[64] = {1, 1, 1, 0, 0, 1, 1, 1}; // 1, 1, 1, 0 - status
// 0, 1, 1, 1 - unlocking flash
show_line(sp);
// We are updating, unlock flash
FLASH->KEYR = FLASH_KEY1;
FLASH->KEYR = FLASH_KEY2;
sp[4] = 1;
sp[7] = 0; // 1, 1, 1, 0 - copying code
show_line(sp);
// Load RAMFUNCs
memcpy(&_srtext, &_sirtext, (uint32_t)(&_ertext) - (uint32_t)(&_srtext));
if (bootcmd_get_cmd() == BOOTCMD_UPDATE) do_update_app();
else do_update_bootloader();
sp[1] = 0; // 1, 0, 1, 0 - error
sp[4] = 0;
sp[5] = 0;
sp[6] = 1;
sp[7] = 1;
show_line(sp); // 0, 0, 1, 1 - returned from update handler
while(1) {;} // spin forever
}
|
mincrmatt12/MSign
|
stm/src/screens/ttc.h
|
<filename>stm/src/screens/ttc.h
#ifndef TTC_H
#define TTC_H
#include "base.h"
#include <stdint.h>
#include "../common/bheap.h"
namespace screen {
struct TTCScreen : public Screen {
TTCScreen();
~TTCScreen();
static void prepare(bool);
void draw();
void refresh();
private:
void draw_bus();
// Draw an entire slot
int16_t draw_slot(uint16_t y, const uint8_t * name, const bheap::TypedBlock<uint64_t *> ×_a, const bheap::TypedBlock<uint64_t *> ×_b, bool alert, bool delay, char a_code, char b_code, int distance);
// Helper routine, draws (if data available) a subrow
bool draw_subslot(uint16_t y, char dircode, const bheap::TypedBlock<uint64_t *> ×, int distance);
void draw_alertstr();
static void request_slots(uint32_t temp);
uint8_t bus_type = 1;
uint8_t bus_state = 0;
int16_t total_current_height = -1, scroll_offset = 0, scroll_target = 0;
uint64_t last_scrolled_at;
};
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/modelserve.cfg.h
|
//!cfg: include ../common/slots.h
#include "../common/slots.h"
namespace modelserve {
struct ModelParams {
//!cfg: holds .cam.focuses
slots::Vec3 focuses[3];
//!cfg: holds .cam.min
slots::Vec3 minpos;
//!cfg: holds .cam.max
slots::Vec3 maxpos;
enum LightingMode : uint8_t {
BAKED,
DYNAMIC
};
//!cfg: holds .lighting
LightingMode lighting_mode = DYNAMIC;
//!cfg: holds .cam.focuses!size
uint8_t nfocus = 0;
};
//!cfg: holds .model.sd
extern ModelParams model_params[2];
//!cfg: receives .model.enabled[$n], max $n=3
void update_modelpresence(size_t n, bool value);
//!cfg: receives .model.sd[$n].name
inline void update_modelname(size_t n, const char *value) {}
}
|
mincrmatt12/MSign
|
esp/main/grabber/sccfg.cfg.h
|
<reponame>mincrmatt12/MSign
#include "../config.h"
#include "../common/slots.h"
#include <stdint.h>
namespace sccfg {
const inline uint8_t number_of_screens = 3;
struct ScreenEntry {
struct OnOffTime {
//!cfg: holds .start
int32_t start = 0;
//!cfg: holds .end
int32_t end = -1;
bool always_on() const {return end == -1;}
};
//!cfg: holds .screen, default slots::ScCfgTime::ScreenId::TTC
slots::ScCfgTime::ScreenId screen;
//!cfg: holds .length
int32_t duration = 10000;
//!cfg: holds .times
OnOffTime times{};
};
//!cfg: holds .sccfg.screens
extern config::lazy_t<ScreenEntry> screen_entries[3];
}
|
mincrmatt12/MSign
|
esp/main/grabber/weather.h
|
#ifndef WEATHER_H
#define WEATHER_H
#include "grab.h"
namespace weather {
void init();
bool loop();
// Rate limit is 1000/day, so we use a conservative 5 minutes
constexpr static auto weather_grabber = grabber::make_refreshable_grabber(
grabber::make_https_grabber(init, loop, pdMS_TO_TICKS(60*5*1000), pdMS_TO_TICKS(60*3*1000)),
slots::protocol::GrabberID::WEATHER
);
}
#endif
|
mincrmatt12/MSign
|
esp/main/grabber/weather.cfg.h
|
<gh_stars>1-10
namespace weather {
//!cfg: holds .weather.key
extern const char * api_key;
//!cfg: holds .weather.coord[0]
extern float lat;
//!cfg: holds .weather.coord[1]
extern float lon;
}
|
mincrmatt12/MSign
|
stm/src/intmath.h
|
#ifndef INTMATH_H
#define INTMATH_H
#include <stdint.h>
#include <type_traits>
namespace intmath {
// Round to nearest 10^N and divide.
//
// round10(453, 100) --> 4.53 --> [5]
// | |
// | \-------\
// | |
// \-- = 4.53 * 100
template<typename T>
constexpr T round10(T v, T pos=100) {
if constexpr (std::is_signed_v<T>) {
T res = v / pos, rem = v % pos;
if (-(pos / 2) < rem && rem < (pos / 2)) return res;
else if (rem >= (pos / 2)) return res + (T)1;
else return res - (T)1;
}
else {
if (v % pos >= pos / 2) return (v / pos) + (T)1;
else return (v / pos);
}
}
// Same as round10, except rounds to lowest. Multiply by pos again to keep fixedpoint.
template<typename T>
constexpr T floor10(T v, T pos=100) {
if constexpr (std::is_signed_v<T>) {
T res = v / pos, rem = v % pos;
if (rem >= 0) return res;
else return res - (T)1;
}
else {
return (v / pos);
}
}
// Same as round10, except rounds to lowest. Multiply by pos again to keep fixedpoint.
template<typename T>
constexpr T ceil10(T v, T pos=100) {
if constexpr (std::is_signed_v<T>) {
T res = v / pos, rem = v % pos;
if (rem <= 0) return res;
else return res + (T)1;
}
else {
return ((v + (pos - 1)) / pos);
}
}
}
#endif
|
mincrmatt12/MSign
|
sim/src/stm/stm32f2xx_ll_system.h
|
#ifndef MOCK_SYSTEM_H
#define MOCK_SYSTEM_H
#include <stdint.h>
#include <unistd.h>
extern char ** orig_argv;
[[noreturn]] inline void NVIC_SystemReset() {
exit(0);
while (1) {;}
}
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
#define READ_BIT(REG, BIT) ((REG) & (BIT))
#define CLEAR_REG(REG) ((REG) = (0x0))
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
#define READ_REG(REG) ((REG))
struct {
uint32_t KEYR, CR, SR, OPTKEYR, OPTCR, ACR;
} _FLASH;
auto* FLASH = &_FLASH;
#define FLASH_KEY1 <KEY>
#define FLASH_KEY2 0xCDEF89ABU
#define FLASH_ACR_LATENCY_Pos (0U)
#define FLASH_ACR_LATENCY_Msk (0xFU << FLASH_ACR_LATENCY_Pos) /*!< 0x0000000F */
#define FLASH_ACR_LATENCY FLASH_ACR_LATENCY_Msk
#define FLASH_ACR_LATENCY_0WS 0x00000000U
#define FLASH_ACR_LATENCY_1WS 0x00000001U
#define FLASH_ACR_LATENCY_2WS 0x00000002U
#define FLASH_ACR_LATENCY_3WS 0x00000003U
#define FLASH_ACR_LATENCY_4WS 0x00000004U
#define FLASH_ACR_LATENCY_5WS 0x00000005U
#define FLASH_ACR_LATENCY_6WS 0x00000006U
#define FLASH_ACR_LATENCY_7WS 0x00000007U
#define FLASH_ACR_PRFTEN_Pos (8U)
#define FLASH_ACR_PRFTEN_Msk (0x1U << FLASH_ACR_PRFTEN_Pos) /*!< 0x00000100 */
#define FLASH_ACR_PRFTEN FLASH_ACR_PRFTEN_Msk
#define FLASH_ACR_ICEN_Pos (9U)
#define FLASH_ACR_ICEN_Msk (0x1U << FLASH_ACR_ICEN_Pos) /*!< 0x00000200 */
#define FLASH_ACR_ICEN FLASH_ACR_ICEN_Msk
#define FLASH_ACR_DCEN_Pos (10U)
#define FLASH_ACR_DCEN_Msk (0x1U << FLASH_ACR_DCEN_Pos) /*!< 0x00000400 */
#define FLASH_ACR_DCEN FLASH_ACR_DCEN_Msk
#define FLASH_ACR_ICRST_Pos (11U)
#define FLASH_ACR_ICRST_Msk (0x1U << FLASH_ACR_ICRST_Pos) /*!< 0x00000800 */
#define FLASH_ACR_ICRST FLASH_ACR_ICRST_Msk
#define FLASH_ACR_DCRST_Pos (12U)
#define FLASH_ACR_DCRST_Msk (0x1U << FLASH_ACR_DCRST_Pos) /*!< 0x00001000 */
#define FLASH_ACR_DCRST FLASH_ACR_DCRST_Msk
#define FLASH_ACR_BYTE0_ADDRESS_Pos (10U)
#define FLASH_ACR_BYTE0_ADDRESS_Msk (0x10008FU << FLASH_ACR_BYTE0_ADDRESS_Pos) /*!< 0x40023C00 */
#define FLASH_ACR_BYTE0_ADDRESS FLASH_ACR_BYTE0_ADDRESS_Msk
#define FLASH_ACR_BYTE2_ADDRESS_Pos (0U)
#define FLASH_ACR_BYTE2_ADDRESS_Msk (0x40023C03U << FLASH_ACR_BYTE2_ADDRESS_Pos) /*!< 0x40023C03 */
#define FLASH_ACR_BYTE2_ADDRESS FLASH_ACR_BYTE2_ADDRESS_Msk
/******************* Bits definition for FLASH_SR register ******************/
#define FLASH_SR_EOP_Pos (0U)
#define FLASH_SR_EOP_Msk (0x1U << FLASH_SR_EOP_Pos) /*!< 0x00000001 */
#define FLASH_SR_EOP FLASH_SR_EOP_Msk
#define FLASH_SR_SOP_Pos (1U)
#define FLASH_SR_SOP_Msk (0x1U << FLASH_SR_SOP_Pos) /*!< 0x00000002 */
#define FLASH_SR_SOP FLASH_SR_SOP_Msk
#define FLASH_SR_WRPERR_Pos (4U)
#define FLASH_SR_WRPERR_Msk (0x1U << FLASH_SR_WRPERR_Pos) /*!< 0x00000010 */
#define FLASH_SR_WRPERR FLASH_SR_WRPERR_Msk
#define FLASH_SR_PGAERR_Pos (5U)
#define FLASH_SR_PGAERR_Msk (0x1U << FLASH_SR_PGAERR_Pos) /*!< 0x00000020 */
#define FLASH_SR_PGAERR FLASH_SR_PGAERR_Msk
#define FLASH_SR_PGPERR_Pos (6U)
#define FLASH_SR_PGPERR_Msk (0x1U << FLASH_SR_PGPERR_Pos) /*!< 0x00000040 */
#define FLASH_SR_PGPERR FLASH_SR_PGPERR_Msk
#define FLASH_SR_PGSERR_Pos (7U)
#define FLASH_SR_PGSERR_Msk (0x1U << FLASH_SR_PGSERR_Pos) /*!< 0x00000080 */
#define FLASH_SR_PGSERR FLASH_SR_PGSERR_Msk
#define FLASH_SR_BSY_Pos (16U)
#define FLASH_SR_BSY_Msk (0x1U << FLASH_SR_BSY_Pos) /*!< 0x00010000 */
#define FLASH_SR_BSY FLASH_SR_BSY_Msk
/******************* Bits definition for FLASH_CR register ******************/
#define FLASH_CR_PG_Pos (0U)
#define FLASH_CR_PG_Msk (0x1U << FLASH_CR_PG_Pos) /*!< 0x00000001 */
#define FLASH_CR_PG FLASH_CR_PG_Msk
#define FLASH_CR_SER_Pos (1U)
#define FLASH_CR_SER_Msk (0x1U << FLASH_CR_SER_Pos) /*!< 0x00000002 */
#define FLASH_CR_SER FLASH_CR_SER_Msk
#define FLASH_CR_MER_Pos (2U)
#define FLASH_CR_MER_Msk (0x1U << FLASH_CR_MER_Pos) /*!< 0x00000004 */
#define FLASH_CR_MER FLASH_CR_MER_Msk
#define FLASH_CR_SNB_Pos (3U)
#define FLASH_CR_SNB_Msk (0x1FU << FLASH_CR_SNB_Pos) /*!< 0x000000F8 */
#define FLASH_CR_SNB FLASH_CR_SNB_Msk
#define FLASH_CR_SNB_0 (0x01U << FLASH_CR_SNB_Pos) /*!< 0x00000008 */
#define FLASH_CR_SNB_1 (0x02U << FLASH_CR_SNB_Pos) /*!< 0x00000010 */
#define FLASH_CR_SNB_2 (0x04U << FLASH_CR_SNB_Pos) /*!< 0x00000020 */
#define FLASH_CR_SNB_3 (0x08U << FLASH_CR_SNB_Pos) /*!< 0x00000040 */
#define FLASH_CR_SNB_4 (0x10U << FLASH_CR_SNB_Pos) /*!< 0x00000080 */
#define FLASH_CR_PSIZE_Pos (8U)
#define FLASH_CR_PSIZE_Msk (0x3U << FLASH_CR_PSIZE_Pos) /*!< 0x00000300 */
#define FLASH_CR_PSIZE FLASH_CR_PSIZE_Msk
#define FLASH_CR_PSIZE_0 (0x1U << FLASH_CR_PSIZE_Pos) /*!< 0x00000100 */
#define FLASH_CR_PSIZE_1 (0x2U << FLASH_CR_PSIZE_Pos) /*!< 0x00000200 */
#define FLASH_CR_STRT_Pos (16U)
#define FLASH_CR_STRT_Msk (0x1U << FLASH_CR_STRT_Pos) /*!< 0x00010000 */
#define FLASH_CR_STRT FLASH_CR_STRT_Msk
#define FLASH_CR_EOPIE_Pos (24U)
#define FLASH_CR_EOPIE_Msk (0x1U << FLASH_CR_EOPIE_Pos) /*!< 0x01000000 */
#define FLASH_CR_EOPIE FLASH_CR_EOPIE_Msk
#define FLASH_CR_LOCK_Pos (31U)
#define FLASH_CR_LOCK_Msk (0x1U << FLASH_CR_LOCK_Pos) /*!< 0x80000000 */
#define FLASH_CR_LOCK FLASH_CR_LOCK_Msk
/******************* Bits definition for FLASH_OPTCR register ***************/
#define FLASH_OPTCR_OPTLOCK_Pos (0U)
#define FLASH_OPTCR_OPTLOCK_Msk (0x1U << FLASH_OPTCR_OPTLOCK_Pos) /*!< 0x00000001 */
#define FLASH_OPTCR_OPTLOCK FLASH_OPTCR_OPTLOCK_Msk
#define FLASH_OPTCR_OPTSTRT_Pos (1U)
#define FLASH_OPTCR_OPTSTRT_Msk (0x1U << FLASH_OPTCR_OPTSTRT_Pos) /*!< 0x00000002 */
#define FLASH_OPTCR_OPTSTRT FLASH_OPTCR_OPTSTRT_Msk
#define FLASH_OPTCR_BOR_LEV_0 0x00000004U
#define FLASH_OPTCR_BOR_LEV_1 0x00000008U
#define FLASH_OPTCR_BOR_LEV_Pos (2U)
#define FLASH_OPTCR_BOR_LEV_Msk (0x3U << FLASH_OPTCR_BOR_LEV_Pos) /*!< 0x0000000C */
#define FLASH_OPTCR_BOR_LEV FLASH_OPTCR_BOR_LEV_Msk
#define FLASH_OPTCR_WDG_SW_Pos (5U)
#define FLASH_OPTCR_WDG_SW_Msk (0x1U << FLASH_OPTCR_WDG_SW_Pos) /*!< 0x00000020 */
#define FLASH_OPTCR_WDG_SW FLASH_OPTCR_WDG_SW_Msk
#define FLASH_OPTCR_nRST_STOP_Pos (6U)
#define FLASH_OPTCR_nRST_STOP_Msk (0x1U << FLASH_OPTCR_nRST_STOP_Pos) /*!< 0x00000040 */
#define FLASH_OPTCR_nRST_STOP FLASH_OPTCR_nRST_STOP_Msk
#define FLASH_OPTCR_nRST_STDBY_Pos (7U)
#define FLASH_OPTCR_nRST_STDBY_Msk (0x1U << FLASH_OPTCR_nRST_STDBY_Pos) /*!< 0x00000080 */
#define FLASH_OPTCR_nRST_STDBY FLASH_OPTCR_nRST_STDBY_Msk
#define FLASH_OPTCR_RDP_Pos (8U)
#define FLASH_OPTCR_RDP_Msk (0xFFU << FLASH_OPTCR_RDP_Pos) /*!< 0x0000FF00 */
#define FLASH_OPTCR_RDP FLASH_OPTCR_RDP_Msk
#define FLASH_OPTCR_RDP_0 (0x01U << FLASH_OPTCR_RDP_Pos) /*!< 0x00000100 */
#define FLASH_OPTCR_RDP_1 (0x02U << FLASH_OPTCR_RDP_Pos) /*!< 0x00000200 */
#define FLASH_OPTCR_RDP_2 (0x04U << FLASH_OPTCR_RDP_Pos) /*!< 0x00000400 */
#define FLASH_OPTCR_RDP_3 (0x08U << FLASH_OPTCR_RDP_Pos) /*!< 0x00000800 */
#define FLASH_OPTCR_RDP_4 (0x10U << FLASH_OPTCR_RDP_Pos) /*!< 0x00001000 */
#define FLASH_OPTCR_RDP_5 (0x20U << FLASH_OPTCR_RDP_Pos) /*!< 0x00002000 */
#define FLASH_OPTCR_RDP_6 (0x40U << FLASH_OPTCR_RDP_Pos) /*!< 0x00004000 */
#define FLASH_OPTCR_RDP_7 (0x80U << FLASH_OPTCR_RDP_Pos) /*!< 0x00008000 */
#define FLASH_OPTCR_nWRP_Pos (16U)
#define FLASH_OPTCR_nWRP_Msk (0xFFFU << FLASH_OPTCR_nWRP_Pos) /*!< 0x0FFF0000 */
#define FLASH_OPTCR_nWRP FLASH_OPTCR_nWRP_Msk
#define FLASH_OPTCR_nWRP_0 (0x001U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00010000 */
#define FLASH_OPTCR_nWRP_1 (0x002U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00020000 */
#define FLASH_OPTCR_nWRP_2 (0x004U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00040000 */
#define FLASH_OPTCR_nWRP_3 (0x008U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00080000 */
#define FLASH_OPTCR_nWRP_4 (0x010U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00100000 */
#define FLASH_OPTCR_nWRP_5 (0x020U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00200000 */
#define FLASH_OPTCR_nWRP_6 (0x040U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00400000 */
#define FLASH_OPTCR_nWRP_7 (0x080U << FLASH_OPTCR_nWRP_Pos) /*!< 0x00800000 */
#define FLASH_OPTCR_nWRP_8 (0x100U << FLASH_OPTCR_nWRP_Pos) /*!< 0x01000000 */
#define FLASH_OPTCR_nWRP_9 (0x200U << FLASH_OPTCR_nWRP_Pos) /*!< 0x02000000 */
#define FLASH_OPTCR_nWRP_10 (0x400U << FLASH_OPTCR_nWRP_Pos) /*!< 0x04000000 */
#define FLASH_OPTCR_nWRP_11 (0x800U << FLASH_OPTCR_nWRP_Pos) /*!< 0x08000000 */
inline void LL_FLASH_DisableDataCache() {}
inline void LL_FLASH_EnableDataCacheReset() {}
inline void LL_FLASH_DisableDataCacheReset() {}
#endif
|
mincrmatt12/MSign
|
stm/src/screens/threed/mesh.h
|
<reponame>mincrmatt12/MSign
// count = 168
#include "../threed.h"
namespace threed {
struct DefaultMeshHolder {
Tri tris[168];
const static inline size_t tri_count = 168;
constexpr DefaultMeshHolder() : tris{} {
tris[0] = {
{ m::fixed_t{-17696, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41716, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
204,
78,
0
};
tris[1] = {
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
204,
78,
0
};
tris[2] = {
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{11824, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41714, nullptr} },
204,
78,
0
};
tris[3] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41714, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
204,
78,
0
};
tris[4] = {
{ m::fixed_t{12467, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
204,
78,
0
};
tris[5] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
204,
78,
0
};
tris[6] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
204,
78,
0
};
tris[7] = {
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
204,
78,
0
};
tris[8] = {
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
204,
78,
0
};
tris[9] = {
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
204,
78,
0
};
tris[10] = {
{ m::fixed_t{-2366, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
204,
78,
0
};
tris[11] = {
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
204,
78,
0
};
tris[12] = {
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
204,
78,
0
};
tris[13] = {
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
204,
78,
0
};
tris[14] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
204,
78,
0
};
tris[15] = {
{ m::fixed_t{-18352, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41716, nullptr} },
204,
78,
0
};
tris[16] = {
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[17] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[18] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
204,
78,
0
};
tris[19] = {
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
{ m::fixed_t{11824, nullptr}, m::fixed_t{-11279, nullptr}, m::fixed_t{-42674, nullptr} },
204,
78,
0
};
tris[20] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{-11279, nullptr}, m::fixed_t{-42674, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
204,
78,
0
};
tris[21] = {
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{-11278, nullptr}, m::fixed_t{-42676, nullptr} },
204,
78,
0
};
tris[22] = {
{ m::fixed_t{-17696, nullptr}, m::fixed_t{-11278, nullptr}, m::fixed_t{-42676, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43114, nullptr} },
204,
78,
0
};
tris[23] = {
{ m::fixed_t{-18352, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43114, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[24] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[25] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[26] = {
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[27] = {
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[28] = {
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[29] = {
{ m::fixed_t{-3636, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[30] = {
{ m::fixed_t{-18352, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41716, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{-11278, nullptr}, m::fixed_t{-42676, nullptr} },
204,
78,
0
};
tris[31] = {
{ m::fixed_t{13233, nullptr}, m::fixed_t{9895, nullptr}, m::fixed_t{-42316, nullptr} },
{ m::fixed_t{13233, nullptr}, m::fixed_t{-11251, nullptr}, m::fixed_t{-43276, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
204,
78,
0
};
tris[32] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[33] = {
{ m::fixed_t{-18798, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[34] = {
{ m::fixed_t{12973, nullptr}, m::fixed_t{-11867, nullptr}, m::fixed_t{-29710, nullptr} },
{ m::fixed_t{12973, nullptr}, m::fixed_t{9279, nullptr}, m::fixed_t{-28750, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
204,
78,
0
};
tris[35] = {
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
204,
78,
0
};
tris[36] = {
{ m::fixed_t{-3636, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[37] = {
{ m::fixed_t{-2366, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[38] = {
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[39] = {
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[40] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[41] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[42] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41714, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
204,
78,
0
};
tris[43] = {
{ m::fixed_t{-17696, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41716, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
204,
78,
0
};
tris[44] = {
{ m::fixed_t{-1467, nullptr}, m::fixed_t{-12387, nullptr}, m::fixed_t{-18260, nullptr} },
{ m::fixed_t{-1467, nullptr}, m::fixed_t{8759, nullptr}, m::fixed_t{-17300, nullptr} },
{ m::fixed_t{11302, nullptr}, m::fixed_t{-11313, nullptr}, m::fixed_t{-41916, nullptr} },
204,
78,
0
};
tris[45] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43114, nullptr} },
204,
78,
0
};
tris[46] = {
{ m::fixed_t{-18842, nullptr}, m::fixed_t{9277, nullptr}, m::fixed_t{-28704, nullptr} },
{ m::fixed_t{-18842, nullptr}, m::fixed_t{-11869, nullptr}, m::fixed_t{-29664, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
204,
78,
0
};
tris[47] = {
{ m::fixed_t{-18352, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{-11278, nullptr}, m::fixed_t{-42676, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43114, nullptr} },
204,
78,
0
};
tris[48] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{14174, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
204,
78,
0
};
tris[49] = {
{ m::fixed_t{14174, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{14174, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{13233, nullptr}, m::fixed_t{9895, nullptr}, m::fixed_t{-42316, nullptr} },
204,
78,
0
};
tris[50] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{14174, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{14174, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
204,
78,
0
};
tris[51] = {
{ m::fixed_t{13233, nullptr}, m::fixed_t{9895, nullptr}, m::fixed_t{-42316, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{9888, nullptr}, m::fixed_t{-42153, nullptr} },
204,
78,
0
};
tris[52] = {
{ m::fixed_t{13233, nullptr}, m::fixed_t{-11251, nullptr}, m::fixed_t{-43276, nullptr} },
{ m::fixed_t{13233, nullptr}, m::fixed_t{9895, nullptr}, m::fixed_t{-42316, nullptr} },
{ m::fixed_t{14174, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[53] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[54] = {
{ m::fixed_t{-18798, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[55] = {
{ m::fixed_t{12973, nullptr}, m::fixed_t{9279, nullptr}, m::fixed_t{-28750, nullptr} },
{ m::fixed_t{12973, nullptr}, m::fixed_t{-11867, nullptr}, m::fixed_t{-29710, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27018, nullptr} },
204,
78,
0
};
tris[56] = {
{ m::fixed_t{12914, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27018, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27978, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
204,
78,
0
};
tris[57] = {
{ m::fixed_t{12973, nullptr}, m::fixed_t{-11867, nullptr}, m::fixed_t{-29710, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27978, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27018, nullptr} },
204,
78,
0
};
tris[58] = {
{ m::fixed_t{12914, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27978, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[59] = {
{ m::fixed_t{12973, nullptr}, m::fixed_t{-11867, nullptr}, m::fixed_t{-29710, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
204,
78,
0
};
tris[60] = {
{ m::fixed_t{-6558, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6223, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[61] = {
{ m::fixed_t{-3636, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-6558, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[62] = {
{ m::fixed_t{-2366, nullptr}, m::fixed_t{8174, nullptr}, m::fixed_t{-4409, nullptr} },
{ m::fixed_t{-3636, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
204,
78,
0
};
tris[63] = {
{ m::fixed_t{556, nullptr}, m::fixed_t{8256, nullptr}, m::fixed_t{-6222, nullptr} },
{ m::fixed_t{-2366, nullptr}, m::fixed_t{-12973, nullptr}, m::fixed_t{-5370, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
204,
78,
0
};
tris[64] = {
{ m::fixed_t{13025, nullptr}, m::fixed_t{9309, nullptr}, m::fixed_t{-29415, nullptr} },
{ m::fixed_t{556, nullptr}, m::fixed_t{-12890, nullptr}, m::fixed_t{-7183, nullptr} },
{ m::fixed_t{13025, nullptr}, m::fixed_t{-11837, nullptr}, m::fixed_t{-30376, nullptr} },
204,
78,
0
};
tris[65] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{12914, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
204,
78,
0
};
tris[66] = {
{ m::fixed_t{20422, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{20422, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[67] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41714, nullptr} },
{ m::fixed_t{12467, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43113, nullptr} },
{ m::fixed_t{11824, nullptr}, m::fixed_t{-11279, nullptr}, m::fixed_t{-42674, nullptr} },
204,
78,
0
};
tris[68] = {
{ m::fixed_t{-17696, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41716, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{-17696, nullptr}, m::fixed_t{-11278, nullptr}, m::fixed_t{-42676, nullptr} },
204,
78,
0
};
tris[69] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{9868, nullptr}, m::fixed_t{-41714, nullptr} },
{ m::fixed_t{11824, nullptr}, m::fixed_t{-11279, nullptr}, m::fixed_t{-42674, nullptr} },
{ m::fixed_t{11302, nullptr}, m::fixed_t{9833, nullptr}, m::fixed_t{-40955, nullptr} },
204,
78,
0
};
tris[70] = {
{ m::fixed_t{11302, nullptr}, m::fixed_t{9833, nullptr}, m::fixed_t{-40955, nullptr} },
{ m::fixed_t{11302, nullptr}, m::fixed_t{-11313, nullptr}, m::fixed_t{-41916, nullptr} },
{ m::fixed_t{-1467, nullptr}, m::fixed_t{8759, nullptr}, m::fixed_t{-17300, nullptr} },
204,
78,
0
};
tris[71] = {
{ m::fixed_t{11824, nullptr}, m::fixed_t{-11279, nullptr}, m::fixed_t{-42674, nullptr} },
{ m::fixed_t{11302, nullptr}, m::fixed_t{-11313, nullptr}, m::fixed_t{-41916, nullptr} },
{ m::fixed_t{11302, nullptr}, m::fixed_t{9833, nullptr}, m::fixed_t{-40955, nullptr} },
204,
78,
0
};
tris[72] = {
{ m::fixed_t{-2401, nullptr}, m::fixed_t{8670, nullptr}, m::fixed_t{-15330, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{8603, nullptr}, m::fixed_t{-13872, nullptr} },
204,
78,
0
};
tris[73] = {
{ m::fixed_t{-1467, nullptr}, m::fixed_t{8759, nullptr}, m::fixed_t{-17300, nullptr} },
{ m::fixed_t{-2401, nullptr}, m::fixed_t{-12477, nullptr}, m::fixed_t{-16290, nullptr} },
{ m::fixed_t{-2401, nullptr}, m::fixed_t{8670, nullptr}, m::fixed_t{-15330, nullptr} },
204,
78,
0
};
tris[74] = {
{ m::fixed_t{-2401, nullptr}, m::fixed_t{8670, nullptr}, m::fixed_t{-15330, nullptr} },
{ m::fixed_t{-2401, nullptr}, m::fixed_t{-12477, nullptr}, m::fixed_t{-16290, nullptr} },
{ m::fixed_t{-3000, nullptr}, m::fixed_t{-12543, nullptr}, m::fixed_t{-14832, nullptr} },
204,
78,
0
};
tris[75] = {
{ m::fixed_t{-2401, nullptr}, m::fixed_t{-12477, nullptr}, m::fixed_t{-16290, nullptr} },
{ m::fixed_t{-1467, nullptr}, m::fixed_t{8759, nullptr}, m::fixed_t{-17300, nullptr} },
{ m::fixed_t{-1467, nullptr}, m::fixed_t{-12387, nullptr}, m::fixed_t{-18260, nullptr} },
204,
78,
0
};
tris[76] = {
{ m::fixed_t{-26306, nullptr}, m::fixed_t{9896, nullptr}, m::fixed_t{-42346, nullptr} },
{ m::fixed_t{-18352, nullptr}, m::fixed_t{-11259, nullptr}, m::fixed_t{-43114, nullptr} },
{ m::fixed_t{-26306, nullptr}, m::fixed_t{-11250, nullptr}, m::fixed_t{-43306, nullptr} },
204,
78,
0
};
tris[77] = {
{ m::fixed_t{-18798, nullptr}, m::fixed_t{7940, nullptr}, m::fixed_t{742, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27017, nullptr} },
204,
78,
0
};
tris[78] = {
{ m::fixed_t{-18798, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27017, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27977, nullptr} },
{ m::fixed_t{-18842, nullptr}, m::fixed_t{9277, nullptr}, m::fixed_t{-28704, nullptr} },
204,
78,
0
};
tris[79] = {
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-13206, nullptr}, m::fixed_t{-218, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27977, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{9200, nullptr}, m::fixed_t{-27017, nullptr} },
204,
78,
0
};
tris[80] = {
{ m::fixed_t{-18842, nullptr}, m::fixed_t{9277, nullptr}, m::fixed_t{-28704, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{-11841, nullptr}, m::fixed_t{-30294, nullptr} },
{ m::fixed_t{-18887, nullptr}, m::fixed_t{9306, nullptr}, m::fixed_t{-29334, nullptr} },
204,
78,
0
};
tris[81] = {
{ m::fixed_t{-18842, nullptr}, m::fixed_t{-11869, nullptr}, m::fixed_t{-29664, nullptr} },
{ m::fixed_t{-18842, nullptr}, m::fixed_t{9277, nullptr}, m::fixed_t{-28704, nullptr} },
{ m::fixed_t{-18798, nullptr}, m::fixed_t{-11946, nullptr}, m::fixed_t{-27977, nullptr} },
204,
78,
0
};
tris[82] = {
{ m::fixed_t{-32499, nullptr}, m::fixed_t{-11863, nullptr}, m::fixed_t{-29808, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
3,
75,
162
};
tris[83] = {
{ m::fixed_t{-32294, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
3,
75,
162
};
tris[84] = {
{ m::fixed_t{-46338, nullptr}, m::fixed_t{-11066, nullptr}, m::fixed_t{-47361, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
3,
75,
162
};
tris[85] = {
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
3,
75,
162
};
tris[86] = {
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
3,
75,
162
};
tris[87] = {
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-11849, nullptr}, m::fixed_t{-30112, nullptr} },
{ m::fixed_t{-48241, nullptr}, m::fixed_t{-11788, nullptr}, m::fixed_t{-31449, nullptr} },
3,
75,
162
};
tris[88] = {
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
3,
75,
162
};
tris[89] = {
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
3,
75,
162
};
tris[90] = {
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
3,
75,
162
};
tris[91] = {
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
3,
75,
162
};
tris[92] = {
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{-11066, nullptr}, m::fixed_t{-47361, nullptr} },
3,
75,
162
};
tris[93] = {
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
3,
75,
162
};
tris[94] = {
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{-11054, nullptr}, m::fixed_t{-47611, nullptr} },
3,
75,
162
};
tris[95] = {
{ m::fixed_t{-35189, nullptr}, m::fixed_t{-11054, nullptr}, m::fixed_t{-47611, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
3,
75,
162
};
tris[96] = {
{ m::fixed_t{-37208, nullptr}, m::fixed_t{-11319, nullptr}, m::fixed_t{-41788, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{-11301, nullptr}, m::fixed_t{-42184, nullptr} },
3,
75,
162
};
tris[97] = {
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{-11319, nullptr}, m::fixed_t{-41788, nullptr} },
3,
75,
162
};
tris[98] = {
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-11849, nullptr}, m::fixed_t{-30112, nullptr} },
3,
75,
162
};
tris[99] = {
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
3,
75,
162
};
tris[100] = {
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
3,
75,
162
};
tris[101] = {
{ m::fixed_t{-32294, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
{ m::fixed_t{-32499, nullptr}, m::fixed_t{-11863, nullptr}, m::fixed_t{-29808, nullptr} },
3,
75,
162
};
tris[102] = {
{ m::fixed_t{-46338, nullptr}, m::fixed_t{10081, nullptr}, m::fixed_t{-46401, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
3,
75,
162
};
tris[103] = {
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
3,
75,
162
};
tris[104] = {
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
3,
75,
162
};
tris[105] = {
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{10092, nullptr}, m::fixed_t{-46651, nullptr} },
3,
75,
162
};
tris[106] = {
{ m::fixed_t{-35189, nullptr}, m::fixed_t{10092, nullptr}, m::fixed_t{-46651, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
3,
75,
162
};
tris[107] = {
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{9828, nullptr}, m::fixed_t{-40828, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{9846, nullptr}, m::fixed_t{-41224, nullptr} },
3,
75,
162
};
tris[108] = {
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{9828, nullptr}, m::fixed_t{-40828, nullptr} },
3,
75,
162
};
tris[109] = {
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
3,
75,
162
};
tris[110] = {
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{10081, nullptr}, m::fixed_t{-46401, nullptr} },
3,
75,
162
};
tris[111] = {
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
3,
75,
162
};
tris[112] = {
{ m::fixed_t{-48241, nullptr}, m::fixed_t{9358, nullptr}, m::fixed_t{-30488, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9297, nullptr}, m::fixed_t{-29152, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
3,
75,
162
};
tris[113] = {
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
3,
75,
162
};
tris[114] = {
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9297, nullptr}, m::fixed_t{-29152, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
3,
75,
162
};
tris[115] = {
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{9735, nullptr}, m::fixed_t{-38785, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
3,
75,
162
};
tris[116] = {
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
3,
75,
162
};
tris[117] = {
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{9735, nullptr}, m::fixed_t{-38785, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
3,
75,
162
};
tris[118] = {
{ m::fixed_t{-41580, nullptr}, m::fixed_t{9735, nullptr}, m::fixed_t{-38785, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-32499, nullptr}, m::fixed_t{9284, nullptr}, m::fixed_t{-28848, nullptr} },
3,
75,
162
};
tris[119] = {
{ m::fixed_t{-32499, nullptr}, m::fixed_t{9284, nullptr}, m::fixed_t{-28848, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
3,
75,
162
};
tris[120] = {
{ m::fixed_t{-32299, nullptr}, m::fixed_t{9846, nullptr}, m::fixed_t{-41224, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{9828, nullptr}, m::fixed_t{-40828, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{-11319, nullptr}, m::fixed_t{-41788, nullptr} },
3,
75,
162
};
tris[121] = {
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
3,
75,
162
};
tris[122] = {
{ m::fixed_t{-46338, nullptr}, m::fixed_t{10081, nullptr}, m::fixed_t{-46401, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
3,
75,
162
};
tris[123] = {
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{10081, nullptr}, m::fixed_t{-46401, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{-11066, nullptr}, m::fixed_t{-47361, nullptr} },
3,
75,
162
};
tris[124] = {
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
3,
75,
162
};
tris[125] = {
{ m::fixed_t{-48241, nullptr}, m::fixed_t{9358, nullptr}, m::fixed_t{-30488, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
3,
75,
162
};
tris[126] = {
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9297, nullptr}, m::fixed_t{-29152, nullptr} },
{ m::fixed_t{-48241, nullptr}, m::fixed_t{9358, nullptr}, m::fixed_t{-30488, nullptr} },
{ m::fixed_t{-48241, nullptr}, m::fixed_t{-11788, nullptr}, m::fixed_t{-31449, nullptr} },
3,
75,
162
};
tris[127] = {
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9297, nullptr}, m::fixed_t{-29152, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-11849, nullptr}, m::fixed_t{-30112, nullptr} },
3,
75,
162
};
tris[128] = {
{ m::fixed_t{-32294, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
3,
75,
162
};
tris[129] = {
{ m::fixed_t{-33205, nullptr}, m::fixed_t{-11813, nullptr}, m::fixed_t{-30906, nullptr} },
{ m::fixed_t{-33205, nullptr}, m::fixed_t{9333, nullptr}, m::fixed_t{-29946, nullptr} },
{ m::fixed_t{-32499, nullptr}, m::fixed_t{-11863, nullptr}, m::fixed_t{-29808, nullptr} },
3,
75,
162
};
tris[130] = {
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
3,
75,
162
};
tris[131] = {
{ m::fixed_t{-37208, nullptr}, m::fixed_t{9828, nullptr}, m::fixed_t{-40828, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
3,
75,
162
};
tris[132] = {
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
3,
75,
162
};
tris[133] = {
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
3,
75,
162
};
tris[134] = {
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
3,
75,
162
};
tris[135] = {
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
3,
75,
162
};
tris[136] = {
{ m::fixed_t{-32499, nullptr}, m::fixed_t{9284, nullptr}, m::fixed_t{-28848, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
3,
75,
162
};
tris[137] = {
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{9735, nullptr}, m::fixed_t{-38785, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
3,
75,
162
};
tris[138] = {
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{9846, nullptr}, m::fixed_t{-41224, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{-11301, nullptr}, m::fixed_t{-42184, nullptr} },
3,
75,
162
};
tris[139] = {
{ m::fixed_t{-35189, nullptr}, m::fixed_t{10092, nullptr}, m::fixed_t{-46651, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
3,
75,
162
};
tris[140] = {
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{10092, nullptr}, m::fixed_t{-46651, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{-11054, nullptr}, m::fixed_t{-47611, nullptr} },
3,
75,
162
};
tris[141] = {
{ m::fixed_t{-32299, nullptr}, m::fixed_t{9846, nullptr}, m::fixed_t{-41224, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{-11319, nullptr}, m::fixed_t{-41788, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{-11301, nullptr}, m::fixed_t{-42184, nullptr} },
3,
75,
162
};
tris[142] = {
{ m::fixed_t{-47909, nullptr}, m::fixed_t{9762, nullptr}, m::fixed_t{-39382, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
3,
75,
162
};
tris[143] = {
{ m::fixed_t{-46338, nullptr}, m::fixed_t{10081, nullptr}, m::fixed_t{-46401, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{-11066, nullptr}, m::fixed_t{-47361, nullptr} },
3,
75,
162
};
tris[144] = {
{ m::fixed_t{-47801, nullptr}, m::fixed_t{9985, nullptr}, m::fixed_t{-44292, nullptr} },
{ m::fixed_t{-46338, nullptr}, m::fixed_t{-11066, nullptr}, m::fixed_t{-47361, nullptr} },
{ m::fixed_t{-47801, nullptr}, m::fixed_t{-11162, nullptr}, m::fixed_t{-45252, nullptr} },
3,
75,
162
};
tris[145] = {
{ m::fixed_t{-43977, nullptr}, m::fixed_t{10145, nullptr}, m::fixed_t{-47810, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
{ m::fixed_t{-43977, nullptr}, m::fixed_t{-11002, nullptr}, m::fixed_t{-48770, nullptr} },
3,
75,
162
};
tris[146] = {
{ m::fixed_t{-48241, nullptr}, m::fixed_t{9358, nullptr}, m::fixed_t{-30488, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
{ m::fixed_t{-48241, nullptr}, m::fixed_t{-11788, nullptr}, m::fixed_t{-31449, nullptr} },
3,
75,
162
};
tris[147] = {
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9297, nullptr}, m::fixed_t{-29152, nullptr} },
{ m::fixed_t{-48241, nullptr}, m::fixed_t{-11788, nullptr}, m::fixed_t{-31449, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-11849, nullptr}, m::fixed_t{-30112, nullptr} },
3,
75,
162
};
tris[148] = {
{ m::fixed_t{-48759, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-11849, nullptr}, m::fixed_t{-30112, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
3,
75,
162
};
tris[149] = {
{ m::fixed_t{-32294, nullptr}, m::fixed_t{9143, nullptr}, m::fixed_t{-25750, nullptr} },
{ m::fixed_t{-48759, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
3,
75,
162
};
tris[150] = {
{ m::fixed_t{-33205, nullptr}, m::fixed_t{9333, nullptr}, m::fixed_t{-29946, nullptr} },
{ m::fixed_t{-39379, nullptr}, m::fixed_t{-11537, nullptr}, m::fixed_t{-36985, nullptr} },
{ m::fixed_t{-39379, nullptr}, m::fixed_t{9609, nullptr}, m::fixed_t{-36025, nullptr} },
3,
75,
162
};
tris[151] = {
{ m::fixed_t{-39379, nullptr}, m::fixed_t{9609, nullptr}, m::fixed_t{-36025, nullptr} },
{ m::fixed_t{-40600, nullptr}, m::fixed_t{-11476, nullptr}, m::fixed_t{-38336, nullptr} },
{ m::fixed_t{-40600, nullptr}, m::fixed_t{9671, nullptr}, m::fixed_t{-37376, nullptr} },
3,
75,
162
};
tris[152] = {
{ m::fixed_t{-40600, nullptr}, m::fixed_t{9671, nullptr}, m::fixed_t{-37376, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{9735, nullptr}, m::fixed_t{-38785, nullptr} },
3,
75,
162
};
tris[153] = {
{ m::fixed_t{-40600, nullptr}, m::fixed_t{-11476, nullptr}, m::fixed_t{-38336, nullptr} },
{ m::fixed_t{-39379, nullptr}, m::fixed_t{9609, nullptr}, m::fixed_t{-36025, nullptr} },
{ m::fixed_t{-39379, nullptr}, m::fixed_t{-11537, nullptr}, m::fixed_t{-36985, nullptr} },
3,
75,
162
};
tris[154] = {
{ m::fixed_t{-39379, nullptr}, m::fixed_t{-11537, nullptr}, m::fixed_t{-36985, nullptr} },
{ m::fixed_t{-33205, nullptr}, m::fixed_t{9333, nullptr}, m::fixed_t{-29946, nullptr} },
{ m::fixed_t{-33205, nullptr}, m::fixed_t{-11813, nullptr}, m::fixed_t{-30906, nullptr} },
3,
75,
162
};
tris[155] = {
{ m::fixed_t{-40600, nullptr}, m::fixed_t{9671, nullptr}, m::fixed_t{-37376, nullptr} },
{ m::fixed_t{-40600, nullptr}, m::fixed_t{-11476, nullptr}, m::fixed_t{-38336, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
3,
75,
162
};
tris[156] = {
{ m::fixed_t{-32499, nullptr}, m::fixed_t{-11863, nullptr}, m::fixed_t{-29808, nullptr} },
{ m::fixed_t{-33205, nullptr}, m::fixed_t{9333, nullptr}, m::fixed_t{-29946, nullptr} },
{ m::fixed_t{-32499, nullptr}, m::fixed_t{9284, nullptr}, m::fixed_t{-28848, nullptr} },
3,
75,
162
};
tris[157] = {
{ m::fixed_t{-46802, nullptr}, m::fixed_t{9380, nullptr}, m::fixed_t{-30984, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
{ m::fixed_t{-46802, nullptr}, m::fixed_t{-11766, nullptr}, m::fixed_t{-31944, nullptr} },
3,
75,
162
};
tris[158] = {
{ m::fixed_t{-37208, nullptr}, m::fixed_t{9828, nullptr}, m::fixed_t{-40828, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
{ m::fixed_t{-37208, nullptr}, m::fixed_t{-11319, nullptr}, m::fixed_t{-41788, nullptr} },
3,
75,
162
};
tris[159] = {
{ m::fixed_t{-40678, nullptr}, m::fixed_t{9366, nullptr}, m::fixed_t{-30675, nullptr} },
{ m::fixed_t{-47909, nullptr}, m::fixed_t{-11384, nullptr}, m::fixed_t{-40342, nullptr} },
{ m::fixed_t{-40678, nullptr}, m::fixed_t{-11780, nullptr}, m::fixed_t{-31635, nullptr} },
3,
75,
162
};
tris[160] = {
{ m::fixed_t{-41936, nullptr}, m::fixed_t{9927, nullptr}, m::fixed_t{-43021, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
3,
75,
162
};
tris[161] = {
{ m::fixed_t{-40529, nullptr}, m::fixed_t{9953, nullptr}, m::fixed_t{-43602, nullptr} },
{ m::fixed_t{-41936, nullptr}, m::fixed_t{-11219, nullptr}, m::fixed_t{-43982, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
3,
75,
162
};
tris[162] = {
{ m::fixed_t{-39143, nullptr}, m::fixed_t{9934, nullptr}, m::fixed_t{-43171, nullptr} },
{ m::fixed_t{-40529, nullptr}, m::fixed_t{-11193, nullptr}, m::fixed_t{-44562, nullptr} },
{ m::fixed_t{-39143, nullptr}, m::fixed_t{-11212, nullptr}, m::fixed_t{-44131, nullptr} },
3,
75,
162
};
tris[163] = {
{ m::fixed_t{-32499, nullptr}, m::fixed_t{9284, nullptr}, m::fixed_t{-28848, nullptr} },
{ m::fixed_t{-32294, nullptr}, m::fixed_t{-12003, nullptr}, m::fixed_t{-26711, nullptr} },
{ m::fixed_t{-32499, nullptr}, m::fixed_t{-11863, nullptr}, m::fixed_t{-29808, nullptr} },
3,
75,
162
};
tris[164] = {
{ m::fixed_t{-42452, nullptr}, m::fixed_t{9857, nullptr}, m::fixed_t{-41476, nullptr} },
{ m::fixed_t{-41580, nullptr}, m::fixed_t{-11412, nullptr}, m::fixed_t{-39746, nullptr} },
{ m::fixed_t{-42452, nullptr}, m::fixed_t{-11289, nullptr}, m::fixed_t{-42436, nullptr} },
3,
75,
162
};
tris[165] = {
{ m::fixed_t{-33368, nullptr}, m::fixed_t{9994, nullptr}, m::fixed_t{-44496, nullptr} },
{ m::fixed_t{-32299, nullptr}, m::fixed_t{-11301, nullptr}, m::fixed_t{-42184, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
3,
75,
162
};
tris[166] = {
{ m::fixed_t{-35189, nullptr}, m::fixed_t{10092, nullptr}, m::fixed_t{-46651, nullptr} },
{ m::fixed_t{-33368, nullptr}, m::fixed_t{-11152, nullptr}, m::fixed_t{-45456, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{-11054, nullptr}, m::fixed_t{-47611, nullptr} },
3,
75,
162
};
tris[167] = {
{ m::fixed_t{-37723, nullptr}, m::fixed_t{10149, nullptr}, m::fixed_t{-47916, nullptr} },
{ m::fixed_t{-35189, nullptr}, m::fixed_t{-11054, nullptr}, m::fixed_t{-47611, nullptr} },
{ m::fixed_t{-37723, nullptr}, m::fixed_t{-10997, nullptr}, m::fixed_t{-48877, nullptr} },
3,
75,
162
};
} }; }
|
mincrmatt12/MSign
|
esp/main/grabber/transit/gtfs.h
|
#ifndef GTFS_H
#define GTFS_H
#include "../grab.h"
namespace transit::gtfs {
void init();
bool loop();
// Update every minute
constexpr static auto gtfs_grabber = grabber::make_refreshable_grabber(
grabber::make_https_grabber(init, loop, pdMS_TO_TICKS(90*1000)),
slots::protocol::GrabberID::TRANSIT
);
}
#endif
|
mincrmatt12/MSign
|
stm/src/ui.h
|
#ifndef MSN_UIB_H
#define MSN_UIB_H
#include <stdint.h>
#include <FreeRTOS.h>
namespace ui {
extern struct Buttons {
// setup gpios
void init();
// Load new values from esp/buttons
void update();
enum Button {
POWER = 0, // PA0
NXT = 10,
PRV = 9,
SEL = 8,
MENU = 7,
EXT1 = 6,
EXT2 = 5
};
bool held(Button b, TickType_t minduration=0) const;
bool press(Button b) const;
bool rel(Button b) const;
bool operator[](Button b) const {return press(b);}
bool changed() const;
TickType_t frame_time() const;
private:
uint16_t current_held{};
uint16_t last_held{};
uint16_t held_duration[11]{};
TickType_t last_update{};
TickType_t last_duration{};
} buttons;
}
#endif
|
ngpeijiun/sample-code-objc
|
Bricker/Bricker/GameWorld.h
|
//
// GameWorld.h
// Bricker
//
// Created by <NAME> on 1/5/15.
// Copyright (c) 2015 SampleCode. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreGraphics/CGGeometry.h>
#import <QuartzCore/CADisplayLink.h>
static const int GAME_BRICKS_NUM = 5 * 10;
enum GameState {
GameStateInit,
GameStateBegin,
GameStateContinue,
GameStateReady,
GameStateRunning,
GameStateLost,
GameStateOver,
GameStateWin
};
typedef enum GameState GameState;
struct Brick {
CGRect frame;
CGFloat alpha;
BOOL hit;
};
typedef struct Brick Brick;
static inline int signum(int n);
static inline BOOL BrickIsSolid(Brick brick);
static inline int signum(int n) {
return (n < 0) ? -1 : +1;
}
static inline BOOL BrickIsSolid(Brick brick) {
return brick.alpha == 1;
}
@protocol GameWorldGraphicsDelegate <NSObject>
- (void)render;
@end
@interface GameWorld : NSObject {
Brick bricks[GAME_BRICKS_NUM];
CGPoint ballVelocity;
CGFloat paddleX;
CADisplayLink *timer;
}
@property (nonatomic) id <GameWorldGraphicsDelegate> graphicsDelegate;
@property (nonatomic) CGSize size;
@property (nonatomic) GameState gameState;
@property (nonatomic) int lives;
@property (nonatomic) int score;
@property (nonatomic) CGRect ball;
@property (nonatomic) CGRect paddle;
- (id)initWithSize:(CGSize)size;
- (Brick)brickAtIndex:(int)index;
- (void)start;
- (void)pause;
- (void)movePaddleByX:(CGFloat)x;
@end
|
ngpeijiun/sample-code-objc
|
Bricker/Bricker/ViewController.h
|
<filename>Bricker/Bricker/ViewController.h
//
// ViewController.h
// Bricker
//
// Created by <NAME> on 1/5/15.
// Copyright (c) 2015 SampleCode. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GameViewController.h"
@interface ViewController : UIViewController
@property (strong, nonatomic) GameViewController *gameViewController;
@end
|
ngpeijiun/sample-code-objc
|
Bricker/Bricker/GameViewController.h
|
//
// GameViewController.h
// Bricker
//
// Created by <NAME> on 1/5/15.
// Copyright (c) 2015 SampleCode. All rights reserved.
//
#import <UIKIt/UIKit.h>
#import "GameWorld.h"
@interface GameViewController : UIViewController <GameWorldGraphicsDelegate> {
UIView *bricks[GAME_BRICKS_NUM];
float touchOffset;
}
@property (strong, nonatomic) GameWorld *gameWorld;
@property (strong, nonatomic) UILabel *livesTextLabel;
@property (strong, nonatomic) UILabel *livesValueLabel;
@property (strong, nonatomic) UILabel *scoreTextLabel;
@property (strong, nonatomic) UILabel *scoreValueLabel;
@property (strong, nonatomic) UIView *ballView;
@property (strong, nonatomic) UIView *paddleView;
@property (strong, nonatomic) UILabel *messageLabel;
@end
|
ngpeijiun/sample-code-objc
|
Bricker/Bricker/AppDelegate.h
|
<gh_stars>1-10
//
// AppDelegate.h
// Bricker
//
// Created by <NAME> on 1/5/15.
// Copyright (c) 2015 SampleCode. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.cAudioManager.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(cAudioManager::GetDistanceSquared)
static int address;
static int global_address;
static const int id = 0x569750;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x569750, 0X569AA0, 0X5699A0>;
using refs_t = RefList<>;
using def_t = float(CVector const&);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<CVector const&>, 0>;
META_END
META_BEGIN(cAudioManager::CalculateDistance)
static int address;
static int global_address;
static const int id = 0x5697A0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5697A0, 0X569AF0, 0X5699F0>;
using refs_t = RefList<>;
using def_t = int(unsigned char&, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char&, float>, 0, 1>;
META_END
META_BEGIN(cAudioManager::ComputeVolume)
static int address;
static int global_address;
static const int id = 0x57ABB0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x57ABB0, 0X57AF00, 0X57AE00>;
using refs_t = RefList<>;
using def_t = unsigned char(unsigned char, float, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char, float, float>, 0, 1, 2>;
META_END
META_BEGIN(cAudioManager::RandomDisplacement)
static int address;
static int global_address;
static const int id = 0x4B0DE0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x57AF90, 0X57B2E0, 0X57B1E0>;
using refs_t = RefList<>;
using def_t = int(unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned int>, 0>;
META_END
META_BEGIN(cAudioManager::AddSampleToRequestedQueue)
static int address;
static int global_address;
static const int id = 0x57B070;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x57B070, 0X57B3C0, 0X57B2C0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(cAudioManager::ProcessLoopingScriptObject)
static int address;
static int global_address;
static const int id = 0x576770;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0, 0x576770, 0>;
using refs_t = RefList<>;
using def_t = void(unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char>, 0>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/eVehicleClass.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
enum eVehicleClass
{
VEHICLECLASS_CAR = 0x0,
VEHICLECLASS_BOAT = 0x1,
VEHICLECLASS_TRAIN = 0x2,
VEHICLECLASS_HELI = 0x3,
VEHICLECLASS_PLANE = 0x4,
VEHICLECLASS_BIKE = 0x5,
};
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/eCamMode.h
|
<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
enum eCamMode
{
MODE_NONE = 0,
MODE_TOPDOWN = 1,
MODE_GTACLASSIC = 2,
MODE_BEHINDCAR = 3,
MODE_FOLLOWPED = 4,
MODE_AIMING = 5,
MODE_DEBUG = 6,
MODE_SNIPER = 7,
MODE_ROCKETLAUNCHER = 8,
MODE_MODELVIEW = 9,
MODE_BILL = 10,
MODE_SYPHON = 11,
MODE_CIRCLE = 12,
MODE_CHEESYZOOM = 13,
MODE_WHEELCAM = 14,
MODE_FIXED = 15,
MODE_1STPERSON = 16,
MODE_FLYBY = 17,
MODE_CAM_ON_A_STRING = 18,
MODE_REACTION = 19,
MODE_FOLLOW_PED_WITH_BIND = 20,
MODE_CHRIS = 21,
MODE_BEHINDBOAT = 22,
MODE_PLAYER_FALLEN_WATER = 23,
MODE_CAM_ON_TRAIN_ROOF = 24,
MODE_CAM_RUNNING_SIDE_TRAIN = 25,
MODE_BLOOD_ON_THE_TRACKS = 26,
MODE_IM_THE_PASSENGER_WOOWOO = 27,
MODE_SYPHON_CRIM_IN_FRONT = 28,
MODE_PED_DEAD_BABY = 29,
MODE_PILLOWS_PAPS = 30,
MODE_LOOK_AT_CARS = 31,
MODE_ARRESTCAM_ONE = 32,
MODE_ARRESTCAM_TWO = 33,
MODE_M16_1STPERSON = 34,
MODE_SPECIAL_FIXED_FOR_SYPHON = 35,
MODE_FIGHT_CAM = 36,
MODE_TOP_DOWN_PED = 37,
MODE_SNIPER_RUNABOUT = 38,
MODE_ROCKETLAUNCHER_RUNABOUT = 39,
MODE_1STPERSON_RUNABOUT = 40,
MODE_M16_1STPERSON_RUNABOUT = 41,
MODE_FIGHT_CAM_RUNABOUT = 42,
MODE_EDITOR = 43,
MODE_HELICANNON_1STPERSON = 44,
};
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CDamageManager.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CDamageManager::GetWheelStatus)
static int address;
static int global_address;
static const int id = 0x545910;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x545910, 0X545B10, 0X545AC0>;
using refs_t = RefList<>;
using def_t = bool(int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CDamageManager::SetEngineStatus)
static int address;
static int global_address;
static const int id = 0x545940;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x545940, 0x545B40, 0x545AF0>;
using refs_t = RefList<>;
using def_t = void(unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned int>, 0>;
META_END
META_BEGIN(CDamageManager::SetWheelStatus)
static int address;
static int global_address;
static const int id = 0x545900;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x545900, 0x545B00, 0x545AB0>;
using refs_t = RefList<>;
using def_t = void(int, unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<int, unsigned int>, 0, 1>;
META_END
META_BEGIN(CDamageManager::ProgressWheelDamage)
static int address;
static int global_address;
static const int id = 0x545A40;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x545A40, 0x545C40, 0x545BF0>;
using refs_t = RefList<>;
using def_t = bool(unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char>, 0>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CPed.h
|
<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "RenderWare.h"
#include "CPhysical.h"
#include "CStoredCollPoly.h"
#include "CPedIK.h"
#include "CPathNode.h"
#include "CPedStats.h"
#include "CWeapon.h"
enum eObjective;
enum PLUGIN_API eMoveState {
PEDMOVE_NONE,
PEDMOVE_STILL,
PEDMOVE_WALK,
PEDMOVE_RUN,
PEDMOVE_SPRINT
};
class CVehicle;
class PLUGIN_API CPed : public CPhysical {
protected:
CPed(plugin::dummy_func_t) : CPhysical(plugin::dummy), m_aWeapons{ plugin::dummy, plugin::dummy,
plugin::dummy, plugin::dummy, plugin::dummy, plugin::dummy, plugin::dummy, plugin::dummy,
plugin::dummy, plugin::dummy, plugin::dummy, plugin::dummy, plugin::dummy } {}
public:
CStoredCollPoly m_polyColliding;
float m_fCollisionSpeed;
struct {
unsigned char b01 : 1;
unsigned char b02 : 1;
unsigned char b03 : 1;
unsigned char b04 : 1;
unsigned char b05 : 1;
unsigned char b06 : 1;
unsigned char b07 : 1;
unsigned char b08 : 1;
unsigned char b09 : 1;
unsigned char b10 : 1;
unsigned char b11 : 1;
unsigned char b12 : 1;
unsigned char b13 : 1;
unsigned char b14 : 1;
unsigned char b15 : 1;
unsigned char b16 : 1;
unsigned char b17 : 1;
unsigned char b18 : 1;
unsigned char b19 : 1;
unsigned char b20 : 1;
unsigned char b21 : 1;
unsigned char b22 : 1;
unsigned char b23 : 1;
unsigned char b24 : 1;
unsigned char b25 : 1;
unsigned char b26 : 1;
unsigned char b27 : 1;
unsigned char b28 : 1;
unsigned char b29 : 1;
unsigned char b30 : 1;
unsigned char b31 : 1;
unsigned char bHasObjectiveCompleted : 1;
unsigned char b33 : 1;
unsigned char b34 : 1;
unsigned char b35 : 1;
unsigned char b36 : 1;
unsigned char b37 : 1;
unsigned char b38 : 1;
unsigned char b39 : 1;
unsigned char b40 : 1;
unsigned char b41 : 1;
unsigned char b42 : 1;
unsigned char b43 : 1;
unsigned char b44 : 1;
unsigned char b45 : 1;
unsigned char b46 : 1;
unsigned char b47 : 1;
unsigned char b48 : 1;
unsigned char b49 : 1;
unsigned char b50 : 1;
unsigned char b51 : 1;
unsigned char b52 : 1;
unsigned char b53 : 1;
unsigned char b54 : 1;
unsigned char b55 : 1;
unsigned char b56 : 1;
unsigned char b57 : 1;
unsigned char b58 : 1;
unsigned char b59 : 1;
unsigned char b60 : 1;
unsigned char b61 : 1;
unsigned char b62 : 1;
unsigned char b63 : 1;
unsigned char b64 : 1;
unsigned char b65 : 1;
unsigned char b66 : 1;
unsigned char b67 : 1;
unsigned char b68 : 1;
unsigned char b69 : 1;
unsigned char b70 : 1;
unsigned char b71 : 1;
unsigned char b72 : 1;
} m_nPedFlags;
char field_15D;
char field_15E;
char field_15F;
unsigned char m_nPedStatus;
private:
char _pad161[3];
public:
int m_nObjective;
int m_nPrevObjective;
CEntity *m_pObjectiveEntity;
CVehicle *m_pObjectiveVehicle;
CVector m_vObjective;
CPed *m_pGangLeader;
int m_nPedFormation;
unsigned int m_nFearFlags;
CEntity *m_pThreatEntity;
float m_fEventOrThreatX;
float m_fEventOrThreatY;
unsigned int m_nEventType;
CEntity *m_pEventEntity;
float m_fAngleToEvent;
void *m_apFrames[12];
int m_nAnimGroupId;
void *m_pVehicleAnim;
CVector2D m_vAnimMoveDelta;
CVector m_vOffsetSeek;
CPedIK m_pedIK;
float m_fActionX;
float m_fActionY;
int m_nActionTimer;
int m_nAction;
int m_nLastAction;
eMoveState m_nMoveState;
int m_nStoredActionState;
int m_nPrevActionState;
int m_nWaitState;
int m_nWaitTimer;
CPathNode *m_apPathNodesStates[8];
CPathNode m_aPathNodeStates[10];
unsigned short m_nPathNodes;
short m_nCurPathNode;
char m_nPathState;
private:
char _pad2B5[3];
public:
CPathNode *m_pNextPathNode;
CPathNode *m_pLastPathNode;
float m_fHealth;
float m_fArmour;
short m_nRouteLastPoint;
unsigned short m_nRoutePoints;
short m_nRoutePos;
unsigned short m_nRouteType;
short m_nRouteCurDir;
private:
char _pad2D2[2];
public:
float m_fMovedX;
float m_fMovedY;
float m_fRotationCur;
float m_fRotationDest;
float m_fHeadingRate;
unsigned short m_nEnterType;
unsigned short m_nWalkAroundType;
CPhysical *m_pCurPhysSurface;
CVector m_vOffsetFromPhysSurface;
CEntity *m_pCurSurface;
CVector m_vSeekVehicle;
CEntity *m_pSeekTarget;
CVehicle *m_pVehicle;
bool m_bInVehicle;
private:
char _pad315[3];
public:
float m_fSeatPrecisionX;
bool m_bHasPhone;
private:
char _pad31D;
public:
short m_nPhoneId;
int m_nLookingForPhone;
int m_nPhoneTalkTimer;
void *m_pLastAccident;
unsigned int m_nPedType;
CPedStats *m_pPedStats;
float m_fFleeFromPosX;
float m_fFleeFromPosY;
void *m_pFleeFrom;
int m_nFleeTimer;
void *m_pLastThreatAt;
int m_nLastThreatTimer;
CVehicle *m_pVehicleColliding;
unsigned char m_nStateUnused;
private:
char _pad351[3];
public:
int m_nTimerUnused;
void *m_pTargetUnused;
CWeapon m_aWeapons[13];
int dword494;
unsigned char m_nWepSlot;
unsigned char byte_499;
unsigned char m_nWepSkills;
unsigned char m_nWepAccuracy;
CEntity *m_pPointGunAt;
CVector m_vHitLastPos;
int m_nHitCounter;
int m_nLastHitState;
void *m_pPedFire; // CFire ptr
void *m_pPedFight;
float m_fLookDirection;
int m_nWepModelID;
int m_nLeaveCarTimer;
int m_nGetUpTimer;
int m_nLookTimer;
int m_nStandardTimer;
int m_nAttackTimer;
int m_nLastHitTime;
int m_nHitRecoverTimer;
int m_nObjectiveTimer;
int m_nDuckTimer;
int m_nDuckAndCoverTimer;
int m_nBloodyTimer;
unsigned char m_nPanicCounter;
unsigned char m_nDeadBleeding;
unsigned char m_nBodyPartBleeding;
private:
char _pad4F3;
public:
CPed *m_apNearPeds[10];
unsigned short m_nNumNearPeds;
unsigned char m_nLastDamWep;
private:
char _pad51F;
public:
int m_nTalkTimerLast;
int m_nTalkTimer;
short m_nTalkTypeLast;
unsigned short m_nTalkType;
CVector m_vSeekPosEx;
float m_fSeekExAngle;
//vtable
//funcs
SUPPORTED_10EN_11EN CPed(unsigned int modelIndex);
SUPPORTED_10EN_11EN ~CPed();
SUPPORTED_10EN_11EN_STEAM bool IsPlayer();
SUPPORTED_10EN_11EN_STEAM bool UseGroundColModel();
SUPPORTED_10EN_11EN void AddWeaponModel(int weaponID);
SUPPORTED_10EN_11EN void SetAimFlag(CEntity* aimingTo);
SUPPORTED_10EN_11EN void SetAimFlag(float heading);
SUPPORTED_10EN_11EN void SetAttack(CEntity* entity);
SUPPORTED_10EN_11EN void SetAttackTimer(unsigned int time);
SUPPORTED_10EN_11EN void SetPointGunAt(CEntity* entity);
SUPPORTED_10EN_11EN void ClearAimFlag();
SUPPORTED_10EN_11EN void RestorePreviousState();
SUPPORTED_10EN_11EN void ClearPointGunAt();
SUPPORTED_10EN_11EN char ClearLookFlag();
SUPPORTED_10EN_11EN void GiveWeapon(eWeaponType weaponType, unsigned int ammo);
SUPPORTED_10EN_11EN void SetCurrentWeapon(int slot);
SUPPORTED_10EN_11EN void SetObjective(eObjective objective);
SUPPORTED_10EN_11EN void SetObjective(eObjective objective, CVector const& arg1);
SUPPORTED_10EN_11EN void SetObjective(eObjective objective, CVector arg1, float arg2);
SUPPORTED_10EN_11EN void SetObjective(eObjective objective, short arg1, short arg2);
SUPPORTED_10EN_11EN void SetObjective(eObjective objective, void* arg1);
SUPPORTED_10EN_11EN void SetObjectiveTimer(unsigned int time);
SUPPORTED_10EN_11EN void WarpPedIntoCar(CVehicle* vehicle);
SUPPORTED_10EN_11EN void RemoveWeaponModel(int modelIndex);
SUPPORTED_10EN_11EN void StopNonPartialAnims();
};
VALIDATE_SIZE(CPed, 0x53C);
PLUGIN_VARIABLE extern CVector *vecPedCarDoorAnimOffset;
PLUGIN_VARIABLE extern CVector *vecPedCarDoorLoAnimOffset;
PLUGIN_VARIABLE extern CVector *vecPedVanRearDoorAnimOffset;
PLUGIN_VARIABLE extern CVector *vecPedTrainDoorAnimOffset;
PLUGIN_VARIABLE extern CVector *vecPedDraggedOutCarAnimOffset;
PLUGIN_VARIABLE extern CVector *vecPedQuickDraggedOutCarAnimOffset;
#include "meta/meta.CPed.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.cDMAudio.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(cDMAudio::PlayFrontEndSound)
static int address;
static int global_address;
static const int id = 0x57CC20;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x57CC20, 0x57CF70, 0x57CE70>;
using refs_t = RefList<>;
using def_t = void(unsigned short, unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned short, unsigned int>, 0, 1>;
META_END
META_BEGIN(cDMAudio::PlayOneShot)
static int address;
static int global_address;
static const int id = 0x57C840;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x57C840, 0x57CB90, 0x57CA90>;
using refs_t = RefList<>;
using def_t = void(int, unsigned short, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<int, unsigned short, float>, 0, 1, 2>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CGarage.h
|
<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CObject.h"
#include "CStoredCar.h"
#include "eGarageType.h"
#include "eGarageState.h"
#include "eGarageID.h"
#pragma pack(push, 4)
class CGarage {
public:
eGarageType m_nType;
eGarageState m_nState;
char field_2;
bool m_bLockup;
bool m_bIsDeActivate;
bool m_bHasResprayHappened;
unsigned int m_nVehicleModelIndex; // SECURICA
CObject *m_pDoorOne;
CObject *m_pDoorTwo;
char m_nIndexDoorOne; // pool index
char m_nIndexDoorTwo; // pool index
bool field_16;
bool field_17;
char field_18;
bool m_bDoorSwingOpen;
bool m_bCameraFollowsPlayer;
float m_fLeftCoord;
float m_fRightCoord;
float m_fFrontCoord;
float m_fBackCoord;
float m_fUpCoord;
float m_fDownCoord;
float m_fDoorCurrentAngle;
float m_fDoorOpenAngle;
CVector2D m_vecDoorOnePosnXY;
CVector2D m_vecDoorTwoPosnXY;
float m_fDoorOnePosnZ;
float m_fDoorTwoPosnZ;
unsigned int m_nTimeToOpen;
bool m_bHasThisCarBeenCollected;
CVehicle *m_pTargetCar;
int field_60;
CStoredCar m_storedCar;
//funcs
void BuildRotatedDoorMatrix(CEntity* door, float angle);
float CalcDistToGarageRectangleSquared(float x, float y);
float CalcSmallestDistToGarageDoorSquared(float x, float y);
bool CenterCarInGarage(CVehicle* vehicle);
eGarageState CloseThisGarage();
int CountCarsWithCenterPointWithinGarage(CEntity* vehicle);
bool DoesCraigNeedThisCar(int modelIndex);
bool EntityHasASphereWayOutsideGarage(CEntity* entity, float radius);
void FindDoorsEntities();
char FindDoorsEntitiesSectorList(CPtrList& list, bool arg1);
bool HasCraigCollectedThisCar(int modelIndex);
bool IsAnyCarBlockingDoor();
bool IsAnyOtherCarTouchingGarage(CVehicle* vehicle);
bool IsAnyOtherPedTouchingGarage(CPed* ped);
bool IsEntityEntirelyInside(CEntity* entity);
bool IsEntityEntirelyInside3D(CEntity* entity, float radius);
bool IsEntityEntirelyOutside(CEntity* entity, float radius);
bool IsEntityTouching3D(CEntity* entity);
bool IsGarageEmpty();
bool IsPlayerOutsideGarage();
bool IsStaticPlayerCarEntirelyInside();
void Load(unsigned char* bufferPointer, unsigned int structSize);
bool MarkThisCarAsCollectedForCraig(int modelIndex);
eGarageState OpenThisGarage();
void PlayerArrestedOrDied();
void RefreshDoorPointers(bool arg0);
void RemoveCarsBlockingDoorNotInside();
bool RestoreCarsForThisHideOut(CStoredCar* car);
void StoreAndRemoveCarsForThisHideOut(CStoredCar* car, int count);
void TidyUpGarage();
void TidyUpGarageClose();
void Update();
void UpdateCrusherAngle();
void UpdateCrusherShake(float x, float y);
void UpdateDoorsHeight();
};
#pragma pack(pop)
VALIDATE_SIZE(CGarage, 0x8C);
extern unsigned int *gaCarsToCollectInCraigsGarages;
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/eWeaponType.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
enum eWeaponType : unsigned int {
WEAPONTYPE_UNARMED = 0,
WEAPONTYPE_BASEBALLBAT,
WEAPONTYPE_COLT45,
WEAPONTYPE_UZI,
WEAPONTYPE_SHOTGUN,
WEAPONTYPE_AK47,
WEAPONTYPE_M16,
WEAPONTYPE_SNIPERRIFLE,
WEAPONTYPE_ROCKETLAUNCHER,
WEAPONTYPE_FLAMETHROWER,
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR,
WEAPONTYPE_HELICANNON,
WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR,
WEAPONTYPE_EXPLOSION,
WEAPONTYPE_UZI_DRIVEBY,
WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED,
_WEAPONTYPE_23,
};
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CFileMgr.h
|
<filename>plugin_III/game_III/CFileMgr.h
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#define FILESTREAM int
class PLUGIN_API CFileMgr {
public:
SUPPORTED_10EN_11EN_STEAM static char *ms_dirName; // static char ms_dirName[128]
SUPPORTED_10EN_11EN_STEAM static char *ms_rootDirName; // static char ms_rootDirName[128]
SUPPORTED_10EN_11EN_STEAM static void Initialise();
SUPPORTED_10EN_11EN_STEAM static void ChangeDir(char const* dir);
SUPPORTED_10EN_11EN_STEAM static void SetDir(char const* dir);
SUPPORTED_10EN_11EN_STEAM static void SetDirMyDocuments();
SUPPORTED_10EN_11EN_STEAM static FILESTREAM LoadTextFile(char const* filepath, unsigned char* buffer, int size, char const* mode);
SUPPORTED_10EN_11EN_STEAM static FILESTREAM OpenFile(char const* filepath, char const* mode);
SUPPORTED_10EN_11EN_STEAM static FILESTREAM OpenFileForWriting(char const* filepath);
SUPPORTED_10EN_11EN_STEAM static int Read(FILESTREAM fileHandle, char* buffer, int size);
SUPPORTED_10EN_11EN_STEAM static int Write(FILESTREAM fileHandle, char* buffer, int size);
SUPPORTED_10EN_11EN_STEAM static bool Seek(FILESTREAM fileHandle, int offset, int origin);
SUPPORTED_10EN_11EN_STEAM static bool ReadLine(FILESTREAM fileHandle, char* buffer, int maxSize);
SUPPORTED_10EN_11EN_STEAM static int CloseFile(FILESTREAM fileHandle);
SUPPORTED_10EN_11EN_STEAM static int GetErrorReadWrite(FILESTREAM fileHandle);
};
#include "meta/meta.CFileMgr.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/cSampleManager.h
|
<filename>plugin_III/game_III/cSampleManager.h
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#pragma pack(push, 1)
struct tSample
{
unsigned int nOffset;
unsigned int nLength;
unsigned int nBaseFrequency;
int nLoopStartOffset;
int nLoopEndOffset;
};
#pragma pack(pop)
class PLUGIN_API cSampleManager
{
public:
unsigned char m_nEffectsVolume;
unsigned char m_nMusicVolume;
unsigned char m_nEffectsFadeVolume;
unsigned char m_nMusicFadeVolume;
char field_4;
char _pad0;
char m_szCDRomRootPath[80];
bool m_bInitialised;
char m_nNumberOfProviders;
char *m_aAudioProviders[64];
tSample m_aSamples[3032];
SUPPORTED_10EN_11EN_STEAM static int &MP3Count;
SUPPORTED_10EN_11EN_STEAM static bool IsMP3RadioChannelAvailable();
SUPPORTED_10EN_11EN void SetStreamedVolumeAndPan(unsigned char nVolume, unsigned char nPan, unsigned char nEffectFlag, unsigned char nStream);
SUPPORTED_10EN_11EN void StartPreloadedStreamedFile(unsigned char nStream);
SUPPORTED_10EN_11EN bool StartStreamedFile(unsigned char nFile, unsigned int nPos, unsigned char nStream);
SUPPORTED_10EN_11EN void StopStreamedFile(unsigned char nStream);
SUPPORTED_10EN_11EN bool IsStreamPlaying(unsigned char nStream);
SUPPORTED_10EN_11EN_STEAM int GetSampleBaseFrequency(unsigned int nSample);
SUPPORTED_10EN_11EN_STEAM int GetSampleLoopStartOffset(unsigned int nSample);
SUPPORTED_10EN_11EN_STEAM int GetSampleLoopEndOffset(unsigned int nSample);
};
extern cSampleManager &SampleManager;
#include "meta/meta.cSampleManager.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CAnimManager.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CAnimationStyleDescriptor.h"
#include "CAnimBlendAssocGroup.h"
#include "CAnimBlendAssociation.h"
#include "CAnimBlock.h"
#include "CLinkList.h"
class PLUGIN_API CAnimManager {
public:
SUPPORTED_10EN_11EN static void Initialise(void);
SUPPORTED_10EN_11EN static void Shutdown(void);
SUPPORTED_10EN_11EN static void UncompressAnimation(CAnimBlendHierarchy *hier);
SUPPORTED_10EN_11EN static CAnimBlock *GetAnimationBlock(const char *name);
SUPPORTED_10EN_11EN static CAnimBlendHierarchy *GetAnimation(const char *name, CAnimBlock *animBlock);
SUPPORTED_10EN_11EN static const char *GetAnimGroupName(int index);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *CreateAnimAssociation(int AssocGroupId, int AnimationId);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *GetAnimAssociation(int AssocGroupId, int AnimationId);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *GetAnimAssociation(int AssocGroupId, const char *name);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *AddAnimation(RpClump *clump, int AssocGroupId, int AnimationId);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *AddAnimationAndSync(RpClump *clump, CAnimBlendAssociation *, int AssocGroupId, int AnimationId);
SUPPORTED_10EN_11EN static CAnimBlendAssociation *BlendAnimation(RpClump *clump, int AssocGroupId, int AnimationId, float clumpAssocBlendData);
SUPPORTED_10EN_11EN static void LoadAnimFiles(void);
SUPPORTED_10EN_11EN static void LoadAnimFile(const char*);
SUPPORTED_10EN_11EN static void LoadAnimFile(int, bool);
SUPPORTED_10EN_11EN static void RemoveLastAnimFile(void);
SUPPORTED_10EN_11EN static int &ms_numAnimations;
SUPPORTED_10EN_11EN static CAnimBlendHierarchy *ms_aAnimations;
SUPPORTED_10EN_11EN static int &ms_numAnimBlocks;
SUPPORTED_10EN_11EN static CAnimBlock *ms_aAnimBlocks;
SUPPORTED_10EN_11EN static CAnimBlendAssocGroup *&ms_aAnimAssocGroups;
SUPPORTED_10EN_11EN static const int ms_numAnimAssocDefinitions = 25;
SUPPORTED_10EN_11EN static CAnimationStyleDescriptor *ms_aAnimAssocDefinitions; // 25
SUPPORTED_10EN_11EN static CLinkList<CAnimBlendHierarchy*> &ms_animCache;
};
#include "meta/meta.CAnimManager.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CSprite.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "RenderWare.h"
#include "CVector.h"
#include "CRect.h"
class PLUGIN_API CSprite {
public:
SUPPORTED_10EN_11EN_STEAM static bool CalcScreenCoors(CVector const& coords, RwV3d *out, float *w, float *h, bool checkMaxVisible);
SUPPORTED_10EN_11EN_STEAM static double CalcHorizonCoors();
SUPPORTED_10EN_11EN_STEAM static int FlushSpriteBuffer();
SUPPORTED_10EN_11EN_STEAM static void InitSpriteBuffer();
SUPPORTED_10EN_11EN_STEAM static void InitSpriteBuffer2D();
SUPPORTED_10EN_11EN_STEAM static int RenderBufferedOneXLUSprite(float x, float y, float z, float w, float h, unsigned char r, unsigned char g, unsigned char b, short intensity, float recip, unsigned char a);
SUPPORTED_10EN_11EN_STEAM static int RenderOneXLUSprite(float x, float y, float z, float w, float h, unsigned char r, unsigned char g, unsigned char b, short intensity, float recipz, unsigned char a);
SUPPORTED_10EN_11EN_STEAM static short RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, unsigned char r, unsigned char g, unsigned char b, short intensity, float recipz, float roll, unsigned char alpha);
SUPPORTED_10EN_11EN_STEAM static short RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, unsigned char r, unsigned char g, unsigned char b, short intensity, float recipz, float roll, unsigned char alpha);
SUPPORTED_10EN_11EN_STEAM static short RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z, float w, float h, unsigned char r, unsigned char g, unsigned char b, short intensity, float recipz, float roll, unsigned char alpha);
SUPPORTED_10EN_11EN_STEAM static short RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, unsigned char tr, unsigned char tg, unsigned char tb, unsigned char br, unsigned char bg, unsigned char bb, float cx_, float cy, float recipz, float rotation, unsigned char alpha);
SUPPORTED_10EN_11EN_STEAM static int RenderBufferedOneXLUSprite2D(float x, float y, float w, float h, RwRGBA *colour, short intensity, char alpha);
SUPPORTED_10EN_11EN_STEAM static int RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w, float h, RwRGBA* colour, short intensity, float angle, char alpha);
SUPPORTED_10EN_11EN_STEAM static int Set6Vertices2D(RwD3D8Vertex* verts, CRect* rect, unsigned char col1, unsigned char col2, unsigned char col3, unsigned char col4);
SUPPORTED_10EN_11EN_STEAM static int Set6Vertices2D(RwD3D8Vertex* verts, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, unsigned char *c0, unsigned char *c1, unsigned char *c2, unsigned char *c3);
};
#include "meta/meta.CSprite.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CCollision.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CCollision::ProcessLineOfSight)
static int address;
static int global_address;
static const int id = 0x40F910;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x40F910, 0x40F910, 0x40F910>;
// total references count: 10en (4), 11en (4), steam (4)
using refs_t = RefList<
0x40F910, GAME_10EN, H_CALL, 0x40F910, 1,
0x40F910, GAME_11EN, H_CALL, 0x40F910, 1,
0x40F910, GAME_STEAM, H_CALL, 0x40F910, 1>;
using def_t = bool(CColLine const&, CMatrix const&, CColModel&, CColPoint&, float&, bool);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CColLine const&, CMatrix const&, CColModel&, CColPoint&, float&, bool>, 0, 1, 2, 3, 4, 5>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CMatrix.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CVector.h"
#include "RenderWare.h"
class CMatrix {
public:
// RwV3d-like:
CVector right;
unsigned int flags;
CVector up;
unsigned int pad1;
CVector at;
unsigned int pad2;
CVector pos;
unsigned int pad3;
RwMatrix *m_pAttachMatrix;
unsigned int m_bOwnsAttachedMatrix; // do we need to delete attaching matrix at detaching
inline CMatrix() {
this->m_pAttachMatrix = 0;
this->m_bOwnsAttachedMatrix = 0;
}
CMatrix(plugin::dummy_func_t) {}
SUPPORTED_10EN_11EN_STEAM void Attach(RwMatrixTag* rwMatrix, bool deleteOnDetach);
SUPPORTED_10EN_11EN_STEAM void AttachRW(RwMatrixTag* rwMatrix, bool deleteOnDetach);
SUPPORTED_10EN_11EN_STEAM CMatrix(CMatrix const& src);
SUPPORTED_10EN_11EN_STEAM CMatrix(RwMatrixTag* rwMatrix, bool deleteOnDetach);
SUPPORTED_10EN_11EN_STEAM void CopyOnlyMatrix(CMatrix const& src);
SUPPORTED_10EN_11EN_STEAM void Detach();
SUPPORTED_10EN_11EN_STEAM void Reorthogonalise();
SUPPORTED_10EN_11EN_STEAM void SetOrientation(float x,float y,float z);
SUPPORTED_10EN_11EN_STEAM void ResetOrientation();
SUPPORTED_10EN_11EN_STEAM void Rotate(float x, float y, float z);
SUPPORTED_10EN_11EN_STEAM void RotateX(float angle);
SUPPORTED_10EN_11EN_STEAM void RotateZ(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotate(float x, float y, float z);
SUPPORTED_10EN_11EN_STEAM void SetRotateX(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotateXOnly(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotateY(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotateYOnly(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotateZ(float angle);
SUPPORTED_10EN_11EN_STEAM void SetRotateZOnly(float angle);
SUPPORTED_10EN_11EN_STEAM void SetScale(float factor);
SUPPORTED_10EN_11EN_STEAM void SetTranslate(float x, float y, float z);
SUPPORTED_10EN_11EN_STEAM void SetUnity();
SUPPORTED_10EN_11EN_STEAM void Update();
SUPPORTED_10EN_11EN_STEAM void UpdateRW();
SUPPORTED_10EN_11EN_STEAM void operator+=(CMatrix const& right);
SUPPORTED_10EN_11EN_STEAM void operator=(CMatrix const& right);
~CMatrix();
};
VALIDATE_SIZE(CMatrix, 0x48);
SUPPORTED_10EN_11EN_STEAM void Invert(CMatrix const& in, CMatrix&out);
SUPPORTED_10EN_11EN_STEAM CMatrix Invert(CMatrix const& in);
SUPPORTED_10EN_11EN_STEAM CMatrix operator*(CMatrix const& a, CMatrix const& b);
SUPPORTED_10EN_11EN_STEAM CVector operator*(CMatrix const& m, CVector const& v);
SUPPORTED_10EN_11EN_STEAM CVector Multiply3x3(CVector const& v, CMatrix const& m);
SUPPORTED_10EN_11EN_STEAM CVector Multiply3x3(CMatrix const& m, CVector const& v);
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CFont.h
|
<reponame>Lyuu17/plugin_sdk<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CFont::DrawFonts)
static int address;
static int global_address;
static const int id = 0x501B50;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501B50, 0x501C30, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN_OVERLOADED(CFont::GetNextSpace, wchar_t* (*)(const wchar_t*))
static int address;
static int global_address;
static const int id = 0x501960;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501960, 0x501A40, 0>;
using refs_t = RefList<>;
using def_t = wchar_t*(const wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const wchar_t*>, 0>;
META_END
META_BEGIN_OVERLOADED(CFont::GetNumberLines, int(*)(float, float, const wchar_t*))
static int address;
static int global_address;
static const int id = 0x501260;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501260, 0x501340, 0>;
using refs_t = RefList<>;
using def_t = int(float, float, const wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float, const wchar_t*>, 0, 1, 2, 3>;
META_END
META_BEGIN_OVERLOADED(CFont::GetStringWidth, float(*)(const wchar_t*, bool))
static int address;
static int global_address;
static const int id = 0x5018A0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5018A0, 0x501980, 0>;
using refs_t = RefList<>;
using def_t = float(const wchar_t*, bool);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const wchar_t*, bool>, 0, 1>;
META_END
META_BEGIN_OVERLOADED(CFont::GetTextRect, CRect* (*)(CRect*, float, float, const wchar_t*))
static int address;
static int global_address;
static const int id = 0x5013B0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5013B0, 0x501490, 0>;
using refs_t = RefList<>;
using def_t = CRect*(CRect*, float, float, const wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CRect*, float, float, const wchar_t*>, 0, 1, 2, 3>;
META_END
META_BEGIN(CFont::InitPerFrame)
static int address;
static int global_address;
static const int id = 0x500BE0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x500BE0, 0x500CC0, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::Initialise)
static int address;
static int global_address;
static const int id = 0x500A40;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x500A40, 0x500B20, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN_OVERLOADED(CFont::ParseToken, wchar_t*(*)(wchar_t*))
static int address;
static int global_address;
static const int id = 0x5019A0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5019A0, 0x501A80, 0>;
using refs_t = RefList<>;
using def_t = wchar_t*(wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<wchar_t*>, 0>;
META_END
META_BEGIN_OVERLOADED(CFont::PrintChar, void(*)(float, float, short))
static int address;
static int global_address;
static const int id = 0x500C30;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x500C30, 0x500D10, 0>;
using refs_t = RefList<>;
using def_t = void*(float, float, short);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float, short>, 0, 1, 2>;
META_END
META_BEGIN_OVERLOADED(CFont::PrintString, void(*)(float, float, const wchar_t*))
static int address;
static int global_address;
static const int id = 0x500F50;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x500F50, 0x501030, 0>;
using refs_t = RefList<>;
using def_t = void*(float, float, const wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float, short>, 0, 1, 2>;
META_END
META_BEGIN_OVERLOADED(CFont::PrintString, void(*)(float, float, const wchar_t*, const wchar_t*, float))
static int address;
static int global_address;
static const int id = 0x501730;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501730, 0x501810, 0>;
using refs_t = RefList<>;
using def_t = void*(float, float, const wchar_t*, const wchar_t*, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float, const wchar_t*, const wchar_t*, float>, 0, 1, 2, 3, 4>;
META_END
META_BEGIN(CFont::SetAlphaFade)
static int address;
static int global_address;
static const int id = 0x501DD0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501DD0, 0x501EB0, 0>;
using refs_t = RefList<>;
using def_t = void*(float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float>, 0>;
META_END
META_BEGIN(CFont::SetBackGroundOnlyTextOff)
static int address;
static int global_address;
static const int id = 0x501D40;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D40, 0x501E20, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetBackGroundOnlyTextOn)
static int address;
static int global_address;
static const int id = 0x501D30;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D30, 0x501E10, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetBackgroundColor)
static int address;
static int global_address;
static const int id = 0x501D00;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D00, 0x501DE0, 0>;
using refs_t = RefList<>;
using def_t = void(CRGBA);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CRGBA>, 0>;
META_END
META_BEGIN(CFont::SetBackgroundOff)
static int address;
static int global_address;
static const int id = 0x501CF0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501CF0, 0x501DD0, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetBackgroundOn)
static int address;
static int global_address;
static const int id = 0x501CE0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501CE0, 0x501DC0, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetCentreOff)
static int address;
static int global_address;
static const int id = 0x501CB0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501CB0, 0x501D90, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetCentreOn)
static int address;
static int global_address;
static const int id = 0x501C90;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501C90, 0x501D70, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetCentreSize)
static int address;
static int global_address;
static const int id = 0x501CD0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501CD0, 0x501DB0, 0>;
using refs_t = RefList<>;
using def_t = void(float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float>, 0>;
META_END
META_BEGIN(CFont::SetColor)
static int address;
static int global_address;
static const int id = 0x501BD0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501BD0, 0x501CB0, 0>;
using refs_t = RefList<>;
using def_t = void(CRGBA);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CRGBA>, 0>;
META_END
META_BEGIN(CFont::SetDropColor)
static int address;
static int global_address;
static const int id = 0x501DE0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501DE0, 0x501EC0, 0>;
using refs_t = RefList<>;
using def_t = void(CRGBA);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CRGBA>, 0>;
META_END
META_BEGIN(CFont::SetDropShadowPosition)
static int address;
static int global_address;
static const int id = 0x501E70;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501E70, 0x501F50, 0>;
using refs_t = RefList<>;
using def_t = void(short);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<short>, 0>;
META_END
META_BEGIN(CFont::SetFontStyle)
static int address;
static int global_address;
static const int id = 0x501DB0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501DB0, 0x501E90, 0>;
using refs_t = RefList<>;
using def_t = void(short);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<short>, 0>;
META_END
META_BEGIN(CFont::SetJustifyOff)
static int address;
static int global_address;
static const int id = 0x501C80;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501C80, 0x501D60, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetJustifyOn)
static int address;
static int global_address;
static const int id = 0x501C60;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501C60, 0x501D40, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetPropOff)
static int address;
static int global_address;
static const int id = 0x501D90;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D90, 0x501E70, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetPropOn)
static int address;
static int global_address;
static const int id = 0x501DA0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501DA0, 0x501E80, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetRightJustifyOff)
static int address;
static int global_address;
static const int id = 0x501D70;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D70, 0x501E50, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetRightJustifyOn)
static int address;
static int global_address;
static const int id = 0x501D70;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501D50, 0x501E30, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::SetRightJustifyWrap)
static int address;
static int global_address;
static const int id = 0x501DC0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501DC0, 0x501EA0, 0>;
using refs_t = RefList<>;
using def_t = void(float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float>, 0>;
META_END
META_BEGIN(CFont::SetScale)
static int address;
static int global_address;
static const int id = 0x501B80;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501B80, 0x501C60, 0>;
using refs_t = RefList<>;
using def_t = void(float, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float>, 0, 1>;
META_END
META_BEGIN(CFont::SetSlant)
static int address;
static int global_address;
static const int id = 0x501BC0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501BC0, 0x501CA0, 0>;
using refs_t = RefList<>;
using def_t = void(float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float>, 0>;
META_END
META_BEGIN(CFont::SetSlantRefPoint)
static int address;
static int global_address;
static const int id = 0x501BC0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501BC0, 0x501C80, 0>;
using refs_t = RefList<>;
using def_t = void(float, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float, float>, 0, 1>;
META_END
META_BEGIN(CFont::SetWrapx)
static int address;
static int global_address;
static const int id = 0x501CC0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501CC0, 0x501DA0, 0>;
using refs_t = RefList<>;
using def_t = void(float, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<float>, 0>;
META_END
META_BEGIN(CFont::Shutdown)
static int address;
static int global_address;
static const int id = 0x500BA0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x500BA0, 0x500C80, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFont::character_code)
static int address;
static int global_address;
static const int id = 0x501E80;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x501E80, 0x501F60, 0>;
using refs_t = RefList<>;
using def_t = short(unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<unsigned char>, 0>;
META_END
META_BEGIN(AsciiToUnicode)
static int address;
static int global_address;
static const int id = 0x5009C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5009C0, 0x500AA0, 0>;
using refs_t = RefList<>;
using def_t = void(char const*, wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*, wchar_t*>, 0, 1>;
META_END
META_BEGIN(UnicodeStrlen)
static int address;
static int global_address;
static const int id = 0x5009C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5009C0, 0x500B00, 0>;
using refs_t = RefList<>;
using def_t = int(wchar_t const*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<wchar_t const*>, 0>;
META_END
META_BEGIN(UnicodeToAscii)
static int address;
static int global_address;
static const int id = 0x5009C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5009C0, 0x52C530, 0>;
using refs_t = RefList<>;
using def_t = char*(wchar_t*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<wchar_t*>, 0>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.cSampleManager.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(cSampleManager::SetStreamedVolumeAndPan)
static int address;
static int global_address;
static const int id = 0x5681D0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5681D0, 0x568520, 0>;
using refs_t = RefList<>;
using def_t = void(unsigned char, unsigned char, unsigned char, unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char, unsigned char, unsigned char, unsigned char>, 0, 1, 2, 3>;
META_END
META_BEGIN(cSampleManager::StartPreloadedStreamedFile)
static int address;
static int global_address;
static const int id = 0x567D60;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x567D60, 0x5680B0, 0>;
using refs_t = RefList<>;
using def_t = void(unsigned char, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char, int>, 0, 1>;
META_END
META_BEGIN(cSampleManager::StartStreamedFile)
static int address;
static int global_address;
static const int id = 0x567D80;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x567D80, 0x5680D0, 0>;
using refs_t = RefList<>;
using def_t = bool(unsigned char, unsigned int, unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char, unsigned int, unsigned char>, 0, 1, 2>;
META_END
META_BEGIN(cSampleManager::StopStreamedFile)
static int address;
static int global_address;
static const int id = 0x5680E0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5680E0, 0x568430, 0>;
using refs_t = RefList<>;
using def_t = void(unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char>, 0>;
META_END
META_BEGIN(cSampleManager::IsStreamPlaying)
static int address;
static int global_address;
static const int id = 0x568290;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x568290, 0x5685E0, 0>;
using refs_t = RefList<>;
using def_t = bool(unsigned char);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned char>, 0>;
META_END
META_BEGIN(cSampleManager::GetSampleBaseFrequency)
static int address;
static int global_address;
static const int id = 0x5685E0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5672A0, 0X5675F0, 0X5674F0>;
using refs_t = RefList<>;
using def_t = int(unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned int>, 0>;
META_END
META_BEGIN(cSampleManager::GetSampleLoopStartOffset)
static int address;
static int global_address;
static const int id = 0x5672C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5672C0, 0X567610, 0x567510>;
using refs_t = RefList<>;
using def_t = int(unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned int>, 0>;
META_END
META_BEGIN(cSampleManager::GetSampleLoopEndOffset)
static int address;
static int global_address;
static const int id = 0x5672E0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5672E0, 0x567630, 0x567530>;
using refs_t = RefList<>;
using def_t = int(unsigned int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<unsigned int>, 0>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CRegisteredCorona.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CVector.h"
class CRegisteredCorona {
public:
int m_nUniqueID;
int m_nLastLOScheck;
RwTexture *m_pTexture;
RwRGBA m_Color;
char m_nFadeState;
CVector m_vPosn;
float m_fSize;
float normalAngle;
bool m_bRegisteredThisFrame;
float m_fDrawDist;
char m_nFlareType;
char m_nReflection;
unsigned char LOScheck : 1;
unsigned char offScreen : 1;
unsigned char firstUpdate : 1;
unsigned char drawStreak : 1;
unsigned char sightClear : 1;
bool renderReflection;
float heightAboveRoad;
float prevX[6];
float prevY[6];
unsigned char prevRed[6];
unsigned char prevGreen[6];
unsigned char prevBlue[6];
bool hasValue[6];
//funcs
void Update();
CRegisteredCorona();
};
VALIDATE_SIZE(CRegisteredCorona, 0x80);
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CFileMgr.h
|
<reponame>Lyuu17/plugin_sdk<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CFileMgr::Initialise)
static int address;
static int global_address;
static const int id = 0x478F80;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x478F80, 0x478F80, 0x478F80>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFileMgr::ChangeDir)
static int address;
static int global_address;
static const int id = 0x478FB0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x478FB0, 0x478FB0, 0x478FB0>;
using refs_t = RefList<>;
using def_t = void(char const*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*>, 0>;
META_END
META_BEGIN(CFileMgr::SetDir)
static int address;
static int global_address;
static const int id = 0x479020;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479020, 0x479020, 0x479020>;
using refs_t = RefList<>;
using def_t = void(char const*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*>, 0>;
META_END
META_BEGIN(CFileMgr::SetDirMyDocuments)
static int address;
static int global_address;
static const int id = 0x479080;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479080, 0x479080, 0x479080>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CFileMgr::LoadTextFile)
static int address;
static int global_address;
static const int id = 0x479090;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479090, 0x479090, 0x479090>;
using refs_t = RefList<>;
using def_t = FILESTREAM(char const*, unsigned char*, int, char const*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*, unsigned char*, int, char const*>, 0, 1, 2, 3>;
META_END
META_BEGIN(CFileMgr::OpenFile)
static int address;
static int global_address;
static const int id = 0x479100;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479100, 0x479100, 0x479100>;
using refs_t = RefList<>;
using def_t = FILESTREAM(char const*, char const *);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*, char const*>, 0, 1>;
META_END
META_BEGIN(CFileMgr::OpenFileForWriting)
static int address;
static int global_address;
static const int id = 0x479120;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479120, 0x479120, 0x479120>;
using refs_t = RefList<>;
using def_t = FILESTREAM(char const*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*>, 0>;
META_END
META_BEGIN(CFileMgr::Read)
static int address;
static int global_address;
static const int id = 0x479140;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479140, 0x479140, 0x479140>;
using refs_t = RefList<>;
using def_t = int(FILESTREAM, char*, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM, char*, int>, 0, 1, 2>;
META_END
META_BEGIN(CFileMgr::Write)
static int address;
static int global_address;
static const int id = 0x479160;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479160, 0x479160, 0x479160>;
using refs_t = RefList<>;
using def_t = int(FILESTREAM, char*, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM, char*, int>, 0, 1, 2>;
META_END
META_BEGIN(CFileMgr::Seek)
static int address;
static int global_address;
static const int id = 0x479180;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479180, 0x479180, 0x479180>;
using refs_t = RefList<>;
using def_t = bool(FILESTREAM, int, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM, int, int>, 0, 1, 2>;
META_END
META_BEGIN(CFileMgr::ReadLine)
static int address;
static int global_address;
static const int id = 0x4791D0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4791D0, 0x4791D0, 0x4791D0>;
using refs_t = RefList<>;
using def_t = bool(FILESTREAM, char*, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM, char*, int>, 0, 1, 2>;
META_END
META_BEGIN(CFileMgr::CloseFile)
static int address;
static int global_address;
static const int id = 0x479200;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479200, 0x479200, 0x479200>;
using refs_t = RefList<>;
using def_t = int(FILESTREAM);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM>, 0>;
META_END
META_BEGIN(CFileMgr::GetErrorReadWrite)
static int address;
static int global_address;
static const int id = 0x479210;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x479210, 0x479210, 0x479210>;
using refs_t = RefList<>;
using def_t = int(FILESTREAM);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<FILESTREAM>, 0>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CTempColModels.h
|
<reponame>Lyuu17/plugin_sdk<filename>plugin_III/game_III/CTempColModels.h<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CColModel.h"
class CTempColModels
{
public:
static CColModel &ms_colModelPedGroundHit;
};
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CModelInfo.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CBaseModelInfo.h"
#include "CSimpleModelInfo.h"
#include "CVehicleModelInfo.h"
#include "CMloModelInfo.h"
#include "CTimeModelInfo.h"
#include "CPedModelInfo.h"
#include "CXtraCompsModelInfo.h"
#include "C2deffectsModelInfo.h"
#include "CClumpModelInfo.h"
#include "eLevelName.h"
#include "CInstance.h"
#include "CVehicle.h"
class PLUGIN_API CModelInfo {
public:
// variables
SUPPORTED_10EN_11EN_STEAM static CBaseModelInfo **ms_modelInfoPtrs;
SUPPORTED_10EN_11EN_STEAM static XtraCompsModelStore* ms_xtraCompsModelStore; // [2]
SUPPORTED_10EN_11EN_STEAM static MloInstanceStore* ms_mloInstanceStore; // [1]
SUPPORTED_10EN_11EN_STEAM static EffectStore* ms_2dEffectStore; // [2000]
SUPPORTED_10EN_11EN_STEAM static ClumpModelStore* ms_clumpModelStore; // [5]
SUPPORTED_10EN_11EN_STEAM static MloModelStore* ms_mloModelStore; // [1]
SUPPORTED_10EN_11EN_STEAM static PedModelStore* ms_pedModelStore; // [90]
SUPPORTED_10EN_11EN_STEAM static SimpleModelStore* ms_simpleModelStore; // [5000]
SUPPORTED_10EN_11EN_STEAM static TimeModelStore* ms_timeModelStore; // [30]
SUPPORTED_10EN_11EN_STEAM static VehicleModelStore* ms_vehicleModelStore; // [120]
//funcs
SUPPORTED_10EN_11EN_STEAM static CClumpModelInfo* AddClumpModel(int index);
SUPPORTED_10EN_11EN_STEAM static CMloModelInfo* AddMloModel(int index);
SUPPORTED_10EN_11EN_STEAM static CPedModelInfo* AddPedModel(int index);
SUPPORTED_10EN_11EN_STEAM static CSimpleModelInfo* AddSimpleModel(int index);
SUPPORTED_10EN_11EN_STEAM static CTimeModelInfo* AddTimeModel(int index);
SUPPORTED_10EN_11EN_STEAM static CVehicleModelInfo* AddVehicleModel(int index);
SUPPORTED_10EN_11EN_STEAM static void ConstructMloClumps();
SUPPORTED_10EN_11EN_STEAM static EffectStore* Get2dEffectStore();
SUPPORTED_10EN_11EN_STEAM static MloInstanceStore* GetMloInstanceStore();
SUPPORTED_10EN_11EN_STEAM static CBaseModelInfo* GetModelInfo(char const* name, int* index);
SUPPORTED_10EN_11EN_STEAM static void Initialise();
SUPPORTED_10EN_11EN_STEAM static bool IsBoatModel(int index);
SUPPORTED_10EN_11EN_STEAM static void ReInit2dEffects();
SUPPORTED_10EN_11EN_STEAM static void RemoveColModelsFromOtherLevels(eLevelName levelName);
SUPPORTED_10EN_11EN_STEAM static void ShutDown();
static inline CBaseModelInfo *GetModelInfo(int index) {
return ms_modelInfoPtrs[index];
}
static inline bool IsPedModel(int index) {
return (ms_modelInfoPtrs[index] && ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_PED);
}
static inline bool IsCarModel(int index) {
return (ms_modelInfoPtrs[index] && ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_VEHICLE && reinterpret_cast<CVehicleModelInfo *>(ms_modelInfoPtrs[index])->m_nVehicleType == VEHICLE_AUTOMOBILE);
}
static inline bool IsTrainModel(int index) {
return (ms_modelInfoPtrs[index] && ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_VEHICLE && reinterpret_cast<CVehicleModelInfo *>(ms_modelInfoPtrs[index])->m_nVehicleType == VEHICLE_TRAIN);
}
static inline bool IsHeliModel(int index) {
return (ms_modelInfoPtrs[index] && ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_VEHICLE && reinterpret_cast<CVehicleModelInfo *>(ms_modelInfoPtrs[index])->m_nVehicleType == VEHICLE_HELI);
}
static inline bool IsPlaneModel(int index) {
return (ms_modelInfoPtrs[index] && ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_VEHICLE && reinterpret_cast<CVehicleModelInfo *>(ms_modelInfoPtrs[index])->m_nVehicleType == VEHICLE_PLANE);
}
// return -1 if model is not a vehicle model otherwise returns vehicle model type
// 0 - car, 1 - boat, 2 - train, 3 - heli, 4 - plane
static inline int IsVehicleModelType(int index) {
int result;
if (index < 5500 && ms_modelInfoPtrs[index]) {
if (ms_modelInfoPtrs[index]->m_nType == MODEL_INFO_VEHICLE)
result = reinterpret_cast<CVehicleModelInfo *>(ms_modelInfoPtrs[index])->m_nVehicleType;
else
result = -1;
}
else
result = -1;
return result;
}
};
#include "meta/meta.CModelInfo.h"
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CModelInfo.h
|
<gh_stars>0
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CModelInfo::AddClumpModel)
static int address;
static int global_address;
static const int id = 0x50BA10;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BA10, 0x50BB00, 0x50BA90>;
using refs_t = RefList<>;
using def_t = CClumpModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::AddMloModel)
static int address;
static int global_address;
static const int id = 0x50B970;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B970, 0x50BA60, 0x50B9F0>;
using refs_t = RefList<>;
using def_t = CMloModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::AddPedModel)
static int address;
static int global_address;
static const int id = 0x50BAD0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BAD0, 0x50BBC0, 0x50BB50>;
using refs_t = RefList<>;
using def_t = CPedModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::AddSimpleModel)
static int address;
static int global_address;
static const int id = 0x50B920;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B920, 0x50BA10, 0x50B9A0>;
using refs_t = RefList<>;
using def_t = CSimpleModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::AddTimeModel)
static int address;
static int global_address;
static const int id = 0x50B9C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B9C0, 0x50BAB0, 0x50BA40>;
using refs_t = RefList<>;
using def_t = CTimeModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::AddVehicleModel)
static int address;
static int global_address;
static const int id = 0x50BA60;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BA60, 0x50BB50, 0x50BAE0>;
using refs_t = RefList<>;
using def_t = CVehicleModelInfo*(int index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::ConstructMloClumps)
static int address;
static int global_address;
static const int id = 0x50BB40;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BB40, 0x50BC30, 0x50BBC0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CModelInfo::Get2dEffectStore)
static int address;
static int global_address;
static const int id = 0x50BB30;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BB30, 0x50BC20, 0x50BBB0>;
using refs_t = RefList<>;
using def_t = EffectStore*();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CModelInfo::GetMloInstanceStore)
static int address;
static int global_address;
static const int id = 0x50BB30;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BB20, 0x50BC10, 0x50BBA0>;
using refs_t = RefList<>;
using def_t = MloInstanceStore*();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN_OVERLOADED(CModelInfo::GetModelInfo, CBaseModelInfo*(*)(char const*, int*))
static int address;
static int global_address;
static const int id = 0x50BB30;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BB30, 0x50B950, 0x50B8E0>;
using refs_t = RefList<>;
using def_t = CBaseModelInfo*(char const* name, int* index);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char const*, int*>, 0, 1>;
META_END
META_BEGIN(CModelInfo::Initialise)
static int address;
static int global_address;
static const int id = 0x50B310;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B310, 0x50B3F0, 0x50B380>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CModelInfo::IsBoatModel)
static int address;
static int global_address;
static const int id = 0x50BB90;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BB90, 0x50BC80, 0x50BC10>;
using refs_t = RefList<>;
using def_t = bool(int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int>, 0>;
META_END
META_BEGIN(CModelInfo::ReInit2dEffects)
static int address;
static int global_address;
static const int id = 0x50B580;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B580, 0x50B660, 0x50B5F0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CModelInfo::RemoveColModelsFromOtherLevels)
static int address;
static int global_address;
static const int id = 0x50BBC0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50BBC0, 0x50BCB0, 0x50BC40>;
using refs_t = RefList<>;
using def_t = void(eLevelName);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<eLevelName>, 0>;
META_END
META_BEGIN(CModelInfo::ShutDown)
static int address;
static int global_address;
static const int id = 0x50B5B0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x50B5B0, 0x50B690, 0x50B620>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CWeaponInfo.h
|
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
CTOR_META_BEGIN(CWeaponInfo)
static int address;
static int global_address;
static const int id = 0x5654F0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5654F0, 0x5655D0, 0x565580>;
using refs_t = RefList<>;
using def_t = void*(CWeaponInfo *);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Thiscall;
using args_t = ArgPick<ArgTypes<CWeaponInfo*>, 0>;
META_END
META_BEGIN(CWeaponInfo::FindWeaponFireType)
static int address;
static int global_address;
static const int id = 0x5653E0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5653E0, 0x565110, 0x5654D0>;
using refs_t = RefList<>;
using def_t = eWeaponFire(char*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char*>, 0>;
META_END
META_BEGIN(CWeaponInfo::FindWeaponType)
static int address;
static int global_address;
static const int id = 0x5653B0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x5653B0, 0x5654F0, 0x5654A0>;
using refs_t = RefList<>;
using def_t = eWeaponType(eWeaponType*, char*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<char*>, 0>;
META_END
META_BEGIN(CWeaponInfo::GetWeaponInfo)
static int address;
static int global_address;
static const int id = 0x564FD0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x564FD0, 0x565110, 0x5650C0>;
using refs_t = RefList<>;
using def_t = CWeaponInfo*(eWeaponType*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<eWeaponType*>, 0>;
META_END
META_BEGIN(CWeaponInfo::Initialise)
static int address;
static int global_address;
static const int id = 0x564EA0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x564EA0, 0x564FE0, 0x564F90>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CWeaponInfo::LoadWeaponData)
static int address;
static int global_address;
static const int id = 0x564FE0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x564FE0, 0x565120, 0x5650D0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CWeaponInfo::Shutdown)
static int address;
static int global_address;
static const int id = 0x564FB0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x564FB0, 0x5650F0, 0x5650A0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
}
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/CCamera.h
|
<filename>plugin_III/game_III/CCamera.h
/*
Plugin-SDK (Grand Theft Auto 3) source file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
#include "CPlaceable.h"
#include "CGarage.h"
#include "CCam.h"
#include "CQueuedMode.h"
#include "CPathSplines.h"
#include "CTrainCamNode.h"
#pragma pack(push, 4)
class CCamera : CPlaceable {
public:
bool m_bAboveGroundTrainNodesLoaded;
bool m_bBelowGroundTrainNodesLoaded;
bool m_bCamDirectlyBehind;
bool m_bCamDirectlyInFront;
bool m_bCameraJustRestored;
bool m_bCutsceneFinished;
bool m_bCullZoneChecksOn;
bool m_bFirstPersonBeingUsed;
bool m_bJustJumpedOutOf1stPersonBecauseOfTarget;
bool m_bIdleOn;
bool m_bInATunnelAndABigVehicle;
bool m_bInitialNodeFound;
bool m_bInitialNoNodeStaticsSet;
bool m_bIgnoreFadingStuffForMusic;
bool m_bPlayerIsInGarage;
bool m_bJustCameOutOfGarage;
bool m_bJustInitalised;
bool m_bJust_Switched;
bool m_bLookingAtPlayer;
bool m_bLookingAtVector;
bool m_bMoveCamToAvoidGeom;
bool m_bObbeCinematicPedCamOn;
bool m_bObbeCinematicCarCamOn;
bool m_bRestoreByJumpCut;
bool m_bUseNearClipScript;
bool m_bStartInterScript;
bool m_bStartingSpline;
bool m_bTargetJustBeenOnTrain;
bool m_bTargetJustCameOffTrain;
bool m_bUseSpecialFovTrain;
bool m_bUseTransitionBeta;
bool m_bUseScriptZoomValuePed;
bool m_bUseScriptZoomValueCar;
bool m_bWaitForInterpolToFinish;
bool m_bItsOkToLookJustAtThePlayer;
bool m_bWantsToSwitchWidescreenOff;
bool m_bWideScreenOn;
bool m_b1rstPersonRunCloseToAWall;
bool m_bHeadBob;
bool m_bFailedCullZoneTestPreviously;
bool m_bFadeTargetIsSplashScreen;
bool m_bWorldViewerBeingUsed;
unsigned char m_nActiveCam;
//char _pad77;
unsigned int m_nCamShakeStart;
unsigned int m_nFirstPersonCamLastInputTime;
unsigned int m_nLongestTimeInMill;
unsigned int m_nNumberOfTrainCamNodes;
bool m_bTransitionJUSTStarted;
unsigned char m_bTransitionState;
//char _pad8A[2];
unsigned int m_nTimeLastChange;
unsigned int m_nTimeWeLeftIdle_StillNoInput;
unsigned int m_nTimeTransitionStart;
unsigned int m_nTransitionDuration;
unsigned int m_nBlurBlue;
unsigned int m_nBlurGreen;
unsigned int m_nBlurRed;
unsigned int m_nBlurType;
int dwordAC;
unsigned int m_nWorkOutSpeedThisNumFrames;
unsigned int m_nNumFramesSoFar;
unsigned int m_nCurrentTrainCamNode;
unsigned int m_nMotionBlur;
unsigned int m_nMotionBlurAlpha;
int m_nCheckCullZoneThisNumFrames;
int m_nZoneCullFrameNumWereAt;
unsigned int m_nWhoIsInControlOfTheCamera;
float m_fCamFrontXNorm;
float m_fCamFrontYNorm;
float m_fCarZoomIndicator;
float m_fCarZoomValue;
float m_fCarZoomValueSmooth;
float m_fDistanceToWater;
float m_fFOVDuringInter;
float m_fLODDistMultiplier;
float m_fGenerationDistMultiplier;
float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol;
float m_fBetaDuringInterPol;
float m_fBetaSpeedAtStartInter;
float m_fBetaWhenInterPol;
float m_fFOVWhenInterPol;
float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol;
float m_fPedOrientForBehindOrInFront;
float m_fCameraAverageSpeed;
float m_fCameraSpeedSoFar;
float m_fCamShakeForce;
float m_fCarZoomValueScript;
float m_fFovForTrain;
float m_fFOV_Wide_Screen;
float m_fNearScreenScript;
float m_fOldBetaDiff;
float m_fPedZoomValue;
float m_fPedZoomValueSmooth;
float m_fPedZoomValueScript;
float m_fPositionAlongSpline;
float m_fScreenReductionPercentage;
float m_fScreenReductionSpeed;
float m_fAlphaForPlayerAnim1rstPerson;
float m_fOrientation;
float m_fPedZoomIndicator;
float m_fPlayerExhaustion;
float m_fSoundDistUp;
float field_16C;
float field_170;
float m_fSoundDistUpAsRead;
float field_178;
float field_17C;
float m_fSoundDistUpAsReadOld;
float field_184;
float field_188;
float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol;
float m_fMouseAccelHorzntal;
float m_fMouseAccelVertical;
float m_f3rdPersonCHairMultX;
float m_f3rdPersonCHairMultY;
CCam m_asCams[3];
CGarage *m_pGaragePlayer;
CVehicle *m_pGarageVehicle;
CQueuedMode m_PlayerMode;
CQueuedMode m_playerWeaponMode;
CVector m_vecPreviousCameraPosition;
CVector m_vecRealPreviousCameraPosition;
CVector m_vecAimingTargetCoors;
CVector m_vecFixedModeVector;
CVector m_vecFixedModeSource;
CVector m_vecFixedModeUpOffSet;
CVector m_vCamCutSceneOffset;
CVector m_vecStartingSourceForInterPol;
CVector m_vecStartingTargetForInterPol;
CVector m_vecStartingUpForInterPol;
CVector m_vecSourceSpeedOverOneFrame;
CVector m_vecTargetSpeedOverOneFrame;
CVector m_vecUpOverOneFrame;
CVector m_vecSourceWhenInterPol;
CVector m_vecUpWhenInterPol;
CVector m_vecClearGeometryVec;
CVector m_vecGameCamPos;
CVector m_vecSourceDuringInter;
CVector m_vecTargetDuringInter;
CVector m_vecUpDuringInter;
RwCamera *m_pRwCamera;
CEntity *m_pTargetEntity;
CPathSplines m_aPathSplines[4];
CTrainCamNode m_asTrainCamNodes[800];
CMatrix m_mMatInverse;
bool m_bGarageFixedCamPositionSet;
bool m_bDoingSpecialInterPolation;
bool m_bScriptParametersSetForInterPol;
bool m_bFading;
bool m_bMusicFading;
//char _padE8F5[3];
CMatrix m_mViewMatrix;
CVector m_avecFrustumNormals[4];
CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter;
float m_fOldFOVForInter;
float m_fFadeAlpha;
float m_fEffectsFaderScalingFactor;
float m_fFadeDuration;
float m_fTimeToFadeMusic;
float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUp;
float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;
unsigned int m_nScriptTimeForInterPolation;
unsigned short m_nFadeInOutFlag;
//short _padE9C2;
int m_nModeObbeCamIsInForCar;
short m_nModeToGoTo;
short m_nMusicFadingDirection;
short m_nTypeOfSwitch;
//short _padE9CE;
unsigned int m_nFadeStartTime;
unsigned int m_nTimeToWaitToFadeMusic;
//static
static bool& m_bUseMouse3rdPerson;
//funcs
float Find3rdPersonQuickAimPitch();
};
#pragma pack(pop)
extern CCamera &TheCamera;
VALIDATE_SIZE(CCamera, 0xE9D8);
|
Lyuu17/plugin_sdk
|
plugin_III/game_III/meta/meta.CAnimManager.h
|
<filename>plugin_III/game_III/meta/meta.CAnimManager.h
/*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "PluginBase.h"
namespace plugin {
META_BEGIN(CAnimManager::Initialise)
static int address;
static int global_address;
static const int id = 0x403380;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403380, 0x403380, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CAnimManager::Shutdown)
static int address;
static int global_address;
static const int id = 0x4033B0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4033B0, 0x4033B0, 0>;
using refs_t = RefList<>;
using def_t = void();
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN(CAnimManager::UncompressAnimation)
static int address;
static int global_address;
static const int id = 0x403410;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403410, 0x403410, 0>;
using refs_t = RefList<>;
using def_t = void(CAnimBlendHierarchy*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<CAnimBlendHierarchy*>, 0>;
META_END
META_BEGIN(CAnimManager::GetAnimationBlock)
static int address;
static int global_address;
static const int id = 0x4034A0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4034A0, 0x4034A0, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlock*(const char*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const char*>, 0>;
META_END
META_BEGIN(CAnimManager::GetAnimation)
static int address;
static int global_address;
static const int id = 0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4034F0, 0x4034F0, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendHierarchy*(const char*, CAnimBlock*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const char*, CAnimBlock*>, 0, 1>;
META_END
META_BEGIN(CAnimManager::GetAnimGroupName)
static int address;
static int global_address;
static const int id = 0x4035B0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4035B0, 0x4035B0, 0>;
using refs_t = RefList<>;
using def_t = const char*(int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const char*>, 0>;
META_END
META_BEGIN(CAnimManager::CreateAnimAssociation)
static int address;
static int global_address;
static const int id = 0x4035C0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4035C0, 0x4035C0, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(int, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int, int>, 0, 1>;
META_END
META_BEGIN_OVERLOADED(CAnimManager::GetAnimAssociation, CAnimBlendAssociation*(*)(int, int))
static int address;
static int global_address;
static const int id = 0x4035E0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4035E0, 0x4035E0, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(int, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int, int>, 0, 1>;
META_END
META_BEGIN_OVERLOADED(CAnimManager::GetAnimAssociation, CAnimBlendAssociation*(*)(int, const char*))
static int address;
static int global_address;
static const int id = 0x403600;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403600, 0x403600, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(int, const char*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int, const char*>, 0, 1>;
META_END
META_BEGIN(CAnimManager::AddAnimation)
static int address;
static int global_address;
static const int id = 0x403620;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403620, 0x403620, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(RpClump*, int, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<RpClump*, int, int>, 0, 1, 2>;
META_END
META_BEGIN(CAnimManager::AddAnimationAndSync)
static int address;
static int global_address;
static const int id = 0x4036A0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4036A0, 0x4036A0, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(RpClump*, CAnimBlendAssociation*, int, int);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<RpClump*, CAnimBlendAssociation*, int, int>, 0, 1, 2, 3>;
META_END
META_BEGIN(CAnimManager::BlendAnimation)
static int address;
static int global_address;
static const int id = 0x403710;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403710, 0x403710, 0>;
using refs_t = RefList<>;
using def_t = CAnimBlendAssociation*(RpClump*, int, int, float);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<RpClump*, int, int, float>, 0, 1, 2, 3>;
META_END
META_BEGIN(CAnimManager::LoadAnimFiles)
static int address;
static int global_address;
static const int id = 0x4038F0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x4038F0, 0x4038F0, 0>;
using refs_t = RefList<>;
using def_t = void(void);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
META_BEGIN_OVERLOADED(CAnimManager::LoadAnimFile, void(*)(const char*))
static int address;
static int global_address;
static const int id = 0x403A10;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403A10, 0x403A10, 0>;
using refs_t = RefList<>;
using def_t = void(const char*);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<const char*>, 0>;
META_END
META_BEGIN_OVERLOADED(CAnimManager::LoadAnimFile, void(*)(int, bool))
static int address;
static int global_address;
static const int id = 0x403A40;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x403A40, 0x403A40, 0>;
using refs_t = RefList<>;
using def_t = void(int, bool);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<int, bool>, 0, 1>;
META_END
META_BEGIN(CAnimManager::RemoveLastAnimFile)
static int address;
static int global_address;
static const int id = 0;
static const bool is_virtual = false;
static const int vtable_index = -1;
using mv_addresses_t = MvAddresses<0x404320, 0x404320, 0>;
using refs_t = RefList<>;
using def_t = void(void);
static const int cb_priority = PRIORITY_BEFORE;
using calling_convention_t = CallingConventions::Cdecl;
using args_t = ArgPick<ArgTypes<>>;
META_END
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.