mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-29 15:12:07 +00:00
22a0949a26
Upgrade to build and run from VS2019 Upgrades to Xcode project and Apple Silicon support Update SDL2 to 2.0.14 Updated SDL2 include files to fix Mac build in GitHub Actions Added another mention of arm64 to command line help Restored original opus sse files, excluded from Xcode Added arm64 to the post-build symlinking step Merge branch 'main' into xcode Merge branch 'main' into vs2019 Added shell script to compile Universal 2 binary (x86_64+arm64) Reverting alert style to deprecated methods Upgrades to Xcode project and Apple Silicon support Update SDL2 to 2.0.14 Added another mention of arm64 to command line help Restored original opus sse files, excluded from Xcode Added arm64 to the post-build symlinking step Added shell script to compile Universal 2 binary (x86_64+arm64) Reverting alert style to deprecated methods Merge branch 'xcode' of https://github.com/tomkidd/ioq3 into xcode Removed signature from SDL dylib, enabled dark mode on macOS. spaces > tabs Ad-hoc signed libSDL2-2.0.0.dylib Fix compiling against SDL 2.0.17 UB2 now signs and notarizes, upgraded to SDL 2.0.16 Architectures in libSDL2 restored for ppc and i386 Merge remote-tracking branch 'upstream/main' into vs2019 Update SDL2 to 2.0.16 Added rudimentary support for automatically finding Microsoft Store version of Quake 3 GHA deprecated Ubuntu 16.04 - update to 18.04 qsort cannot be called with NULL Merge remote-tracking branch 'upstream/main' into vs2019 Addressed string concatenation issue and added dummy method for Mac/Linux Added missing variable. Merge remote-tracking branch 'upstream/main' into xcode Updated SDL 2.0.16 headers and Mac version of libraries to fix GitHub actions Addressed PR suggestions Modified MS Store path handling to better follow the pattern of Steam/GOG Merge pull request #481 from tomkidd/xcode Merge pull request #482 from tomkidd/vs2019 OpenGL2: Fix r_grayscale 1 making everything solid black Print full GL_EXTENSIONS list for OpenGL contexts before 3.0 Fix being unable to enter Team Arena CD key OpenGL2: GL_DEPTH_TEXTURE_MODE was removed from OpenGL 3.0/Core Improve setting Microsoft Store path Update building for macOS in README Make macOS arm64 default to target macOS 11 in Makefile Fix error when cross-compiling for macOS arm64 using Makefile Fix passing arguments to VM dylib on Apple M1 Fix compiling on older macOS Fix memory corruption in S_TransferPaintBuffer Fix memset Fix hex digit Fix uninitialized variable some old URL and doc updates Update README.md Update FUNDING.yml code/curl: update ifdef condition for MCST-LCC compiler in mcst-lcc compiler => 1.25 added a new macro definition to determine compiler Revert "code/curl: update ifdef condition for MCST-LCC compiler" Revert "E2K: fixed build by MCST lcc compiler when using USE_CURL=1 option" More predictable mesh normals generation vm_x86.c: Add `defined(_M_IX86) || defined(_M_X64)` (fix for VS2019) Add keys for SDL 2.0.14's new gamepad buttons Fix in_availableJoysticks cvar not updating Fix (disabled) Wavelet sound decompression Update to SDL 2.24.0 and add separate macOS UB2 dylib Update macOS UB1 to SDL 2.0.22 Fix running make-macosx{,-ub2}.sh on Linux Update MSVC .lib files to SDL 2.24.0
203 lines
4.1 KiB
C
203 lines
4.1 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
|
|
This file is part of Quake III Arena source code.
|
|
|
|
Quake III Arena source code is free software; you can redistribute it
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
or (at your option) any later version.
|
|
|
|
Quake III Arena source code is distributed in the hope that it will be
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Quake III Arena source code; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
#include "q_shared.h"
|
|
#include "qcommon.h"
|
|
|
|
// Max number of arguments to pass from engine to vm's vmMain function.
|
|
// command number + 12 arguments
|
|
#define MAX_VMMAIN_ARGS 13
|
|
|
|
// Max number of arguments to pass from a vm to engine's syscall handler function for the vm.
|
|
// syscall number + 15 arguments
|
|
#define MAX_VMSYSCALL_ARGS 16
|
|
|
|
// don't change, this is hardcoded into x86 VMs, opStack protection relies
|
|
// on this
|
|
#define OPSTACK_SIZE 1024
|
|
#define OPSTACK_MASK (OPSTACK_SIZE-1)
|
|
|
|
// don't change
|
|
// Hardcoded in q3asm a reserved at end of bss
|
|
#define PROGRAM_STACK_SIZE 0x10000
|
|
#define PROGRAM_STACK_MASK (PROGRAM_STACK_SIZE-1)
|
|
|
|
typedef enum {
|
|
OP_UNDEF,
|
|
|
|
OP_IGNORE,
|
|
|
|
OP_BREAK,
|
|
|
|
OP_ENTER,
|
|
OP_LEAVE,
|
|
OP_CALL,
|
|
OP_PUSH,
|
|
OP_POP,
|
|
|
|
OP_CONST,
|
|
OP_LOCAL,
|
|
|
|
OP_JUMP,
|
|
|
|
//-------------------
|
|
|
|
OP_EQ,
|
|
OP_NE,
|
|
|
|
OP_LTI,
|
|
OP_LEI,
|
|
OP_GTI,
|
|
OP_GEI,
|
|
|
|
OP_LTU,
|
|
OP_LEU,
|
|
OP_GTU,
|
|
OP_GEU,
|
|
|
|
OP_EQF,
|
|
OP_NEF,
|
|
|
|
OP_LTF,
|
|
OP_LEF,
|
|
OP_GTF,
|
|
OP_GEF,
|
|
|
|
//-------------------
|
|
|
|
OP_LOAD1,
|
|
OP_LOAD2,
|
|
OP_LOAD4,
|
|
OP_STORE1,
|
|
OP_STORE2,
|
|
OP_STORE4, // *(stack[top-1]) = stack[top]
|
|
OP_ARG,
|
|
|
|
OP_BLOCK_COPY,
|
|
|
|
//-------------------
|
|
|
|
OP_SEX8,
|
|
OP_SEX16,
|
|
|
|
OP_NEGI,
|
|
OP_ADD,
|
|
OP_SUB,
|
|
OP_DIVI,
|
|
OP_DIVU,
|
|
OP_MODI,
|
|
OP_MODU,
|
|
OP_MULI,
|
|
OP_MULU,
|
|
|
|
OP_BAND,
|
|
OP_BOR,
|
|
OP_BXOR,
|
|
OP_BCOM,
|
|
|
|
OP_LSH,
|
|
OP_RSHI,
|
|
OP_RSHU,
|
|
|
|
OP_NEGF,
|
|
OP_ADDF,
|
|
OP_SUBF,
|
|
OP_DIVF,
|
|
OP_MULF,
|
|
|
|
OP_CVIF,
|
|
OP_CVFI
|
|
} opcode_t;
|
|
|
|
|
|
|
|
typedef int vmptr_t;
|
|
|
|
typedef struct vmSymbol_s {
|
|
struct vmSymbol_s *next;
|
|
int symValue;
|
|
int profileCount;
|
|
char symName[1]; // variable sized
|
|
} vmSymbol_t;
|
|
|
|
#define VM_OFFSET_PROGRAM_STACK 0
|
|
#define VM_OFFSET_SYSTEM_CALL 4
|
|
|
|
struct vm_s {
|
|
// DO NOT MOVE OR CHANGE THESE WITHOUT CHANGING THE VM_OFFSET_* DEFINES
|
|
// USED BY THE ASM CODE
|
|
int programStack; // the vm may be recursively entered
|
|
intptr_t (*systemCall)( intptr_t *parms );
|
|
|
|
//------------------------------------
|
|
|
|
char name[MAX_QPATH];
|
|
void *searchPath; // hint for FS_ReadFileDir()
|
|
|
|
// for dynamic linked modules
|
|
void *dllHandle;
|
|
vmMainProc entryPoint;
|
|
void (*destroy)(vm_t* self);
|
|
|
|
// for interpreted modules
|
|
qboolean currentlyInterpreting;
|
|
|
|
qboolean compiled;
|
|
byte *codeBase;
|
|
int entryOfs;
|
|
int codeLength;
|
|
|
|
intptr_t *instructionPointers;
|
|
int instructionCount;
|
|
|
|
byte *dataBase;
|
|
int dataMask;
|
|
int dataAlloc; // actually allocated
|
|
|
|
int stackBottom; // if programStack < stackBottom, error
|
|
|
|
int numSymbols;
|
|
struct vmSymbol_s *symbols;
|
|
|
|
int callLevel; // counts recursive VM_Call
|
|
int breakFunction; // increment breakCount on function entry to this
|
|
int breakCount;
|
|
|
|
byte *jumpTableTargets;
|
|
int numJumpTableTargets;
|
|
};
|
|
|
|
|
|
extern vm_t *currentVM;
|
|
extern int vm_debugLevel;
|
|
|
|
void VM_Compile( vm_t *vm, vmHeader_t *header );
|
|
int VM_CallCompiled( vm_t *vm, int *args );
|
|
|
|
void VM_PrepareInterpreter( vm_t *vm, vmHeader_t *header );
|
|
int VM_CallInterpreted( vm_t *vm, int *args );
|
|
|
|
vmSymbol_t *VM_ValueToFunctionSymbol( vm_t *vm, int value );
|
|
int VM_SymbolToValue( vm_t *vm, const char *symbol );
|
|
const char *VM_ValueToSymbol( vm_t *vm, int value );
|
|
void VM_LogSyscalls( int *args );
|
|
|
|
void VM_BlockCopy(unsigned int dest, unsigned int src, size_t n);
|