A virtual currency betting bot for Twitch chat. https://ddark.net/better
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
better/src/better_App.h

96 lines
2.1 KiB

#ifndef BETTER_APP_H
#define BETTER_APP_H
#include <cmath>
#include <winsock2.h>
#include <imgui.h>
#include <implot.h>
extern "C"
{
#include <cregex.h>
#include <ost.h>
}
#include "better_Settings.h"
#include "better_IrcMessage.h"
#include "better_ChatEntry.h"
#include "better_BetTable.h"
#include "better_LogEntry.h"
#include "better_UserInfo.h"
#include "better_RingBuffer.h"
void free_indirect(void** p);
struct App
{
WCHAR* base_dir;
size_t base_dir_len;
SOCKET sock = INVALID_SOCKET;
WSADATA wsa_data;
HANDLE dns_req_thread = NULL;
DWORD dns_req_thread_id;
bool joined_channel = false;
cregex_program_t* irc_re = NULL;
RingBuffer<char*, (void(*)(char**))free_indirect> write_queue;
RingBuffer<char*, (void(*)(char**))free_indirect> privmsg_queue;
RingBuffer<IrcMessage, IrcMessage_free_all> read_queue;
struct{char* key; UserInfo* value;}* users = NULL; // string hashmap -- use the `sh` functions from stb_ds to operate on this!
ost leaderboard_tree;
BetTable* bet_options = NULL; // dynamic array
f64 (*bet_history)[TIMELINE_SAMPLE_COUNT] = NULL; // dynamic array
RingBuffer<UserInfo*, NULL> point_feedback_queue;
UserInfo *fish = NULL, *shark = NULL;
u64 fish_loss, shark_win;
HWND main_wnd;
RingBuffer<LogEntry, LogEntry_free> log_buffer;
RingBuffer<ChatEntry, ChatEntry_free> chat_buffer;
bool chat_auto_scroll = true;
bool chat_connected = true;
f32 timer_left = -INFINITY;
bool privmsg_ready = false;
bool allow_auto_reconnect = true;
bool should_focus_log_window = false;
size_t unread_error = -1;
bool log_filter[LOGLEVEL_ENUM_SIZE] =
{
false,
true,
true,
true,
true,
};
void* data_font_normal;
i32 data_size_font_normal;
void* data_font_mono;
i32 data_size_font_mono;
ImFontConfig default_font_config, fa_font_config;
ImFont* font_default;
ImFont* font_mono;
ImFont* font_timer;
bool color_theme_is_dark = true;
Settings settings;
#if BETTER_DEBUG
ost* global_alloc_map = NULL;
#endif
};
#endif // BETTER_APP_H