engine: reject mbf21 and shit24 wads. there is no way to know if it is safe to ignore...
[k8vavoom.git] / vccrun / vcc_run.h
blobfccc84a330dc38e240cd3349d33d3bdb5d0ff632
1 //**************************************************************************
2 //**
3 //** ## ## ## ## ## #### #### ### ###
4 //** ## ## ## ## ## ## ## ## ## ## #### ####
5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ##
6 //** ## ## ######## ## ## ## ## ## ## ## ### ##
7 //** ### ## ## ### ## ## ## ## ## ##
8 //** # ## ## # #### #### ## ##
9 //**
10 //** Copyright (C) 1999-2006 Jānis Legzdiņš
11 //** Copyright (C) 2018-2023 Ketmar Dark
12 //**
13 //** This program is free software: you can redistribute it and/or modify
14 //** it under the terms of the GNU General Public License as published by
15 //** the Free Software Foundation, version 3 of the License ONLY.
16 //**
17 //** This program is distributed in the hope that it will be useful,
18 //** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 //** GNU General Public License for more details.
21 //**
22 //** You should have received a copy of the GNU General Public License
23 //** along with this program. If not, see <http://www.gnu.org/licenses/>.
24 //**
25 //**************************************************************************
26 #ifndef VCCRUN_HEADER_FILE
27 #define VCCRUN_HEADER_FILE
29 #include <stdio.h>
31 //#include "../libs/core/core.h"
33 //#define Random() ((float)(rand()&0x7fff)/(float)0x8000)
35 float Random () {
36 unsigned int rn;
37 ed25519_randombytes(&rn, sizeof(rn));
38 fprintf(stderr, "rn=0x%08x\n", rn);
39 return (rn&0x3ffff)/(float)0x3ffff;
44 //#define OPCODE_STATS
46 //#include "convars.h"
47 //#include "filesys/fsys.h"
49 //#include "vcc_netobj.h"
50 #include "vcc_run_vc.h"
51 #include "../libs/vavoomc/vc_public.h"
52 #include "../source/utils/scripts.h"
53 //#include "../source/utils/misc.h"
56 //extern VStream *OpenFile (const VStr &Name);
59 // callback should be thread-safe (it may be called from several different threads)
60 // event handler *SHOULD* call `sockmodAckEvent()` for each such event with appropriate flags
61 // calls should be made in order
62 //extern void (*sockmodPostEventCB) (int code, int sockid, int data);
64 // this callback will be called... ah, see above
65 void sockmodAckEvent (int code, int sockid, int data, bool eaten, bool cancelled);
68 // called to notify `VCC_WaitEvent()` that some new event was posted
69 // if you will called this WITHOUT events in the queue, the event loop *MAY* abort with fatal error
70 typedef void (*VCC_PingEventLoopFn) ();
71 extern VCC_PingEventLoopFn VCC_PingEventLoop;
73 // if `quitev` is not `nullptr`, it will receive the copy of the `ev_quit` message
74 // returns `data1` of `ev_quit`
75 int VCC_RunEventLoop (event_t *quitev);
78 // `exitcode` will be put to `data1`
79 extern void PostQuitEvent (int exitcode);
82 // should wait for incoming events, and them into queue
83 typedef void (*VCC_WaitEventsFn) ();
84 extern VCC_WaitEventsFn VCC_WaitEvents;
87 // process received event, called by the event loop
88 // will stop processing events if the event was eaten or cancelled
89 typedef void (*VCC_ProcessEventFn) (event_t &ev, void *udata);
92 // different `udata` means different handlers!
93 extern void RegisterEventProcessor (VCC_ProcessEventFn handler, void *udata);
94 // `udata` must match!
95 extern void UnregisterEventProcessor (VCC_ProcessEventFn handler, void *udata);
98 // timer API for non-SDL apps
99 // returns timer id, or 0 on error
100 extern int VCC_SetTimer (int mstimeout);
102 // timer API for non-SDL apps
103 // returns timer id, or 0 on error
104 extern int VCC_SetInterval (int mstimeout);
106 extern void VCC_CancelInterval (int iid);
108 #endif