Actor, pixelmap allocation etc (#23)
* Adds screen init, camera allocation * Implements missing BrActorAdd
This commit is contained in:
parent
c4aba6e122
commit
92d549520e
5
Makefile
5
Makefile
|
@ -3,12 +3,15 @@
|
|||
all: build test
|
||||
|
||||
build:
|
||||
@echo "Building fw"
|
||||
@$(MAKE) -C src/framework build
|
||||
@echo "Building brender"
|
||||
@$(MAKE) -C src/BRSRC13 build
|
||||
@echo "Building dethrace"
|
||||
@$(MAKE) -C src/DETHRACE build
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C src/framework clean
|
||||
@$(MAKE) -C src/BRSRC13 clean
|
||||
@$(MAKE) -C src/DETHRACE clean
|
||||
@$(MAKE) -C test clean
|
||||
|
@ -17,7 +20,7 @@ test: build
|
|||
@echo "Building tests"
|
||||
@$(MAKE) -C test build
|
||||
@cp -r test/assets/DATA test/build
|
||||
@(cd test/build && ./c1tests)
|
||||
@(cd test/build && ./c1tests $$DR_TEST_ARGS)
|
||||
|
||||
run: build
|
||||
@echo "Running dethrace"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#include "dosio.h"
|
||||
#include "debug.h"
|
||||
#include "pixelmap.h"
|
||||
#include <stddef.h>
|
||||
|
||||
br_pixelmap* DOSGfxBegin(char* setup_string) {
|
||||
LOG_TRACE("(\"%s\")", setup_string);
|
||||
// Original implementation replaced with SDL...
|
||||
|
||||
return BrPixelmapAllocate(BR_PMT_INDEX_8, 640, 480, NULL, BR_PMAF_NORMAL);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#include "br_types.h"
|
||||
|
||||
br_pixelmap* DOSGfxBegin(char* setup_string);
|
|
@ -1,5 +1,5 @@
|
|||
#include "brlists.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -48,6 +48,7 @@ br_node* BrRemove(br_node* node) {
|
|||
// Offset: 573
|
||||
// Size: 39
|
||||
void BrSimpleNewList(br_simple_list* list) {
|
||||
LOG_TRACE("(%p)", list);
|
||||
list->head = NULL;
|
||||
}
|
||||
|
||||
|
@ -76,4 +77,11 @@ void BrSimpleInsert(br_simple_list* list, br_simple_node* here, br_simple_node*
|
|||
// Offset: 891
|
||||
// Size: 93
|
||||
br_simple_node* BrSimpleRemove(br_simple_node* node) {
|
||||
*node->prev = node->next;
|
||||
if (node->next) {
|
||||
node->next->prev = node->prev;
|
||||
}
|
||||
node->next = NULL;
|
||||
node->prev = NULL;
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ br_uint_32 BrSwap32(br_uint_32 l) {
|
|||
struct {
|
||||
unsigned long l;
|
||||
unsigned char c[4];
|
||||
};
|
||||
} u;
|
||||
}
|
||||
|
||||
// Offset: 99
|
||||
|
@ -17,7 +17,7 @@ br_uint_16 BrSwap16(br_uint_16 s) {
|
|||
struct {
|
||||
unsigned short s;
|
||||
unsigned char c[2];
|
||||
};
|
||||
} u;
|
||||
}
|
||||
|
||||
// Offset: 175
|
||||
|
@ -26,7 +26,7 @@ br_float BrSwapFloat(br_float f) {
|
|||
struct {
|
||||
br_float f;
|
||||
unsigned char c[4];
|
||||
};
|
||||
} u;
|
||||
}
|
||||
|
||||
// Offset: 279
|
||||
|
|
|
@ -10,7 +10,7 @@ struct {
|
|||
int type;
|
||||
void* value;
|
||||
int count;
|
||||
};
|
||||
} DatafileStack;
|
||||
char* ChunkNames[61];
|
||||
char rscid[52];
|
||||
int DatafileStackTop;
|
||||
|
@ -72,7 +72,7 @@ br_uint_32 DfStructWriteBinary(br_datafile* df, br_file_struct* str, void* base)
|
|||
struct {
|
||||
unsigned char b[8];
|
||||
float f;
|
||||
};
|
||||
} conv;
|
||||
}
|
||||
|
||||
// Offset: 2769
|
||||
|
@ -91,7 +91,7 @@ br_uint_32 DfStructReadBinary(br_datafile* df, br_file_struct* str, void* base)
|
|||
struct {
|
||||
unsigned char b[8];
|
||||
float f;
|
||||
};
|
||||
} conv;
|
||||
}
|
||||
|
||||
// Offset: 4182
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "CORE/STD/brstddiag.h"
|
||||
#include "CORE/STD/brstdfile.h"
|
||||
#include "CORE/STD/brstdmem.h"
|
||||
#include "debug.h"
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -126,4 +127,12 @@ br_filesystem* BrFilesystemSet(br_filesystem* newfs) {
|
|||
// Size: 73
|
||||
br_allocator* BrAllocatorSet(br_allocator* newal) {
|
||||
br_allocator* old;
|
||||
LOG_TRACE("(%p)", newal);
|
||||
|
||||
if (!newal) {
|
||||
fw.mem = _BrDefaultAllocator;
|
||||
} else {
|
||||
fw.mem = newal;
|
||||
}
|
||||
return fw.mem;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "CORE/FW/fwsetup.h"
|
||||
#include "CORE/STD/brstdlib.h"
|
||||
#include "debug.h"
|
||||
|
||||
char rscid[45];
|
||||
|
||||
|
@ -9,6 +10,8 @@ char rscid[45];
|
|||
// Size: 153
|
||||
void* BrMemAllocate(br_size_t size, br_uint_8 type) {
|
||||
void* b;
|
||||
LOG_TRACE("(%d, %d)", size, type);
|
||||
|
||||
b = fw.mem->allocate(size, type);
|
||||
BrMemSet(b, 0, size);
|
||||
return b;
|
||||
|
@ -17,12 +20,16 @@ void* BrMemAllocate(br_size_t size, br_uint_8 type) {
|
|||
// Offset: 177
|
||||
// Size: 106
|
||||
void BrMemFree(void* block) {
|
||||
LOG_TRACE("(%p)", block);
|
||||
fw.mem->free(block);
|
||||
}
|
||||
|
||||
// Offset: 296
|
||||
// Size: 131
|
||||
br_size_t BrMemInquire(br_uint_8 type) {
|
||||
br_size_t i;
|
||||
i = fw.mem->inquire(type);
|
||||
return i;
|
||||
}
|
||||
|
||||
// Offset: 438
|
||||
|
@ -39,6 +46,9 @@ br_int_32 BrMemAlign(br_uint_8 type) {
|
|||
// Size: 161
|
||||
void* BrMemCalloc(int nelems, br_size_t size, br_uint_8 type) {
|
||||
void* b;
|
||||
b = fw.mem->allocate(nelems * size, type);
|
||||
BrMemSet(b, 0, nelems * size);
|
||||
return b;
|
||||
}
|
||||
|
||||
// Offset: 739
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "resource.h"
|
||||
|
||||
#include "brlists.h"
|
||||
#include "brstdlib.h"
|
||||
#include "debug.h"
|
||||
#include "fwsetup.h"
|
||||
#include "mem.h"
|
||||
#include <stdio.h>
|
||||
|
@ -31,6 +33,7 @@ void* BrResAllocate(void* vparent, br_size_t size, br_uint_8 res_class) {
|
|||
br_int_32 calign;
|
||||
br_int_32 pad;
|
||||
br_int_32 actual_pad;
|
||||
LOG_TRACE("(%p, %d, %d)", vparent, size, res_class);
|
||||
|
||||
br_int_32 actual_pad_2;
|
||||
char* tmp;
|
||||
|
@ -49,6 +52,7 @@ void* BrResAllocate(void* vparent, br_size_t size, br_uint_8 res_class) {
|
|||
actual_pad_2 = (size + sizeof(resource_header) + 3) & 0xFFFC;
|
||||
|
||||
res = (resource_header*)BrMemAllocate(size + actual_pad, res_class);
|
||||
LOG_DEBUG("allocated r %p\n", res);
|
||||
// TOOD: ?
|
||||
// if ((signed int)(((unsigned int)((char*)allocated + res_align_1) & ~res_align_1) - (_DWORD)allocated) > v8)
|
||||
// BrFailure((int)"Memory allocator broke alignment", v14);
|
||||
|
@ -56,6 +60,7 @@ void* BrResAllocate(void* vparent, br_size_t size, br_uint_8 res_class) {
|
|||
res->size_l = actual_pad_2 >> 2;
|
||||
res->size_m = actual_pad_2 >> 10;
|
||||
res->size_h = actual_pad_2 >> 18;
|
||||
|
||||
BrSimpleNewList(&res->children);
|
||||
res->magic_ptr = res;
|
||||
res->magic_num = 0xDEADBEEF;
|
||||
|
@ -79,11 +84,47 @@ void* BrResAllocate(void* vparent, br_size_t size, br_uint_8 res_class) {
|
|||
void BrResInternalFree(resource_header* res, br_boolean callback) {
|
||||
int c;
|
||||
void* r;
|
||||
LOG_TRACE("(%p, %d)", res, callback);
|
||||
|
||||
c = res->class;
|
||||
if (c != 127) {
|
||||
//v5 = fw.resource_class_index[c]->alignment;
|
||||
//if ((signed int)v5 <= 0)
|
||||
// v5 = 4;
|
||||
res->class = 127;
|
||||
if (callback && fw.resource_class_index[c]->free_cb) {
|
||||
// TODO: we should return address of the user-facing data, not the resource_header
|
||||
//~(v5 - 1) & (unsigned int)((char*)&res->magic_num + v5 + 3),
|
||||
fw.resource_class_index[c]->free_cb(res, c, (res->size_h << 18) | 4 * res->size_l | (res->size_m << 10));
|
||||
}
|
||||
|
||||
while (res->children.head) {
|
||||
r = BrSimpleRemove(res->children.head);
|
||||
BrResInternalFree((resource_header*)r, 1);
|
||||
}
|
||||
if (res->node.prev) {
|
||||
BrSimpleRemove(&res->node);
|
||||
}
|
||||
res->magic_num = 1;
|
||||
res->magic_ptr = 0;
|
||||
BrMemFree(res);
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 1148
|
||||
// Size: 79
|
||||
void BrResFree(void* vres) {
|
||||
LOG_TRACE("(%p)", vres);
|
||||
|
||||
// go backwards through padding until we hit the end of resource_header
|
||||
while (*(char*)vres == 0) {
|
||||
vres = (char*)vres - 1;
|
||||
}
|
||||
// jump one more step backwards to start of resource_header
|
||||
vres = (char*)vres + 1;
|
||||
vres = ((resource_header*)vres - 1);
|
||||
//TODO: assert magic_num
|
||||
BrResInternalFree(vres, 1);
|
||||
}
|
||||
|
||||
// Offset: 1247
|
||||
|
@ -154,6 +195,11 @@ br_uint_32 BrResCheck(void* vres, int no_tag) {
|
|||
char* BrResStrDup(void* vparent, char* str) {
|
||||
int l;
|
||||
char* nstr;
|
||||
|
||||
l = BrStrLen(str);
|
||||
nstr = (char*)BrResAllocate(vparent, l + 1, BR_MEMORY_STRING);
|
||||
BrStrCpy(nstr, str);
|
||||
return nstr;
|
||||
}
|
||||
|
||||
// Offset: 3026
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "tokenval.h"
|
||||
#include "debug.h"
|
||||
#include "resource.h"
|
||||
|
||||
char rscid[50];
|
||||
|
||||
|
@ -6,6 +8,13 @@ char rscid[50];
|
|||
// Size: 88
|
||||
br_tv_template* BrTVTemplateAllocate(void* res, br_tv_template_entry* entries, int n_entries) {
|
||||
br_tv_template* t;
|
||||
LOG_TRACE("(%p, %p, %d)", res, entries, n_entries);
|
||||
|
||||
t = BrResAllocate(res, sizeof(br_tv_template), BR_MEMORY_TOKEN_TEMPLATE);
|
||||
t->res = t;
|
||||
t->entries = entries;
|
||||
t->n_entries = n_entries;
|
||||
return t;
|
||||
}
|
||||
|
||||
// Offset: 126
|
||||
|
|
|
@ -17,6 +17,25 @@ void BrMatrix34Mul(br_matrix34* A, br_matrix34* B, br_matrix34* C) {
|
|||
// Offset: 958
|
||||
// Size: 177
|
||||
void BrMatrix34Identity(br_matrix34* mat) {
|
||||
// { 1, 0, 0},
|
||||
// { 0, 1, 0},
|
||||
// { 0, 0, 1}
|
||||
// ( 0, 0, 0 }
|
||||
mat->m[0][0] = 1.0;
|
||||
mat->m[0][1] = 0;
|
||||
mat->m[0][2] = 0;
|
||||
|
||||
mat->m[1][0] = 0;
|
||||
mat->m[1][1] = 1.0;
|
||||
mat->m[1][2] = 0;
|
||||
|
||||
mat->m[2][0] = 0;
|
||||
mat->m[2][1] = 0;
|
||||
mat->m[2][2] = 1.0;
|
||||
|
||||
mat->m[3][0] = 0;
|
||||
mat->m[3][1] = 0;
|
||||
mat->m[3][2] = 0;
|
||||
}
|
||||
|
||||
// Offset: 1153
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "genclip.h"
|
||||
#include "debug.h"
|
||||
|
||||
char rscid[49];
|
||||
|
||||
|
@ -22,6 +23,30 @@ br_clip_result PixelmapLineClip(br_point* s_out, br_point* e_out, br_point* s_in
|
|||
// Offset: 951
|
||||
// Size: 374
|
||||
br_clip_result PixelmapRectangleClip(br_rectangle* out, br_rectangle* in, br_pixelmap* pm) {
|
||||
LOG_TRACE("(%p, %p, %p)", out, in, pm);
|
||||
|
||||
out->x = pm->origin_x + in->x;
|
||||
out->y = pm->origin_y + in->y;
|
||||
out->w = in->w;
|
||||
out->h = in->h;
|
||||
if (pm->width > out->x && pm->height > out->y) {
|
||||
if (out->w + out->x > 0 && out->y + out->h > 0) {
|
||||
if (out->x < 0) {
|
||||
out->x = 0;
|
||||
out->w = out->w + out->x;
|
||||
}
|
||||
if (out->y < 0) {
|
||||
out->y = 0;
|
||||
out->h = out->y + out->h;
|
||||
}
|
||||
if (out->w + out->x > pm->width)
|
||||
out->w = pm->width - out->x;
|
||||
if (out->h + out->y > pm->height)
|
||||
out->h = pm->height - out->y;
|
||||
return out->w && out->h;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 1350
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "pixelmap.h"
|
||||
#include "pmmem.h"
|
||||
|
||||
char rscid[50];
|
||||
|
||||
// Offset: 19
|
||||
// Size: 65
|
||||
br_pixelmap* BrPixelmapAllocate(br_uint_8 type, br_int_32 w, br_int_32 h, void* pixels, int flags) {
|
||||
return (br_pixelmap*)DevicePixelmapMemAllocate(type, w, h, pixels, flags);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include "pmdsptch.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "pmmem.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char rscid[65];
|
||||
|
||||
|
@ -9,6 +12,14 @@ char rscid[65];
|
|||
br_pixelmap* BrPixelmapAllocateSub(br_pixelmap* src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) {
|
||||
br_pixelmap* new;
|
||||
br_rectangle r;
|
||||
LOG_TRACE("(%p, %d, %d, %d, %d)", src, x, y, w, h);
|
||||
|
||||
r.h = h;
|
||||
r.w = w;
|
||||
r.x = x;
|
||||
r.y = y;
|
||||
_M_br_device_pixelmap_mem_allocateSub((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &r);
|
||||
return new;
|
||||
}
|
||||
|
||||
// Offset: 144
|
||||
|
@ -26,6 +37,32 @@ br_pixelmap* BrPixelmapResize(br_pixelmap* src, br_int_32 width, br_int_32 heigh
|
|||
br_pixelmap* BrPixelmapMatch(br_pixelmap* src, br_uint_8 match_type) {
|
||||
br_pixelmap* new;
|
||||
br_token_value tv[3];
|
||||
new = NULL;
|
||||
LOG_TRACE("(%p, %d)", src, match_type);
|
||||
|
||||
CheckDispatch((br_device_pixelmap*)src);
|
||||
|
||||
switch (match_type) {
|
||||
case 0u:
|
||||
tv[1].t = BRT_OFFSCREEN;
|
||||
break;
|
||||
case 1u:
|
||||
tv[2].t = BRT_VECTOR2_INTEGER;
|
||||
tv[1].t = BRT_DEPTH;
|
||||
tv[1].v.u32 = 76;
|
||||
break;
|
||||
default:
|
||||
LOG_PANIC("Case %d not implemented", match_type);
|
||||
}
|
||||
|
||||
//((br_device_pixelmap*)src)->dispatch->_match((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &tv[0]);
|
||||
LOG_DEBUG("new1 %p, %p\n", new, &new);
|
||||
if (_M_br_device_pixelmap_mem_match((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &tv[0]) != 0) {
|
||||
LOG_WARN("_M_br_device_pixelmap_mem_match returned error");
|
||||
return NULL;
|
||||
}
|
||||
LOG_DEBUG("new %p, %d\n", new, new->width);
|
||||
return new;
|
||||
}
|
||||
|
||||
// Offset: 839
|
||||
|
|
|
@ -1,9 +1,114 @@
|
|||
#include "pmmem.h"
|
||||
#include "debug.h"
|
||||
#include "genclip.h"
|
||||
#include "pmsetup.h"
|
||||
#include "resource.h"
|
||||
#include "tokenval.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
br_tv_template_entry matchTemplateEntries[6] = {
|
||||
{ BRT_USE_T, NULL, 0, 2, 3, 0, 0 },
|
||||
{ BRT_PIXEL_TYPE_U8, NULL, 4, 2, 3, 0, 0 },
|
||||
{ BRT_PIXEL_BITS_I32, NULL, 8, 2, 3, 0, 0 },
|
||||
{ BRT_RENDERER_O, NULL, 20, 2, 3, 0, 0 },
|
||||
{ BRT_WIDTH_I32, NULL, 12, 2, 3, 0, 0 },
|
||||
{ BRT_HEIGHT_I32, NULL, 16, 2, 3, 0, 0 }
|
||||
};
|
||||
br_device_pixelmap_dispatch devicePixelmapDispatch; // = {
|
||||
// NULL,
|
||||
// NULL,
|
||||
// NULL,
|
||||
// NULL,
|
||||
// &_M_br_device_pixelmap_mem_free,
|
||||
// &_M_br_device_pixelmap_mem_identifier,
|
||||
// &_M_br_device_pixelmap_mem_type,
|
||||
// &_M_br_device_pixelmap_mem_isType,
|
||||
// &_M_br_device_pixelmap_mem_validSource,
|
||||
// &_M_br_device_pixelmap_mem_space,
|
||||
// &_M_br_device_pixelmap_mem_queryTemplate,
|
||||
// NULL, //&_M_br_object_query,
|
||||
// NULL, //&_M_br_object_queryBuffer,
|
||||
// NULL, //&_M_br_object_queryMany,
|
||||
// NULL, //&_M_br_object_queryManySize,
|
||||
// NULL, //&_M_br_object_queryAll,
|
||||
// NULL, //&_M_br_object_queryAllSize,
|
||||
// &_M_br_device_pixelmap_mem_validSource,
|
||||
// &_M_br_device_pixelmap_mem_resize,
|
||||
// &_M_br_device_pixelmap_mem_match,
|
||||
// &_M_br_device_pixelmap_mem_allocateSub,
|
||||
// &_M_br_device_pixelmap_mem_copyTo,
|
||||
// &_M_br_device_pixelmap_mem_copyTo,
|
||||
// &_M_br_device_pixelmap_mem_copyFrom,
|
||||
// &_M_br_device_pixelmap_mem_fill,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_doubleBuffer,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_copyDirty,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_copyToDirty,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_copyFromDirty,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_fillDirty,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_doubleBufferDirty,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_rectangle,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_rectangle2,
|
||||
// &_M_br_device_pixelmap_mem_rectangleCopyTo,
|
||||
// &_M_br_device_pixelmap_mem_rectangleCopyTo,
|
||||
// &_M_br_device_pixelmap_mem_rectangleCopyFrom,
|
||||
// &_M_br_device_pixelmap_mem_rectangleStretchCopyFrom,
|
||||
// &_M_br_device_pixelmap_mem_rectangleStretchCopyFrom,
|
||||
// &_M_br_device_pixelmap_mem_rectangleStretchCopyFrom,
|
||||
// &_M_br_device_pixelmap_mem_rectangleFill,
|
||||
// &_M_br_device_pixelmap_mem_pixelSet,
|
||||
// &_M_br_device_pixelmap_mem_line,
|
||||
// &_M_br_device_pixelmap_mem_copyBits,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_text,
|
||||
// NULL, //&_M_br_device_pixelmap_gen_textBounds,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_pixelQuery,
|
||||
// &_M_br_device_pixelmap_mem_pixelAddressQuery,
|
||||
// &_M_br_device_pixelmap_mem_pixelAddressSet,
|
||||
// &_M_br_device_pixelmap_mem_originSet,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_directLock,
|
||||
// &_M_br_device_pixelmap_mem_directLock
|
||||
// };
|
||||
|
||||
br_tv_template_entry matchTemplateEntries[6];
|
||||
br_device_pixelmap_dispatch devicePixelmapDispatch;
|
||||
br_tv_template_entry devicePixelmapTemplateEntries[4];
|
||||
pm_type_info pmTypeInfo[30];
|
||||
pm_type_info pmTypeInfo[30] = {
|
||||
{ 1u, 1u, 32u, 1u },
|
||||
{ 2u, 1u, 16u, 1u },
|
||||
{ 4u, 1u, 8u, 1u },
|
||||
{ 8u, 1u, 4u, 1u },
|
||||
{ 16u, 2u, 2u, 2u },
|
||||
{ 16u, 2u, 2u, 2u },
|
||||
{ 24u, 3u, 4u, 2u },
|
||||
{ 32u, 4u, 1u, 2u },
|
||||
{ 32u, 4u, 1u, 10u },
|
||||
{ 16u, 1u, 2u, 16u },
|
||||
{ 32u, 1u, 1u, 16u },
|
||||
{ 16u, 2u, 4u, 4u },
|
||||
{ 32u, 4u, 4u, 4u },
|
||||
{ 8u, 1u, 4u, 8u },
|
||||
{ 16u, 2u, 2u, 9u },
|
||||
{ 54u, 0u, 0u, 0u },
|
||||
{ 4u, 0u, 5u, 3u },
|
||||
{ 0u, 0u, 0u, 0u },
|
||||
{ 69u, 0u, 0u, 0u },
|
||||
{ 52u, 0u, 5u, 13u },
|
||||
{ 0u, 0u, 0u, 0u },
|
||||
{ 72u, 0u, 0u, 0u },
|
||||
{ 54u, 0u, 5u, 13u },
|
||||
{ 0u, 0u, 0u, 0u },
|
||||
{ 75u, 0u, 0u, 0u },
|
||||
{ 44u, 0u, 5u, 12u },
|
||||
{ 0u, 0u, 0u, 0u },
|
||||
{ 1u, 0u, 0u, 0u },
|
||||
{ 0u, 0u, 0u, 0u },
|
||||
{ 0u, 0u, 0u, 0u }
|
||||
};
|
||||
|
||||
char rscid[53];
|
||||
|
||||
// Offset: 26
|
||||
|
@ -15,12 +120,54 @@ char rscid[53];
|
|||
br_device_pixelmap* DevicePixelmapMemAllocate(br_uint_8 type, br_uint_16 w, br_uint_16 h, void* pixels, int flags) {
|
||||
br_device_pixelmap* pm;
|
||||
pm_type_info* tip;
|
||||
|
||||
tip = &pmTypeInfo[type];
|
||||
pm = BrResAllocate(_pixelmap.res, sizeof(br_device_pixelmap), BR_MEMORY_PIXELMAP);
|
||||
//pm->dispatch = &devicePixelmapDispatch;
|
||||
pm->pm_identifier = NULL;
|
||||
pm->pm_map = NULL;
|
||||
pm->pm_flags = BR_PMF_LINEAR;
|
||||
pm->pm_copy_function = BR_PMCOPY_NORMAL;
|
||||
pm->pm_base_x = 0;
|
||||
pm->pm_base_y = 0;
|
||||
|
||||
pm->pm_origin_x = 0;
|
||||
pm->pm_origin_y = 0;
|
||||
pm->pm_type = type;
|
||||
pm->pm_width = w;
|
||||
pm->pm_height = h;
|
||||
//8 bits, 1, 4 align, 1
|
||||
|
||||
//v11 = (tip->align + w - 1) / tip->align * tip->align * tip->bits;
|
||||
//pm->pm_row_bytes = (v11 - (__CFSHL__(v11 >> 31, 3) + 8 * (v11 >> 31))) >> 3;
|
||||
// TODO: calculate this differently
|
||||
pm->pm_row_bytes = w;
|
||||
if ((8 * pm->pm_row_bytes % tip->bits) == 0) {
|
||||
pm->pm_flags |= BR_PMF_ROW_WHOLEPIXELS;
|
||||
}
|
||||
if (!(flags & BR_PMAF_NO_PIXELS)) {
|
||||
if (pixels) {
|
||||
pm->pm_pixels = pixels;
|
||||
} else {
|
||||
pm->pm_pixels = BrResAllocate(pm, pm->pm_height * pm->pm_row_bytes, BR_MEMORY_PIXELS);
|
||||
}
|
||||
}
|
||||
//TODO: not sure we need this
|
||||
//pm->pm_pixels_qualifier = (unsigned __int16)_GetSysQual();
|
||||
if (flags & BR_PMAF_INVERTED) {
|
||||
pm->pm_pixels = (char*)pm->pm_pixels + (pm->pm_height - 1) * pm->pm_row_bytes;
|
||||
pm->pm_row_bytes *= -1;
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
// Offset: 539
|
||||
// Size: 54
|
||||
// EAX: pm
|
||||
void _CheckDispatch(br_device_pixelmap* pm) {
|
||||
void CheckDispatch(br_device_pixelmap* pm) {
|
||||
// if (!pm->dispatch) {
|
||||
// pm->dispatch = &devicePixelmapDispatch;
|
||||
// }
|
||||
}
|
||||
|
||||
// Offset: 631
|
||||
|
@ -28,6 +175,26 @@ void _CheckDispatch(br_device_pixelmap* pm) {
|
|||
br_error _M_br_device_pixelmap_mem_allocateSub(br_device_pixelmap* self, br_device_pixelmap** newpm, br_rectangle* rect) {
|
||||
br_device_pixelmap* pm;
|
||||
br_rectangle out;
|
||||
LOG_TRACE("(%p, %p, %p)", self, newpm, rect);
|
||||
|
||||
if (PixelmapRectangleClip(&out, rect, (br_pixelmap*)self) == BR_CLIP_REJECT) {
|
||||
return 4098;
|
||||
}
|
||||
pm = (br_device_pixelmap*)BrResAllocate(_pixelmap.res, sizeof(br_pixelmap), BR_MEMORY_PIXELMAP);
|
||||
memcpy(pm, self, sizeof(br_pixelmap));
|
||||
pm->pm_base_x += out.x;
|
||||
pm->pm_base_y += out.y;
|
||||
pm->pm_width = out.w;
|
||||
pm->pm_height = out.h;
|
||||
pm->pm_origin_x = 0;
|
||||
pm->pm_origin_y = 0;
|
||||
pm->pm_stored = 0;
|
||||
pm->dispatch = &devicePixelmapDispatch;
|
||||
if (pm->pm_width != self->pm_width) {
|
||||
pm->pm_flags &= 0xFDu; //unset BR_PMF_LINEAR
|
||||
}
|
||||
*newpm = pm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 884
|
||||
|
@ -86,6 +253,88 @@ br_error _M_br_device_pixelmap_mem_match(br_device_pixelmap* self, br_device_pix
|
|||
br_device_pixelmap* pm;
|
||||
br_int_32 bytes;
|
||||
br_int_32 r;
|
||||
LOG_TRACE("(%p, %p, %p)", self, newpm, tv);
|
||||
|
||||
if (!_pixelmap.pixelmap_match_template) {
|
||||
_pixelmap.pixelmap_match_template = BrTVTemplateAllocate(_pixelmap.res, matchTemplateEntries, 6);
|
||||
if (!_pixelmap.pixelmap_match_template) {
|
||||
LOG_WARN("x");
|
||||
return 4098;
|
||||
}
|
||||
}
|
||||
mt.pixel_type = self->pm_type;
|
||||
mt.width = self->pm_width;
|
||||
mt.height = self->pm_height;
|
||||
|
||||
// TOOD: We haven't implemented BrTokenValueSetMany - just emulate enough for now
|
||||
mt.use = tv[1].t; // se BrPixelmapMatch
|
||||
mt.pixel_bits = 16;
|
||||
|
||||
BrTokenValueSetMany(&mt, &count, 0, tv, _pixelmap.pixelmap_match_template);
|
||||
// if ( (unsigned int)mt.use < 0x64 )
|
||||
// {
|
||||
// if ( mt.use != 84 )
|
||||
// return 4098;
|
||||
// if ( mt.pixel_bits < 0x10u )
|
||||
// {
|
||||
// if ( mt.pixel_bits )
|
||||
// return 4098;
|
||||
// }
|
||||
// else if ( mt.pixel_bits > 0x10u )
|
||||
// {
|
||||
// if ( mt.pixel_bits != 32 )
|
||||
// return 4098;
|
||||
// mt.pixel_type = 12;
|
||||
// goto LABEL_18;
|
||||
// }
|
||||
// mt.pixel_type = 11;
|
||||
// goto LABEL_18;
|
||||
// }
|
||||
// if ( (unsigned int)mt.use > 0x66 )
|
||||
// {
|
||||
// if ( (unsigned int)mt.use >= 0x116 )
|
||||
// {
|
||||
// if ( (unsigned int)mt.use > 0x116 && mt.use != 379 )
|
||||
// return 4098;
|
||||
// goto LABEL_18;
|
||||
// }
|
||||
// return 4098;
|
||||
// }
|
||||
|
||||
if (mt.use == BRT_DEPTH) {
|
||||
pm = DevicePixelmapMemAllocate(mt.pixel_type, mt.width, mt.height, NULL, (self->pm_row_bytes < 0) | BR_PMAF_NO_PIXELS);
|
||||
r = abs(self->pm_row_bytes);
|
||||
bytes = (signed int)pmTypeInfo[self->pm_type].bits >> 3;
|
||||
pm->pm_row_bytes = ((signed int)pmTypeInfo[pm->pm_type].bits >> 3) * (unsigned int)((bytes + r - 1) / bytes);
|
||||
pm->pm_pixels = BrResAllocate(pm, pm->pm_height * pm->pm_row_bytes, BR_MEMORY_PIXELS);
|
||||
if (pm->pm_width * ((signed int)pmTypeInfo[pm->pm_type].bits >> 3) == pm->pm_row_bytes)
|
||||
pm->pm_flags |= BR_PMF_LINEAR;
|
||||
else {
|
||||
pm->pm_flags &= 0xFDu;
|
||||
}
|
||||
if (self->pm_row_bytes < 0) {
|
||||
pm->pm_row_bytes = -pm->pm_row_bytes;
|
||||
// TODO: is this a bug in the original code? We say row_bytes is positive, but still set the pixels pointer to the bottom
|
||||
// of the data
|
||||
pm->pm_pixels = (char*)pm->pm_pixels + (pm->pm_height - 1) * pm->pm_row_bytes;
|
||||
}
|
||||
} else {
|
||||
pm = DevicePixelmapMemAllocate(mt.pixel_type, mt.width, mt.height, NULL, self->pm_row_bytes < 0);
|
||||
}
|
||||
pm->pm_origin_x = self->pm_origin_x;
|
||||
pm->pm_origin_y = self->pm_origin_y;
|
||||
//self->dispatch = pm;
|
||||
*newpm = pm;
|
||||
return 0;
|
||||
|
||||
// br_pixelmap* ret = BrPixelmapAllocate(src->type, src->width, src->height, NULL, BR_PMAF_NORMAL);
|
||||
|
||||
// if (match_type == BR_PMMATCH_DEPTH_16) {
|
||||
// ret->type = BR_PMT_DEPTH_16;
|
||||
// ret->flags |= BR_PMAF_DEPTHBUFFER;
|
||||
// } else {
|
||||
// ret->flags |= BR_PMAF_OFFSCREEN;
|
||||
// }
|
||||
}
|
||||
|
||||
// Offset: 2804
|
||||
|
|
|
@ -14,7 +14,7 @@ br_device_pixelmap* DevicePixelmapMemAllocate(br_uint_8 type, br_uint_16 w, br_u
|
|||
// Offset: 539
|
||||
// Size: 54
|
||||
// EAX: pm
|
||||
void _CheckDispatch(br_device_pixelmap* pm);
|
||||
void CheckDispatch(br_device_pixelmap* pm);
|
||||
|
||||
// Offset: 631
|
||||
// Size: 222
|
||||
|
|
|
@ -22,7 +22,7 @@ void BrPixelmapBegin() {
|
|||
int i;
|
||||
|
||||
BrMemSet(&_pixelmap, 0, sizeof(br_pixelmap_state));
|
||||
_pixelmap.res = BrResAllocate(0, 0, BR_MEMORY_ANCHOR);
|
||||
_pixelmap.res = BrResAllocate(NULL, 0, BR_MEMORY_ANCHOR);
|
||||
for (i = 0; i < 2; i++) {
|
||||
BrResClassAdd(&pm_resourceClasses[i]);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "br_types.h"
|
||||
|
||||
extern br_pixelmap_state _pixelmap;
|
||||
|
||||
// Offset: 16
|
||||
// Size: 130
|
||||
void BrPixelmapBegin();
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "CORE/FW/brlists.h"
|
||||
#include "CORE/FW/fwsetup.h"
|
||||
#include "CORE/FW/resource.h"
|
||||
#include "CORE/MATH/matrix34.h"
|
||||
#include "CORE/V1DB/dbsetup.h"
|
||||
#include "CORE/V1DB/enables.h"
|
||||
#include "actsupt.h"
|
||||
#include "debug.h"
|
||||
|
||||
char rscid[53];
|
||||
|
||||
|
@ -31,12 +40,37 @@ br_actor* BrActorSearch(br_actor* root, char* pattern) {
|
|||
// EDX: d
|
||||
void RenumberActor(br_actor* a, int d) {
|
||||
br_actor* ac;
|
||||
LOG_TRACE("(%p, %d)", a, d);
|
||||
|
||||
ac = a->children;
|
||||
a->depth = d;
|
||||
while (ac) {
|
||||
d++;
|
||||
RenumberActor(ac, d);
|
||||
ac = ac->next;
|
||||
}
|
||||
}
|
||||
|
||||
// Offset: 768
|
||||
// Size: 230
|
||||
br_actor* BrActorAdd(br_actor* parent, br_actor* a) {
|
||||
br_actor* ac;
|
||||
br_actor* ac2;
|
||||
LOG_TRACE("(%p, %p)", parent, a);
|
||||
|
||||
BrSimpleAddHead((br_simple_list*)&parent->children, (br_simple_node*)a);
|
||||
a->parent = parent;
|
||||
|
||||
a->depth = parent->depth + 1;
|
||||
for (ac = a->children; ac != NULL; ac = ac->next) {
|
||||
ac->depth = a->depth + 1;
|
||||
ac2 = ac->children;
|
||||
while (ac2 != NULL) {
|
||||
RenumberActor(ac2, a->depth + 2);
|
||||
ac2 = ac2->next;
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
// Offset: 1012
|
||||
|
@ -59,17 +93,81 @@ br_actor* BrActorAllocate(br_uint_8 type, void* type_data) {
|
|||
br_camera* camera;
|
||||
br_bounds* bounds;
|
||||
br_vector4* clip_plane;
|
||||
LOG_TRACE("(%d, %p)", type, type_data);
|
||||
|
||||
a = BrResAllocate(v1db.res, sizeof(br_actor), BR_MEMORY_ACTOR);
|
||||
BrSimpleNewList(&a->children);
|
||||
a->type = type;
|
||||
a->depth = 0;
|
||||
a->t.type = 0;
|
||||
a->type_data = NULL;
|
||||
BrMatrix34Identity(&a->t.t.mat);
|
||||
|
||||
if (type_data) {
|
||||
a->type_data = type_data;
|
||||
} else {
|
||||
switch (type) {
|
||||
case BR_ACTOR_NONE:
|
||||
break;
|
||||
case BR_ACTOR_LIGHT:
|
||||
light = BrResAllocate(a, sizeof(br_light), BR_MEMORY_LIGHT);
|
||||
a->type_data = light;
|
||||
light->type = BR_LIGHT_DIRECT;
|
||||
light->colour = BR_COLOUR_RGB(255, 255, 255);
|
||||
light->attenuation_c = 1.0f;
|
||||
light->cone_outer = BR_ANGLE_DEG(15);
|
||||
light->cone_inner = BR_ANGLE_DEG(10);
|
||||
break;
|
||||
case BR_ACTOR_CAMERA:
|
||||
camera = (br_camera*)BrResAllocate(a, sizeof(br_camera), BR_MEMORY_CAMERA);
|
||||
a->type_data = camera;
|
||||
camera->type = BR_CAMERA_PERSPECTIVE_FOV;
|
||||
camera->field_of_view = BR_ANGLE_DEG(45.0f);
|
||||
camera->hither_z = 1.0f;
|
||||
camera->yon_z = 10.0f;
|
||||
camera->aspect = 1.0f;
|
||||
break;
|
||||
case BR_ACTOR_BOUNDS:
|
||||
case BR_ACTOR_BOUNDS_CORRECT:
|
||||
bounds = BrResAllocate(a, sizeof(br_bounds), BR_MEMORY_CLIP_PLANE);
|
||||
a->type_data = bounds;
|
||||
break;
|
||||
case BR_ACTOR_CLIP_PLANE:
|
||||
clip_plane = BrResAllocate(a, sizeof(br_vector4), BR_MEMORY_CLIP_PLANE);
|
||||
clip_plane->v[0] = 0;
|
||||
clip_plane->v[1] = 0;
|
||||
clip_plane->v[2] = 1.0;
|
||||
clip_plane->v[3] = 0;
|
||||
a->type_data = clip_plane;
|
||||
break;
|
||||
default:
|
||||
LOG_WARN("Warning: Unknown type %d for BrActorAllocate", type);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
// Offset: 1907
|
||||
// Size: 152
|
||||
// EAX: a
|
||||
void InternalActorFree(br_actor* a) {
|
||||
while (a->children) {
|
||||
BrSimpleRemove((br_simple_node*)a->children);
|
||||
InternalActorFree(a);
|
||||
}
|
||||
BrActorEnableCheck(a);
|
||||
BrResFree(a);
|
||||
}
|
||||
|
||||
// Offset: 2071
|
||||
// Size: 103
|
||||
void BrActorFree(br_actor* a) {
|
||||
while (a->children) {
|
||||
BrSimpleRemove(a->children);
|
||||
InternalActorFree(a);
|
||||
}
|
||||
BrActorEnableCheck(a);
|
||||
BrResFree(a);
|
||||
}
|
||||
|
||||
// Offset: 2186
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "CORE/STD/brstdlib.h"
|
||||
#include "CORE/V1DB/def_mat.h"
|
||||
#include "CORE/V1DB/def_mdl.h"
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -52,7 +53,7 @@ br_error BrV1dbBegin() {
|
|||
BrResClassAdd(&v1db_resourceClasses[i]);
|
||||
}
|
||||
|
||||
v1db.default_model = (br_model*)BrResAllocate(v1db.res, sizeof(br_model), BR_MEMORY_MODEL);
|
||||
v1db.default_model = BrResAllocate(v1db.res, sizeof(br_model), BR_MEMORY_MODEL);
|
||||
memcpy(v1db.default_model, &_BrDefaultModel, sizeof(br_model));
|
||||
v1db.default_material = SetupDefaultMaterial();
|
||||
v1db.enabled_lights.type = 2;
|
||||
|
@ -133,6 +134,7 @@ br_error BrV1dbRendererEnd() {
|
|||
// Offset: 2029
|
||||
// Size: 94
|
||||
void BrZbBegin(br_uint_8 colour_type, br_uint_8 depth_type) {
|
||||
LOG_TRACE("(%d, %d)", colour_type, depth_type);
|
||||
}
|
||||
|
||||
// Offset: 2133
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "br_types.h"
|
||||
|
||||
extern br_v1db_state v1db;
|
||||
|
||||
// Offset: 12
|
||||
// Size: 345
|
||||
br_error BrV1dbBegin();
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "enables.h"
|
||||
#include "dbsetup.h"
|
||||
#include <stddef.h>
|
||||
|
||||
char rscid[51];
|
||||
|
||||
|
@ -52,6 +54,9 @@ void BrHorizonPlaneDisable(br_actor* h) {
|
|||
// Size: 55
|
||||
br_actor* BrEnvironmentSet(br_actor* a) {
|
||||
br_actor* old_a;
|
||||
old_a = v1db.enabled_environment;
|
||||
v1db.enabled_environment = a;
|
||||
return old_a;
|
||||
}
|
||||
|
||||
// Offset: 1131
|
||||
|
@ -125,4 +130,14 @@ void BrSetupHorizons(br_actor* world, br_matrix34* world_to_view, br_int_32 w2vt
|
|||
// Size: 136
|
||||
// EAX: a
|
||||
void BrActorEnableCheck(br_actor* a) {
|
||||
if (v1db.enabled_environment == a) {
|
||||
v1db.enabled_environment = NULL;
|
||||
}
|
||||
if (a->type == BR_ACTOR_LIGHT) {
|
||||
actorDisable(&v1db.enabled_lights, a);
|
||||
} else if (a->type == BR_ACTOR_MAX) {
|
||||
actorDisable(&v1db.enabled_horizon_planes, a);
|
||||
} else if (a->type <= BR_ACTOR_CLIP_PLANE) {
|
||||
actorDisable(&v1db.enabled_clip_planes, a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#include "matsupt.h"
|
||||
#include "dbsetup.h"
|
||||
#include "debug.h"
|
||||
#include "resource.h"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
char rscid[49];
|
||||
|
||||
|
@ -6,6 +11,17 @@ char rscid[49];
|
|||
// Size: 138
|
||||
br_material* BrMaterialAllocate(char* name) {
|
||||
br_material* m;
|
||||
LOG_TRACE("(\"%s\")", name);
|
||||
|
||||
m = BrResAllocate(v1db.res, sizeof(br_material), BR_MEMORY_MATERIAL);
|
||||
memcpy(m, v1db.default_material, sizeof(br_material));
|
||||
m->map_transform_1.m[0][0] = 0;
|
||||
if (name) {
|
||||
m->identifier = BrResStrDup(m, name);
|
||||
} else {
|
||||
m->identifier = NULL;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
// Offset: 172
|
||||
|
|
|
@ -65,7 +65,7 @@ struct {
|
|||
br_uint_32 id;
|
||||
size_t offset;
|
||||
int table;
|
||||
};
|
||||
} MaterialMaps;
|
||||
char rscid[53];
|
||||
|
||||
// Offset: 18
|
||||
|
|
|
@ -2,12 +2,14 @@ TARGET_EXEC ?= c1
|
|||
|
||||
BUILD_DIR ?= ./build
|
||||
SRC_DIR ?= .
|
||||
FW_SRC_DIR ?= ../framework
|
||||
|
||||
SRCS := $(shell find $(SRC_DIR) -name "*.c")
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
OBJS += $(shell find $(FW_SRC_DIR) -name "*.o")
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d)
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d) $(FW_SRC_DIR)
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
CFLAGS ?= $(INC_FLAGS) -g -Wno-return-type -Wno-missing-declarations -Werror=implicit-function-declaration
|
||||
|
|
|
@ -957,31 +957,31 @@ typedef struct br_quat {
|
|||
br_scalar w;
|
||||
} br_quat;
|
||||
|
||||
typedef struct br_transform {
|
||||
br_uint_16 type;
|
||||
struct {
|
||||
br_matrix34 mat;
|
||||
struct {
|
||||
br_euler e;
|
||||
br_scalar _pad[7];
|
||||
br_vector3 t;
|
||||
} a;
|
||||
struct {
|
||||
br_quat q;
|
||||
br_scalar _pad[5];
|
||||
br_vector3 t;
|
||||
} b;
|
||||
struct {
|
||||
br_vector3 look;
|
||||
br_vector3 up;
|
||||
br_scalar _pad[3];
|
||||
br_vector3 t;
|
||||
} c;
|
||||
struct {
|
||||
br_scalar _pad[9];
|
||||
br_vector3 t;
|
||||
} d;
|
||||
};
|
||||
typedef struct br_transform { // size: 0x34
|
||||
br_uint_16 type; // @0x0
|
||||
union { // size: 0x30
|
||||
br_matrix34 mat; // @0x0
|
||||
struct { // size: 0x30
|
||||
br_euler e; // @0x0
|
||||
br_scalar _pad[7]; // @0x8
|
||||
br_vector3 t; // @0x24
|
||||
} euler; // @0x0
|
||||
struct { // size: 0x30
|
||||
br_quat q; // @0x0
|
||||
br_scalar _pad[5]; // @0x10
|
||||
br_vector3 t; // @0x24
|
||||
} quat; // @0x0
|
||||
struct { // size: 0x30
|
||||
br_vector3 look; // @0x0
|
||||
br_vector3 up; // @0xc
|
||||
br_scalar _pad[3]; // @0x18
|
||||
br_vector3 t; // @0x24
|
||||
} look_up; // @0x0
|
||||
struct { // size: 0x30
|
||||
br_scalar _pad[9]; // @0x0
|
||||
br_vector3 t; // @0x24
|
||||
} translate; // @0x0
|
||||
} t; // @0x4
|
||||
} br_transform;
|
||||
|
||||
typedef struct br_pixelmap {
|
||||
|
@ -1159,7 +1159,29 @@ typedef struct br_outfcty_desc {
|
|||
typedef struct br_renderer_facility {
|
||||
} br_renderer_facility;
|
||||
|
||||
typedef struct br_device_pixelmap {
|
||||
typedef struct br_device_pixelmap_dispatch br_device_pixelmap_dispatch;
|
||||
typedef struct br_device_pixelmap { // size: 0x44
|
||||
br_device_pixelmap_dispatch* dispatch; // @0x0
|
||||
char* pm_identifier; // @0x4
|
||||
void* pm_pixels; // @0x8
|
||||
br_uint_32 pm_pixels_qualifier; // @0xc
|
||||
br_pixelmap* pm_map; // @0x10
|
||||
br_colour_range pm_src_key; // @0x14
|
||||
br_colour_range pm_dst_key; // @0x1c
|
||||
br_uint_32 pm_key; // @0x24
|
||||
br_int_16 pm_row_bytes; // @0x28
|
||||
br_int_16 pm_mip_offset; // @0x2a
|
||||
br_uint_8 pm_type; // @0x2c
|
||||
br_uint_8 pm_flags; // @0x2d
|
||||
br_uint_16 pm_copy_function; // @0x2e
|
||||
br_uint_16 pm_base_x; // @0x30
|
||||
br_uint_16 pm_base_y; // @0x32
|
||||
br_uint_16 pm_width; // @0x34
|
||||
br_uint_16 pm_height; // @0x36
|
||||
br_int_16 pm_origin_x; // @0x38
|
||||
br_int_16 pm_origin_y; // @0x3a
|
||||
void* pm_user; // @0x3c
|
||||
void* pm_stored; // @0x40
|
||||
} br_device_pixelmap;
|
||||
|
||||
typedef struct br_primitive_library {
|
||||
|
@ -1347,21 +1369,21 @@ typedef struct br_tri_strip {
|
|||
br_strip_face_data* face_data;
|
||||
} br_tri_strip;
|
||||
|
||||
typedef struct br_actor {
|
||||
br_actor* next;
|
||||
br_actor** prev;
|
||||
br_actor* children;
|
||||
br_actor* parent;
|
||||
br_uint_16 depth;
|
||||
br_uint_8 type;
|
||||
char* identifier;
|
||||
br_model* model;
|
||||
br_material* material;
|
||||
br_uint_8 render_style;
|
||||
void* render_data;
|
||||
br_transform t;
|
||||
void* type_data;
|
||||
void* user;
|
||||
typedef struct br_actor { // size: 0x64
|
||||
br_actor* next; // @0x0
|
||||
br_actor** prev; // @0x4
|
||||
br_actor* children; // @0x8
|
||||
br_actor* parent; // @0xc
|
||||
br_uint_16 depth; // @0x10
|
||||
br_uint_8 type; // @0x12
|
||||
char* identifier; // @0x14
|
||||
br_model* model; // @0x18
|
||||
br_material* material; // @0x1c
|
||||
br_uint_8 render_style; // @0x20
|
||||
void* render_data; // @0x24
|
||||
br_transform t; // @0x28
|
||||
void* type_data; // @0x5c
|
||||
void* user; // @0x60
|
||||
} br_actor;
|
||||
|
||||
typedef struct br_model {
|
||||
|
@ -1469,7 +1491,7 @@ typedef struct br_simple_node br_simple_node;
|
|||
typedef struct br_simple_node {
|
||||
br_simple_node* next;
|
||||
// TODO: We changed this from "** prev" to "*prev". Is this really correct?
|
||||
br_simple_node* prev;
|
||||
br_simple_node** prev;
|
||||
} br_simple_node;
|
||||
|
||||
typedef struct br_simple_list {
|
||||
|
@ -1576,67 +1598,67 @@ typedef struct br_framework_state { // size: 1136
|
|||
} br_framework_state;
|
||||
|
||||
// br_framework_state defined by "C:\DETHRACE\source\common\finteray.c" module
|
||||
typedef struct br_framework_state_2 {
|
||||
br_surface_fn* surface_fn;
|
||||
br_surface_fn* surface_fn_after_map;
|
||||
br_surface_fn* surface_fn_after_copy;
|
||||
br_face_surface_fn* face_surface_fn;
|
||||
br_matrix23 map_transform;
|
||||
br_scalar index_base;
|
||||
br_scalar index_range;
|
||||
br_matrix4 model_to_screen;
|
||||
br_matrix4 view_to_screen;
|
||||
br_matrix34 model_to_view;
|
||||
br_matrix34 view_to_model;
|
||||
br_matrix34 model_to_environment;
|
||||
struct {
|
||||
br_matrix34 m;
|
||||
br_actor* a;
|
||||
};
|
||||
int vtos_type;
|
||||
br_vector3 eye_m;
|
||||
br_vector3 eye_m_normalised;
|
||||
br_material* material;
|
||||
br_active_light active_lights_model[16];
|
||||
br_active_light active_lights_view[16];
|
||||
br_uint_16 nactive_lights_model;
|
||||
br_uint_16 nactive_lights_view;
|
||||
int light_is_1md;
|
||||
br_vector3 eye_l;
|
||||
br_active_clip_plane active_clip_planes[6];
|
||||
br_uint_16 nactive_clip_planes;
|
||||
br_actor* enabled_lights[16];
|
||||
br_actor* enabled_clip_planes[6];
|
||||
br_actor* enabled_environment;
|
||||
br_pixelmap* output;
|
||||
br_scalar vp_width;
|
||||
br_scalar vp_height;
|
||||
br_scalar vp_ox;
|
||||
br_scalar vp_oy;
|
||||
int rendering;
|
||||
br_registry reg_models;
|
||||
br_registry reg_materials;
|
||||
br_registry reg_textures;
|
||||
br_registry reg_tables;
|
||||
br_registry reg_resource_classes;
|
||||
br_resource_class* resource_class_index[256];
|
||||
br_model_update_cbfn* model_update;
|
||||
br_material_update_cbfn* material_update;
|
||||
br_table_update_cbfn* table_update;
|
||||
br_map_update_cbfn* map_update;
|
||||
br_filesystem* fsys;
|
||||
br_allocator* mem;
|
||||
br_errorhandler* err;
|
||||
int open_mode;
|
||||
void* res;
|
||||
br_model* default_model;
|
||||
br_material* default_material;
|
||||
fw_fn_table fn_table;
|
||||
void* scratch_ptr;
|
||||
br_size_t scratch_size;
|
||||
br_size_t scratch_last;
|
||||
int scratch_inuse;
|
||||
} br_framework_state_2;
|
||||
typedef struct br_framework_state2 { // size: 0x14d4
|
||||
br_surface_fn* surface_fn; // @0x0
|
||||
br_surface_fn* surface_fn_after_map; // @0x4
|
||||
br_surface_fn* surface_fn_after_copy; // @0x8
|
||||
br_face_surface_fn* face_surface_fn; // @0xc
|
||||
br_matrix23 map_transform; // @0x10
|
||||
br_scalar index_base; // @0x28
|
||||
br_scalar index_range; // @0x2c
|
||||
br_matrix4 model_to_screen; // @0x30
|
||||
br_matrix4 view_to_screen; // @0x70
|
||||
br_matrix34 model_to_view; // @0xb0
|
||||
br_matrix34 view_to_model; // @0xe0
|
||||
br_matrix34 model_to_environment; // @0x110
|
||||
struct { // size: 0x34
|
||||
br_matrix34 m; // @0x0
|
||||
br_actor* a; // @0x30
|
||||
} camera_path; // @0x140
|
||||
int vtos_type; // @0x480
|
||||
br_vector3 eye_m; // @0x484
|
||||
br_vector3 eye_m_normalised; // @0x490
|
||||
br_material* material; // @0x49c
|
||||
br_active_light active_lights_model[16]; // @0x4a0
|
||||
br_active_light active_lights_view[16]; // @0x9e0
|
||||
br_uint_16 nactive_lights_model; // @0xf20
|
||||
br_uint_16 nactive_lights_view; // @0xf22
|
||||
int light_is_1md; // @0xf24
|
||||
br_vector3 eye_l; // @0xf28
|
||||
br_active_clip_plane active_clip_planes[6]; // @0xf34
|
||||
br_uint_16 nactive_clip_planes; // @0xf94
|
||||
br_actor* enabled_lights[16]; // @0xf98
|
||||
br_actor* enabled_clip_planes[6]; // @0xfd8
|
||||
br_actor* enabled_environment; // @0xff0
|
||||
br_pixelmap* output; // @0xff4
|
||||
br_scalar vp_width; // @0xff8
|
||||
br_scalar vp_height; // @0xffc
|
||||
br_scalar vp_ox; // @0x1000
|
||||
br_scalar vp_oy; // @0x1004
|
||||
int rendering; // @0x1008
|
||||
br_registry reg_models; // @0x100c
|
||||
br_registry reg_materials; // @0x1020
|
||||
br_registry reg_textures; // @0x1034
|
||||
br_registry reg_tables; // @0x1048
|
||||
br_registry reg_resource_classes; // @0x105c
|
||||
br_resource_class* resource_class_index[256]; // @0x1070
|
||||
br_model_update_cbfn* model_update; // @0x1470
|
||||
br_material_update_cbfn* material_update; // @0x1474
|
||||
br_table_update_cbfn* table_update; // @0x1478
|
||||
br_map_update_cbfn* map_update; // @0x147c
|
||||
br_filesystem* fsys; // @0x1480
|
||||
br_allocator* mem; // @0x1484
|
||||
br_errorhandler* err; // @0x1488
|
||||
int open_mode; // @0x148c
|
||||
void* res; // @0x1490
|
||||
br_model* default_model; // @0x1494
|
||||
br_material* default_material; // @0x1498
|
||||
fw_fn_table fn_table; // @0x149c
|
||||
void* scratch_ptr; // @0x14c4
|
||||
br_size_t scratch_size; // @0x14c8
|
||||
br_size_t scratch_last; // @0x14cc
|
||||
int scratch_inuse; // @0x14d0
|
||||
} br_framework_state2;
|
||||
|
||||
typedef br_error br_exception;
|
||||
typedef void br_resident_fn();
|
||||
|
@ -1785,63 +1807,63 @@ typedef struct br_buffer_stored {
|
|||
br_buffer_stored_dispatch* dispatch;
|
||||
} br_buffer_stored;
|
||||
|
||||
typedef struct br_device_pixelmap_dispatch {
|
||||
void (*__reserved0)(br_object*);
|
||||
void (*__reserved1)(br_object*);
|
||||
void (*__reserved2)(br_object*);
|
||||
void (*__reserved3)(br_object*);
|
||||
void (*_free)(br_object*);
|
||||
char* (*_identifier)(br_object*);
|
||||
br_token (*_type)(br_object*);
|
||||
br_boolean (*_isType)(br_object*, br_token);
|
||||
br_device* (*_device)(br_object*);
|
||||
br_int_32 (*_space)(br_object*);
|
||||
br_tv_template* (*_templateQuery)(br_object*);
|
||||
br_error (*_query)(br_object*, br_uint_32*, br_token);
|
||||
br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token);
|
||||
br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*);
|
||||
br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*);
|
||||
br_error (*_queryAll)(br_object*, br_token_value*, br_size_t);
|
||||
br_error (*_queryAllSize)(br_object*, br_size_t*);
|
||||
br_error (*_validSource)(br_device_pixelmap*, br_boolean*, br_object*);
|
||||
br_error (*_resize)(br_device_pixelmap*, br_int_32, br_int_32);
|
||||
br_error (*_match)(br_device_pixelmap*, br_device_pixelmap**, br_token_value*);
|
||||
br_error (*_allocateSub)(br_device_pixelmap*, br_device_pixelmap**, br_rectangle*);
|
||||
br_error (*_copy)(br_device_pixelmap*, br_device_pixelmap*);
|
||||
br_error (*_copyTo)(br_device_pixelmap*, br_device_pixelmap*);
|
||||
br_error (*_copyFrom)(br_device_pixelmap*, br_device_pixelmap*);
|
||||
br_error (*_fill)(br_device_pixelmap*, br_uint_32);
|
||||
br_error (*_doubleBuffer)(br_device_pixelmap*, br_device_pixelmap*);
|
||||
br_error (*_copyDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);
|
||||
br_error (*_copyToDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);
|
||||
br_error (*_copyFromDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);
|
||||
br_error (*_fillDirty)(br_device_pixelmap*, br_uint_32, br_rectangle*, br_int_32);
|
||||
br_error (*_doubleBufferDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32);
|
||||
br_error (*_rectangle)(br_device_pixelmap*, br_rectangle*, br_uint_32);
|
||||
br_error (*_rectangle2)(br_device_pixelmap*, br_rectangle*, br_uint_32, br_uint_32);
|
||||
br_error (*_rectangleCopy)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleCopyTo)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleCopyFrom)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleStretchCopy)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleStretchCopyTo)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleStretchCopyFrom)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*);
|
||||
br_error (*_rectangleFill)(br_device_pixelmap*, br_rectangle*, br_uint_32);
|
||||
br_error (*_pixelSet)(br_device_pixelmap*, br_point*, br_uint_32);
|
||||
br_error (*_line)(br_device_pixelmap*, br_point*, br_point*, br_uint_32);
|
||||
br_error (*_copyBits)(br_device_pixelmap*, br_point*, br_uint_8*, br_uint_16, br_rectangle*, br_uint_32);
|
||||
br_error (*_text)(br_device_pixelmap*, br_point*, br_font*, char*, br_uint_32);
|
||||
br_error (*_textBounds)(br_device_pixelmap*, br_rectangle*, br_font*, char*);
|
||||
br_error (*_rowSize)(br_device_pixelmap*, br_size_t*);
|
||||
br_error (*_rowSet)(br_device_pixelmap*, void*, br_size_t, br_uint_32);
|
||||
br_error (*_rowQuery)(br_device_pixelmap*, void*, br_size_t, br_uint_32);
|
||||
br_error (*_pixelQuery)(br_device_pixelmap*, br_uint_32*, br_point*);
|
||||
br_error (*_pixelAddressQuery)(br_device_pixelmap*, void**, br_uint_32*, br_point*);
|
||||
br_error (*_pixelAddressSet)(br_device_pixelmap*, void*, br_uint_32*);
|
||||
br_error (*_originSet)(br_device_pixelmap*, br_point*);
|
||||
br_error (*_flush)(br_device_pixelmap*);
|
||||
br_error (*_synchronise)(br_device_pixelmap*, br_token, br_boolean);
|
||||
br_error (*_directLock)(br_device_pixelmap*, br_boolean);
|
||||
br_error (*_directUnlock)(br_device_pixelmap*);
|
||||
typedef struct br_device_pixelmap_dispatch { // size: 0xe0
|
||||
void (*__reserved0)(br_object*); // @0x0
|
||||
void (*__reserved1)(br_object*); // @0x4
|
||||
void (*__reserved2)(br_object*); // @0x8
|
||||
void (*__reserved3)(br_object*); // @0xc
|
||||
void (*_free)(br_object*); // @0x10
|
||||
char* (*_identifier)(br_object*); // @0x14
|
||||
br_token (*_type)(br_object*); // @0x18
|
||||
br_boolean (*_isType)(br_object*, br_token); // @0x1c
|
||||
br_device* (*_device)(br_object*); // @0x20
|
||||
br_int_32 (*_space)(br_object*); // @0x24
|
||||
br_tv_template* (*_templateQuery)(br_object*); // @0x28
|
||||
br_error (*_query)(br_object*, br_uint_32*, br_token); // @0x2c
|
||||
br_error (*_queryBuffer)(br_object*, br_uint_32*, void*, br_size_t, br_token); // @0x30
|
||||
br_error (*_queryMany)(br_object*, br_token_value*, void*, br_size_t, br_int_32*); // @0x34
|
||||
br_error (*_queryManySize)(br_object*, br_size_t*, br_token_value*); // @0x38
|
||||
br_error (*_queryAll)(br_object*, br_token_value*, br_size_t); // @0x3c
|
||||
br_error (*_queryAllSize)(br_object*, br_size_t*); // @0x40
|
||||
br_error (*_validSource)(br_device_pixelmap*, br_boolean*, br_object*); // @0x44
|
||||
br_error (*_resize)(br_device_pixelmap*, br_int_32, br_int_32); // @0x48
|
||||
br_error (*_match)(br_device_pixelmap*, br_device_pixelmap**, br_token_value*); // @0x4c
|
||||
br_error (*_allocateSub)(br_device_pixelmap*, br_device_pixelmap**, br_rectangle*); // @0x50
|
||||
br_error (*_copy)(br_device_pixelmap*, br_device_pixelmap*); // @0x54
|
||||
br_error (*_copyTo)(br_device_pixelmap*, br_device_pixelmap*); // @0x58
|
||||
br_error (*_copyFrom)(br_device_pixelmap*, br_device_pixelmap*); // @0x5c
|
||||
br_error (*_fill)(br_device_pixelmap*, br_uint_32); // @0x60
|
||||
br_error (*_doubleBuffer)(br_device_pixelmap*, br_device_pixelmap*); // @0x64
|
||||
br_error (*_copyDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32); // @0x68
|
||||
br_error (*_copyToDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32); // @0x6c
|
||||
br_error (*_copyFromDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32); // @0x70
|
||||
br_error (*_fillDirty)(br_device_pixelmap*, br_uint_32, br_rectangle*, br_int_32); // @0x74
|
||||
br_error (*_doubleBufferDirty)(br_device_pixelmap*, br_device_pixelmap*, br_rectangle*, br_int_32); // @0x78
|
||||
br_error (*_rectangle)(br_device_pixelmap*, br_rectangle*, br_uint_32); // @0x7c
|
||||
br_error (*_rectangle2)(br_device_pixelmap*, br_rectangle*, br_uint_32, br_uint_32); // @0x80
|
||||
br_error (*_rectangleCopy)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*); // @0x84
|
||||
br_error (*_rectangleCopyTo)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*); // @0x88
|
||||
br_error (*_rectangleCopyFrom)(br_device_pixelmap*, br_point*, br_device_pixelmap*, br_rectangle*); // @0x8c
|
||||
br_error (*_rectangleStretchCopy)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*); // @0x90
|
||||
br_error (*_rectangleStretchCopyTo)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*); // @0x94
|
||||
br_error (*_rectangleStretchCopyFrom)(br_device_pixelmap*, br_rectangle*, br_device_pixelmap*, br_rectangle*); // @0x98
|
||||
br_error (*_rectangleFill)(br_device_pixelmap*, br_rectangle*, br_uint_32); // @0x9c
|
||||
br_error (*_pixelSet)(br_device_pixelmap*, br_point*, br_uint_32); // @0xa0
|
||||
br_error (*_line)(br_device_pixelmap*, br_point*, br_point*, br_uint_32); // @0xa4
|
||||
br_error (*_copyBits)(br_device_pixelmap*, br_point*, br_uint_8*, br_uint_16, br_rectangle*, br_uint_32); // @0xa8
|
||||
br_error (*_text)(br_device_pixelmap*, br_point*, br_font*, char*, br_uint_32); // @0xac
|
||||
br_error (*_textBounds)(br_device_pixelmap*, br_rectangle*, br_font*, char*); // @0xb0
|
||||
br_error (*_rowSize)(br_device_pixelmap*, br_size_t*); // @0xb4
|
||||
br_error (*_rowSet)(br_device_pixelmap*, void*, br_size_t, br_uint_32); // @0xb8
|
||||
br_error (*_rowQuery)(br_device_pixelmap*, void*, br_size_t, br_uint_32); // @0xbc
|
||||
br_error (*_pixelQuery)(br_device_pixelmap*, br_uint_32*, br_point*); // @0xc0
|
||||
br_error (*_pixelAddressQuery)(br_device_pixelmap*, void**, br_uint_32*, br_point*); // @0xc4
|
||||
br_error (*_pixelAddressSet)(br_device_pixelmap*, void*, br_uint_32*); // @0xc8
|
||||
br_error (*_originSet)(br_device_pixelmap*, br_point*); // @0xcc
|
||||
br_error (*_flush)(br_device_pixelmap*); // @0xd0
|
||||
br_error (*_synchronise)(br_device_pixelmap*, br_token, br_boolean); // @0xd4
|
||||
br_error (*_directLock)(br_device_pixelmap*, br_boolean); // @0xd8
|
||||
br_error (*_directUnlock)(br_device_pixelmap*); // @0xdc
|
||||
} br_device_pixelmap_dispatch;
|
||||
|
||||
typedef struct br_buffer_stored_dispatch {
|
||||
|
@ -2100,52 +2122,52 @@ typedef struct br_v1db_enable {
|
|||
br_actor** enabled;
|
||||
} br_v1db_enable;
|
||||
|
||||
typedef struct br_v1db_state {
|
||||
br_boolean active;
|
||||
br_boolean zs_active;
|
||||
br_boolean zb_active;
|
||||
br_int_32 rendering;
|
||||
br_renderer* renderer;
|
||||
br_renderer* query_renderer;
|
||||
br_geometry* format_model;
|
||||
br_geometry* format_buckets;
|
||||
br_geometry_lighting* format_lighting;
|
||||
br_matrix4 model_to_screen;
|
||||
br_matrix34 model_to_view;
|
||||
br_boolean model_to_screen_valid;
|
||||
br_uint_32 ttype;
|
||||
br_actor* render_root;
|
||||
struct {
|
||||
br_matrix34 m;
|
||||
br_actor* a;
|
||||
br_uint_8 transform_type;
|
||||
};
|
||||
br_v1db_enable enabled_lights;
|
||||
br_v1db_enable enabled_clip_planes;
|
||||
br_v1db_enable enabled_horizon_planes;
|
||||
br_int_32 max_light;
|
||||
br_int_32 max_clip;
|
||||
br_actor* enabled_environment;
|
||||
br_registry reg_models;
|
||||
br_registry reg_materials;
|
||||
br_registry reg_textures;
|
||||
br_registry reg_tables;
|
||||
void* res;
|
||||
br_model* default_model;
|
||||
br_material* default_material;
|
||||
void* default_render_data;
|
||||
br_order_table* default_order_table;
|
||||
br_order_table* primary_order_table;
|
||||
br_order_table* order_table_list;
|
||||
br_primitive_heap heap;
|
||||
br_primitive_cbfn* primitive_call;
|
||||
br_renderbounds_cbfn* bounds_call;
|
||||
br_vector2 origin;
|
||||
br_scalar vp_ox;
|
||||
br_scalar vp_oy;
|
||||
br_scalar vp_width;
|
||||
br_scalar vp_height;
|
||||
br_pixelmap* colour_buffer;
|
||||
typedef struct br_v1db_state { // size: 0x504
|
||||
br_boolean active; // @0x0
|
||||
br_boolean zs_active; // @0x4
|
||||
br_boolean zb_active; // @0x8
|
||||
br_int_32 rendering; // @0xc
|
||||
br_renderer* renderer; // @0x10
|
||||
br_renderer* query_renderer; // @0x14
|
||||
br_geometry* format_model; // @0x18
|
||||
br_geometry* format_buckets; // @0x1c
|
||||
br_geometry_lighting* format_lighting; // @0x20
|
||||
br_matrix4 model_to_screen; // @0x24
|
||||
br_matrix34 model_to_view; // @0x64
|
||||
br_boolean model_to_screen_valid; // @0x94
|
||||
br_uint_32 ttype; // @0x98
|
||||
br_actor* render_root; // @0x9c
|
||||
struct { // size: 0x38
|
||||
br_matrix34 m; // @0x0
|
||||
br_actor* a; // @0x30
|
||||
br_uint_8 transform_type; // @0x34
|
||||
} camera_path; // @0xa0
|
||||
br_v1db_enable enabled_lights; // @0x420
|
||||
br_v1db_enable enabled_clip_planes; // @0x434
|
||||
br_v1db_enable enabled_horizon_planes; // @0x448
|
||||
br_int_32 max_light; // @0x45c
|
||||
br_int_32 max_clip; // @0x460
|
||||
br_actor* enabled_environment; // @0x464
|
||||
br_registry reg_models; // @0x468
|
||||
br_registry reg_materials; // @0x47c
|
||||
br_registry reg_textures; // @0x490
|
||||
br_registry reg_tables; // @0x4a4
|
||||
void* res; // @0x4b8
|
||||
br_model* default_model; // @0x4bc
|
||||
br_material* default_material; // @0x4c0
|
||||
void* default_render_data; // @0x4c4
|
||||
br_order_table* default_order_table; // @0x4c8
|
||||
br_order_table* primary_order_table; // @0x4cc
|
||||
br_order_table* order_table_list; // @0x4d0
|
||||
br_primitive_heap heap; // @0x4d4
|
||||
br_primitive_cbfn* primitive_call; // @0x4e0
|
||||
br_renderbounds_cbfn* bounds_call; // @0x4e4
|
||||
br_vector2 origin; // @0x4e8
|
||||
br_scalar vp_ox; // @0x4f0
|
||||
br_scalar vp_oy; // @0x4f4
|
||||
br_scalar vp_width; // @0x4f8
|
||||
br_scalar vp_height; // @0x4fc
|
||||
br_pixelmap* colour_buffer; // @0x500
|
||||
} br_v1db_state;
|
||||
|
||||
typedef struct br_renderer_facility_dispatch {
|
||||
|
@ -2367,7 +2389,7 @@ typedef struct br_lexer_token {
|
|||
br_int_32 integer;
|
||||
float real;
|
||||
char* string;
|
||||
};
|
||||
} v;
|
||||
} br_lexer_token;
|
||||
|
||||
typedef struct br_lexer_keyword {
|
||||
|
@ -2791,4 +2813,108 @@ typedef struct v11model {
|
|||
v11group* groups;
|
||||
} v11model;
|
||||
|
||||
// From BRender SDK v1.2
|
||||
/*
|
||||
* Basic types of actor
|
||||
*/
|
||||
enum {
|
||||
BR_ACTOR_NONE,
|
||||
BR_ACTOR_MODEL,
|
||||
BR_ACTOR_LIGHT,
|
||||
BR_ACTOR_CAMERA,
|
||||
_BR_ACTOR_RESERVED,
|
||||
BR_ACTOR_BOUNDS,
|
||||
BR_ACTOR_BOUNDS_CORRECT,
|
||||
BR_ACTOR_CLIP_PLANE,
|
||||
BR_ACTOR_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* Render styles - an actor inherits it's style from the most _distant_
|
||||
* ancestor included in this traversal that does not have default set
|
||||
* (unlike model & material which are inherited from the nearest ancestor)
|
||||
*/
|
||||
enum {
|
||||
BR_RSTYLE_DEFAULT,
|
||||
BR_RSTYLE_NONE,
|
||||
BR_RSTYLE_POINTS,
|
||||
BR_RSTYLE_EDGES,
|
||||
BR_RSTYLE_FACES,
|
||||
BR_RSTYLE_BOUNDING_POINTS,
|
||||
BR_RSTYLE_BOUNDING_EDGES,
|
||||
BR_RSTYLE_BOUNDING_FACES,
|
||||
BR_RSTYLE_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
BR_LIGHT_POINT = 0x0000,
|
||||
BR_LIGHT_DIRECT = 0x0001,
|
||||
BR_LIGHT_SPOT = 0x0002,
|
||||
BR_LIGHT_TYPE = 0x0003,
|
||||
|
||||
/*
|
||||
* Flag idicating that caluculations are done in view space
|
||||
*/
|
||||
BR_LIGHT_VIEW = 0x0004
|
||||
};
|
||||
|
||||
enum {
|
||||
BR_CAMERA_PARALLEL,
|
||||
BR_CAMERA_PERSPECTIVE_FOV,
|
||||
BR_CAMERA_PERSPECTIVE_WHD
|
||||
};
|
||||
|
||||
/*
|
||||
* Various types of pixel
|
||||
*/
|
||||
enum {
|
||||
/*
|
||||
* Each pixel is an index into a colour map
|
||||
*/
|
||||
BR_PMT_INDEX_1,
|
||||
BR_PMT_INDEX_2,
|
||||
BR_PMT_INDEX_4,
|
||||
BR_PMT_INDEX_8,
|
||||
|
||||
/*
|
||||
* True colour RGB
|
||||
*/
|
||||
BR_PMT_RGB_555, /* 16 bits per pixel */
|
||||
BR_PMT_RGB_565, /* 16 bits per pixel */
|
||||
BR_PMT_RGB_888, /* 24 bits per pixel */
|
||||
BR_PMT_RGBX_888, /* 32 bits per pixel */
|
||||
BR_PMT_RGBA_8888, /* 32 bits per pixel */
|
||||
|
||||
/*
|
||||
* YUV
|
||||
*/
|
||||
BR_PMT_YUYV_8888, /* YU YV YU YV ... */
|
||||
BR_PMT_YUV_888,
|
||||
|
||||
/*
|
||||
* Depth
|
||||
*/
|
||||
BR_PMT_DEPTH_16,
|
||||
BR_PMT_DEPTH_32,
|
||||
|
||||
/*
|
||||
* Opacity
|
||||
*/
|
||||
BR_PMT_ALPHA_8,
|
||||
|
||||
/*
|
||||
* Opacity + Index
|
||||
*/
|
||||
BR_PMT_INDEXA_88
|
||||
};
|
||||
|
||||
#define BR_COLOUR_RGB(r, g, b) \
|
||||
((((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
|
||||
|
||||
#define BR_ANGLE_DEG(deg) ((br_angle)((deg)*182))
|
||||
#define BR_ANGLE_RAD(rad) ((br_angle)((rad)*10430))
|
||||
|
||||
#define BR_SCALAR(x) ((br_scalar)(x))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
#include "CORE/DOSIO/dosio.h"
|
||||
#include "CORE/FW/fwsetup.h"
|
||||
#include "CORE/FW/resource.h"
|
||||
#include "CORE/FW/resreg.h"
|
||||
#include "CORE/MATH/matrix34.h"
|
||||
#include "CORE/PIXELMAP/pixelmap.h"
|
||||
#include "CORE/PIXELMAP/pmdsptch.h"
|
||||
#include "CORE/V1DB/actsupt.h"
|
||||
#include "CORE/V1DB/dbsetup.h"
|
||||
#include "CORE/V1DB/enables.h"
|
||||
#include "CORE/V1DB/matsupt.h"
|
||||
#include "CORE/V1DB/prepmatl.h"
|
||||
#include "CORE/V1DB/regsupt.h"
|
|
@ -3,13 +3,15 @@ TARGET_EXEC ?= c1
|
|||
BUILD_DIR ?= ./build
|
||||
SRC_DIR ?= .
|
||||
BR_SRC_DIR ?= ../BRSRC13
|
||||
FW_SRC_DIR ?= ../framework
|
||||
|
||||
SRCS := $(shell find $(SRC_DIR) -name "*.c")
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
OBJS += $(shell find $(BR_SRC_DIR) -name "*.o")
|
||||
OBJS += $(shell find $(FW_SRC_DIR) -name "*.o")
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d) $(BR_SRC_DIR)
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d) $(BR_SRC_DIR) $(FW_SRC_DIR)
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
CFLAGS ?= $(INC_FLAGS) -g -Wno-return-type -Wno-missing-declarations -Werror=implicit-function-declaration
|
||||
|
|
|
@ -1,11 +1,261 @@
|
|||
#include "drmem.h"
|
||||
#include "CORE/FW/resreg.h"
|
||||
#include "brender.h"
|
||||
#include "errors.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
br_resource_class gStainless_classes[118];
|
||||
char* gMem_names[247];
|
||||
char* gMem_names[247] = {
|
||||
NULL,
|
||||
"BR_MEMORY_SCRATCH",
|
||||
"BR_MEMORY_PIXELMAP",
|
||||
"BR_MEMORY_PIXELS",
|
||||
"BR_MEMORY_VERTICES",
|
||||
"BR_MEMORY_FACES",
|
||||
"BR_MEMORY_GROUPS",
|
||||
"BR_MEMORY_MODEL",
|
||||
"BR_MEMORY_MATERIAL",
|
||||
"BR_MEMORY_MATERIAL_INDEX",
|
||||
"BR_MEMORY_ACTOR",
|
||||
"BR_MEMORY_PREPARED_VERTICES",
|
||||
"BR_MEMORY_PREPARED_FACES",
|
||||
"BR_MEMORY_LIGHT",
|
||||
"BR_MEMORY_CAMERA",
|
||||
"BR_MEMORY_BOUNDS",
|
||||
"BR_MEMORY_CLIP_PLANE",
|
||||
"BR_MEMORY_STRING",
|
||||
"BR_MEMORY_REGISTRY",
|
||||
"BR_MEMORY_TRANSFORM",
|
||||
"BR_MEMORY_RESOURCE_CLASS",
|
||||
"BR_MEMORY_FILE",
|
||||
"BR_MEMORY_ANCHOR",
|
||||
"BR_MEMORY_POOL",
|
||||
"BR_MEMORY_RENDER_MATERIAL",
|
||||
"BR_MEMORY_DATAFILE",
|
||||
"BR_MEMORY_IMAGE",
|
||||
"BR_MEMORY_IMAGE_ARENA",
|
||||
"BR_MEMORY_IMAGE_SECTIONS",
|
||||
"BR_MEMORY_IMAGE_NAMES",
|
||||
"BR_MEMORY_EXCEPTION_HANDLER",
|
||||
"BR_MEMORY_RENDER_DATA",
|
||||
"BR_MEMORY_TOKEN",
|
||||
"BR_MEMORY_TOKEN_MAP",
|
||||
"BR_MEMORY_OBJECT",
|
||||
"BR_MEMORY_OBJECT_DATA",
|
||||
"BR_MEMORY_DRIVER",
|
||||
"BR_MEMORY_LEXER",
|
||||
"BR_MEMORY_OBJECT_LIST",
|
||||
"BR_MEMORY_OBJECT_LIST_ENTRY",
|
||||
"BR_MEMORY_ENABLED_ACTORS",
|
||||
"BR_MEMORY_FMT_RESULTS",
|
||||
"BR_MEMORY_PREPARED_MODEL",
|
||||
"BR_MEMORY_ORDER_TABLE",
|
||||
"BR_MEMORY_TOKEN_VALUE",
|
||||
"BR_MEMORY_TOKEN_TEMPLATE",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"kMem_intf_pix_copy",
|
||||
"kMem_intf_pal_copy",
|
||||
"kMem_nodes_array",
|
||||
"kMem_sections_array",
|
||||
"kMem_key_names",
|
||||
"kMem_columns_z",
|
||||
"kMem_columns_x",
|
||||
"kMem_non_car_list",
|
||||
"kMem_simp_level",
|
||||
"kMem_crush_data",
|
||||
"kMem_crush_neighbours",
|
||||
"kMem_temp_fs",
|
||||
"kMem_error_pix_copy",
|
||||
"kMem_error_pal_copy",
|
||||
"kMem_flic_pal",
|
||||
"kMem_flic_data",
|
||||
"kMem_flic_data_2",
|
||||
"kMem_queued_flic",
|
||||
"kFlic_panel_pixels",
|
||||
"kMem_translations",
|
||||
"kMem_translations_text",
|
||||
"kMem_cur_pal_pixels",
|
||||
"kMem_render_pal_pixels",
|
||||
"kMem_scratch_pal_pixels",
|
||||
"kMem_shade_table_copy",
|
||||
"kMem_rear_screen_pixels",
|
||||
"kMem_rolling_letters",
|
||||
"kMem_intf_copy_areas",
|
||||
"kMem_strip_image",
|
||||
"kMem_strip_image_perm",
|
||||
"kMem_damage_clauses",
|
||||
"kMem_undamaged_vertices",
|
||||
"kMem_race_text_chunk",
|
||||
"kMem_race_text_str",
|
||||
"kMem_oppo_array",
|
||||
"kMem_oppo_text_chunk",
|
||||
"kMem_oppo_text_str",
|
||||
"kMem_br_font",
|
||||
"kMem_br_font_wid",
|
||||
"kMem_br_font_enc",
|
||||
"kMem_br_font_glyphs",
|
||||
"kMem_oppo_car_spec",
|
||||
"kMem_misc_string",
|
||||
"kMem_mac_host_buffer_1",
|
||||
"kMem_mac_host_buffer_2",
|
||||
"kMem_mac_net_details",
|
||||
"kMem_back_pixels",
|
||||
"kMem_quit_vfy_pixels",
|
||||
"kMem_quit_vfy_pal",
|
||||
"kMem_net_min_messages",
|
||||
"kMem_net_mid_messages",
|
||||
"kMem_net_max_messages",
|
||||
"kMem_net_pid_details",
|
||||
"kMem_net_car_spec",
|
||||
"kMem_dynamic_message",
|
||||
"kMem_player_list_join",
|
||||
"kMem_player_list_leave",
|
||||
"kMem_oppo_new_nodes",
|
||||
"kMem_oppo_new_sections",
|
||||
"kMem_cop_car_spec",
|
||||
"kMem_oppo_bit_per_node",
|
||||
"kMem_ped_action_list",
|
||||
"kMem_ped_sequences",
|
||||
"kMem_ped_array_stain",
|
||||
"kMem_ped_array",
|
||||
"kMem_ped_instructions",
|
||||
"kMem_ped_new_instruc",
|
||||
"kMem_pipe_model_geometry",
|
||||
"kMem_powerup_array",
|
||||
"kMem_powerup_float_parms",
|
||||
"kMem_powerup_int_parms",
|
||||
"kMem_drugs_palette",
|
||||
"kMem_pratcam_flic_array",
|
||||
"kMem_pratcam_flic_data",
|
||||
"kMem_pratcam_sequence_array",
|
||||
"kMem_pratcam_pixelmap",
|
||||
"kMem_video_pixels",
|
||||
"kMem_funk_prox_array",
|
||||
"kMem_new_mat_id",
|
||||
"kMem_new_mat_id_2",
|
||||
"kMem_new_mat_id_3",
|
||||
"kMem_special_volume",
|
||||
"kMem_special_screen",
|
||||
"kMem_new_special_vol",
|
||||
"kMem_saved_game",
|
||||
"kMem_new_save_game",
|
||||
"kMem_stor_space_pix",
|
||||
"kMem_stor_space_tab",
|
||||
"kMem_stor_space_mat",
|
||||
"kMem_stor_space_mod",
|
||||
"kMem_stor_space_save",
|
||||
"kMem_funk_spec",
|
||||
"kMem_groove_spec",
|
||||
"kMem_non_car_spec",
|
||||
"kMem_S3_scan_name",
|
||||
"kMem_S3_sound_header",
|
||||
"kMem_S3_sample",
|
||||
"kMem_S3_mac_channel",
|
||||
"kMem_S3_mac_path",
|
||||
"kMem_S3_sentinel",
|
||||
"kMem_S3_outlet",
|
||||
"kMem_S3_channel",
|
||||
"kMem_S3_descriptor",
|
||||
"kMem_S3_reverse_buffer",
|
||||
"kMem_S3_source",
|
||||
"kMem_S3_DOS_SOS_channel",
|
||||
"kMem_S3_PC_DOS_path",
|
||||
"kMem_S3_DOS_SOS_patch",
|
||||
"kMem_S3_DOS_SOS_song_structure",
|
||||
"kMem_S3_DOS_SOS_song_data",
|
||||
"kMem_S3_Windows_95_load_WAV_file",
|
||||
"kMem_S3_Windows_95_create_temp_buffer_space_to_reverse_sample",
|
||||
"kMem_S3_Windows_95_path",
|
||||
"kMem_DOS_HMI_file_open",
|
||||
"kMem_abuse_text",
|
||||
"kMem_action_replay_buffer",
|
||||
"kMem_misc",
|
||||
"Unable to support this screen depth setting"
|
||||
};
|
||||
|
||||
int gNon_fatal_allocation_errors;
|
||||
br_allocator gAllocator;
|
||||
br_allocator gAllocator = { "Death Race", DRStdlibAllocate, DRStdlibFree, DRStdlibInquire, Claim4ByteAlignment };
|
||||
|
||||
// Offset: 0
|
||||
// Size: 44
|
||||
|
@ -42,27 +292,41 @@ void* DRStdlibAllocate(br_size_t size, br_uint_8 type) {
|
|||
void* p;
|
||||
int i;
|
||||
char s[256];
|
||||
|
||||
if (!size) {
|
||||
return NULL;
|
||||
}
|
||||
p = malloc(size);
|
||||
if (!p && !gNon_fatal_allocation_errors) {
|
||||
sprintf(s, "%s/%d", gMem_names[type], size);
|
||||
FatalError(94, s);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
// Offset: 404
|
||||
// Size: 38
|
||||
void DRStdlibFree(void* mem) {
|
||||
int i;
|
||||
free(mem);
|
||||
}
|
||||
|
||||
// Offset: 444
|
||||
// Size: 40
|
||||
br_size_t DRStdlibInquire(br_uint_8 type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Offset: 484
|
||||
// Size: 40
|
||||
br_uint_32 Claim4ByteAlignment(br_uint_8 type) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
// Offset: 524
|
||||
// Size: 48
|
||||
void InstallDRMemCalls() {
|
||||
BrAllocatorSet(&gAllocator);
|
||||
}
|
||||
|
||||
// Offset: 572
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "graphics.h"
|
||||
|
||||
#include "brender.h"
|
||||
#include "errors.h"
|
||||
#include "globvars.h"
|
||||
#include "init.h"
|
||||
#include "pc-dos/dossys.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
int gArrows[2][4][60];
|
||||
|
@ -244,6 +251,39 @@ void CopyStripImage(br_pixelmap* pDest, br_int_16 pDest_x, br_int_16 pOffset_x,
|
|||
// EBX: pWidth
|
||||
// ECX: pHeight
|
||||
void SetBRenderScreenAndBuffers(int pX_offset, int pY_offset, int pWidth, int pHeight) {
|
||||
LOG_TRACE("(%d, %d, %d, %d)", pX_offset, pY_offset, pWidth, pHeight);
|
||||
|
||||
PDInitScreen();
|
||||
if (!pWidth) {
|
||||
pWidth = gBack_screen->width;
|
||||
}
|
||||
if (!pHeight) {
|
||||
pHeight = gBack_screen->height;
|
||||
}
|
||||
gRender_screen = DRPixelmapAllocateSub(gBack_screen, pX_offset, pY_offset, pHeight, pWidth);
|
||||
gWidth = pWidth;
|
||||
gHeight = pHeight;
|
||||
gY_offset = pY_offset;
|
||||
gX_offset = pX_offset;
|
||||
if (gGraf_specs[gGraf_spec_index].doubled) {
|
||||
gScreen->base_x = (gGraf_specs[gGraf_spec_index].phys_width - 2 * gGraf_specs[gGraf_spec_index].total_width) / 2;
|
||||
gScreen->base_y = (gGraf_specs[gGraf_spec_index].phys_height - 2 * gGraf_specs[gGraf_spec_index].total_height) / 2;
|
||||
} else {
|
||||
gScreen->base_x = (gGraf_specs[gGraf_spec_index].phys_width - gGraf_specs[gGraf_spec_index].total_width) / 2;
|
||||
gScreen->base_y = (gGraf_specs[gGraf_spec_index].phys_height - gGraf_specs[gGraf_spec_index].total_height) / 2;
|
||||
}
|
||||
|
||||
gScreen->origin_x = 0;
|
||||
gScreen->origin_y = 0;
|
||||
if (!gBack_screen) {
|
||||
FatalError(1);
|
||||
}
|
||||
gDepth_buffer = BrPixelmapMatch(gBack_screen, BR_PMMATCH_DEPTH_16);
|
||||
if (!gDepth_buffer) {
|
||||
FatalError(2);
|
||||
}
|
||||
BrZbBegin(gRender_screen->type, gDepth_buffer->type);
|
||||
gBrZb_initialized = 1;
|
||||
}
|
||||
|
||||
// Offset: 3284
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
#include "common/depth.h"
|
||||
#include "common/displays.h"
|
||||
#include "common/drdebug.h"
|
||||
#include "common/drfile.h"
|
||||
#include "common/drmem.h"
|
||||
#include "common/errors.h"
|
||||
#include "common/flicplay.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/globvrkm.h"
|
||||
#include "common/grafdata.h"
|
||||
#include "common/graphics.h"
|
||||
#include "common/loading.h"
|
||||
|
@ -45,7 +47,50 @@ void AllocateSelf() {
|
|||
// Offset: 116
|
||||
// Size: 514
|
||||
void AllocateCamera() {
|
||||
br_camera* camera_ptr;
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
gCamera_list[i] = BrActorAllocate(BR_ACTOR_CAMERA, NULL);
|
||||
if (!gCamera_list[i]) {
|
||||
FatalError(5);
|
||||
}
|
||||
|
||||
camera_ptr = gCamera_list[i]->type_data;
|
||||
camera_ptr->type = 1;
|
||||
camera_ptr->field_of_view = BR_ANGLE_DEG(gCamera_angle);
|
||||
camera_ptr->hither_z = gCamera_hither;
|
||||
camera_ptr->yon_z = gCamera_yon;
|
||||
camera_ptr->aspect = (double)gWidth / (double)gHeight;
|
||||
}
|
||||
|
||||
gCamera_list[0] = BrActorAdd(gSelf, gCamera_list[0]);
|
||||
if (!gCamera_list[0]) {
|
||||
FatalError(5);
|
||||
}
|
||||
gCamera_list[1] = BrActorAdd(gUniverse_actor, gCamera_list[1]);
|
||||
if (!gCamera_list[1]) {
|
||||
FatalError(5);
|
||||
}
|
||||
gCamera = gCamera_list[0];
|
||||
gRearview_camera = BrActorAllocate(BR_ACTOR_CAMERA, NULL);
|
||||
if (!gRearview_camera) {
|
||||
FatalError(5);
|
||||
}
|
||||
|
||||
gRearview_camera->t.t.mat.m[2][2] = -1.0f;
|
||||
camera_ptr = (br_camera*)gRearview_camera->type_data;
|
||||
camera_ptr->hither_z = gCamera_hither;
|
||||
camera_ptr->type = 1;
|
||||
camera_ptr->yon_z = gCamera_yon;
|
||||
camera_ptr->field_of_view = BR_ANGLE_DEG(gCamera_angle);
|
||||
camera_ptr->aspect = (double)gWidth / (double)gHeight;
|
||||
gRearview_camera = BrActorAdd(gSelf, gRearview_camera);
|
||||
if (!gRearview_camera) {
|
||||
FatalError(5);
|
||||
}
|
||||
SetSightDistance(camera_ptr->yon_z);
|
||||
}
|
||||
|
||||
// Offset: 632
|
||||
|
@ -87,6 +132,43 @@ void AllocateStandardLamp() {
|
|||
// Offset: 2152
|
||||
// Size: 342
|
||||
void InitializeBRenderEnvironment() {
|
||||
br_model* arrow_model;
|
||||
LOG_TRACE("()");
|
||||
|
||||
gBr_initialized = 1;
|
||||
InstallDRMemCalls();
|
||||
InstallDRFileCalls();
|
||||
SetBRenderScreenAndBuffers(0, 0, 0, 0);
|
||||
gUniverse_actor = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
if (!gUniverse_actor) {
|
||||
FatalError(3);
|
||||
}
|
||||
gUniverse_actor->identifier = BrResStrDup(gUniverse_actor, "Root");
|
||||
BrEnvironmentSet(gUniverse_actor);
|
||||
gNon_track_actor = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
if (!gNon_track_actor) {
|
||||
FatalError(3);
|
||||
}
|
||||
BrActorAdd(gUniverse_actor, gNon_track_actor);
|
||||
gDont_render_actor = BrActorAllocate(BR_ACTOR_NONE, 0);
|
||||
if (!gDont_render_actor) {
|
||||
FatalError(3);
|
||||
}
|
||||
gDont_render_actor->render_style = BR_RSTYLE_NONE;
|
||||
BrActorAdd(gUniverse_actor, gDont_render_actor);
|
||||
gSelf = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
if (!gSelf) {
|
||||
FatalError(6);
|
||||
}
|
||||
gSelf = BrActorAdd(gNon_track_actor, gSelf);
|
||||
if (!gSelf) {
|
||||
FatalError(6);
|
||||
}
|
||||
AllocateCamera();
|
||||
arrow_model = LoadModel("CPOINT.DAT");
|
||||
BrModelAdd(arrow_model);
|
||||
gArrow_actor = LoadActor("CPOINT.ACT");
|
||||
gArrow_actor->model = arrow_model;
|
||||
}
|
||||
|
||||
// Offset: 2496
|
||||
|
@ -140,30 +222,36 @@ void InitialiseApplication(int pArgc, char** pArgv) {
|
|||
strcpy(gProgram_state.player_name[1], "DIE ANNA");
|
||||
|
||||
RestoreOptions();
|
||||
|
||||
LoadKeyMapping();
|
||||
|
||||
if (!PDInitScreenVars(pArgc, pArgv)) {
|
||||
FatalError(0);
|
||||
}
|
||||
CalcGrafDataIndex();
|
||||
|
||||
InitializeBRenderEnvironment();
|
||||
InitDRFonts();
|
||||
InitBRFonts();
|
||||
LoadMiscStrings();
|
||||
LoadInRegistees();
|
||||
FinishLoadingGeneral();
|
||||
|
||||
InitializePalettes();
|
||||
AustereWarning();
|
||||
LoadInterfaceStrings();
|
||||
|
||||
InitializeActionReplay();
|
||||
FlicPaletteAllocate();
|
||||
InitInterfaceLoadState();
|
||||
|
||||
InitTransientBitmaps();
|
||||
InitSound();
|
||||
InitHeadups();
|
||||
|
||||
gDefault_track_material = BrMaterialAllocate("gDefault_track_material");
|
||||
//TODO:
|
||||
//BYTE2(gDefault_track_material->map_transform.m[2][1]) = -29;
|
||||
//BYTE3(gDefault_track_material->map_transform.m[2][1]) = 1;
|
||||
gDefault_track_material->index_base = 227;
|
||||
gDefault_track_material->index_range = 1;
|
||||
BrMaterialAdd(gDefault_track_material);
|
||||
InitShadow();
|
||||
InitFlics();
|
||||
|
@ -184,10 +272,11 @@ void InitialiseApplication(int pArgc, char** pArgv) {
|
|||
while (PDGetTotalTime() - gAustere_time < 2000) {
|
||||
}
|
||||
}
|
||||
|
||||
ClearEntireScreen();
|
||||
InitSkids();
|
||||
InitPeds();
|
||||
gProgram_state.cars_available[42] = 0;
|
||||
gProgram_state.track_spec.the_actor = NULL;
|
||||
gCD_is_in_drive = TestForOriginalCarmaCDinDrive();
|
||||
SwitchToLoresMode();
|
||||
DrDebugLog(0, "AFTER APPLICATION INITIALISATION");
|
||||
|
@ -252,6 +341,5 @@ int GetScreenSize() {
|
|||
// EAX: pNew_size
|
||||
void SetScreenSize(int pNew_size) {
|
||||
LOG_TRACE("(%d)", pNew_size);
|
||||
//TOOD: which global var is this pointing to?
|
||||
//gScreen_size = pNew_size;
|
||||
gRender_indent = pNew_size;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
extern int gCredits_per_rank[3];
|
||||
extern int gInitial_credits[3];
|
||||
extern int gInitial_rank;
|
||||
extern int gBrZb_initialized;
|
||||
|
||||
// Offset: 0
|
||||
// Size: 115
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "globvrkm.h"
|
||||
#include "graphics.h"
|
||||
#include "init.h"
|
||||
#include "input.h"
|
||||
#include "newgame.h"
|
||||
#include "opponent.h"
|
||||
#include "pc-dos/dossys.h"
|
||||
|
@ -387,6 +388,7 @@ br_material* LoadMaterial(char* pName) {
|
|||
br_model* LoadModel(char* pName) {
|
||||
tPath_name the_path;
|
||||
br_model* model;
|
||||
LOG_TRACE("(\"%s\")", pName);
|
||||
}
|
||||
|
||||
// Offset: 4400
|
||||
|
@ -485,8 +487,23 @@ void LoadInRegistees() {
|
|||
// Offset: 5652
|
||||
// Size: 182
|
||||
void LoadKeyMapping() {
|
||||
FILE* f;
|
||||
tPath_name the_path;
|
||||
int i;
|
||||
LOG_TRACE("()");
|
||||
|
||||
PathCat(the_path, gApplication_path, "KEYMAP_X.TXT");
|
||||
the_path[strlen(the_path) - 5] = gKey_map_index + 48;
|
||||
f = DRfopen(the_path, "rt");
|
||||
if (!f) {
|
||||
FatalError(9);
|
||||
}
|
||||
|
||||
for (i = 0; i < 67; i++) {
|
||||
fscanf(f, "%d", &gKey_mapping[i]);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// Offset: 5836
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "utility.h"
|
||||
|
||||
#include "brender.h"
|
||||
#include "dossys.h"
|
||||
#include "errors.h"
|
||||
#include "globvars.h"
|
||||
|
@ -292,6 +293,12 @@ br_pixelmap* DRPixelmapAllocate(br_uint_8 pType, br_uint_16 pW, br_uint_16 pH, v
|
|||
// ECX: pW
|
||||
br_pixelmap* DRPixelmapAllocateSub(br_pixelmap* pPm, br_uint_16 pX, br_uint_16 pY, br_uint_16 pW, br_uint_16 pH) {
|
||||
br_pixelmap* the_map;
|
||||
the_map = BrPixelmapAllocateSub(pPm, pX, pY, pW, pH);
|
||||
if (the_map) {
|
||||
the_map->origin_y = 0;
|
||||
the_map->origin_x = 0;
|
||||
}
|
||||
return the_map;
|
||||
}
|
||||
|
||||
// Offset: 2468
|
||||
|
|
|
@ -63,6 +63,7 @@ float MapSawToTriangle(float pNumber) {
|
|||
// Offset: 88
|
||||
// Size: 62
|
||||
void SetSightDistance(br_scalar pYon) {
|
||||
gSight_distance_squared = pYon * 1.02f * (pYon * 1.02f);
|
||||
}
|
||||
|
||||
// Offset: 152
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define DR_TYPES_H
|
||||
|
||||
#include "br_types.h"
|
||||
#include "new/debug.h"
|
||||
#include "debug.h"
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
@ -75,6 +75,7 @@ typedef tU8 tNet_message_type;
|
|||
typedef char* tS3_sound_source_ptr;
|
||||
typedef int tS3_sound_tag;
|
||||
typedef struct tCar_spec_struct tCar_spec;
|
||||
typedef struct tCar_spec_struct2 tCar_spec2;
|
||||
typedef struct tPath_node_struct tPath_node;
|
||||
typedef struct tPath_section_struct tPath_section;
|
||||
typedef tU32 tPlayer_ID;
|
||||
|
@ -709,7 +710,7 @@ typedef struct _tagNETBIOS_ADAPTER_STATUS {
|
|||
BYTE bName[16];
|
||||
BYTE bNameNumber;
|
||||
BYTE bNameStatus;
|
||||
};
|
||||
} sNameTable;
|
||||
} _NETBIOS_ADAPTER_STATUS;
|
||||
|
||||
typedef struct _tagNETBIOS_ELEMENT {
|
||||
|
@ -1676,45 +1677,45 @@ typedef struct tNet_message_crush_point {
|
|||
br_vector3 energy_vector;
|
||||
} tNet_message_crush_point;
|
||||
|
||||
typedef struct tNet_contents {
|
||||
struct {
|
||||
tU8 contents_size;
|
||||
tNet_message_type type;
|
||||
};
|
||||
struct {
|
||||
tNet_message_send_me_details send_details;
|
||||
tNet_message_my_details details;
|
||||
tNet_message_join join;
|
||||
tNet_message_leave leave;
|
||||
tNet_message_host_pissing_off hosticide;
|
||||
tNet_message_new_player_list player_list;
|
||||
tNet_message_race_over race_over;
|
||||
tNet_message_status_report report;
|
||||
tNet_message_start_race start_race;
|
||||
tNet_message_guarantee_reply reply;
|
||||
tNet_message_headup headup;
|
||||
tNet_message_host_query where_we_at;
|
||||
tNet_message_host_reply heres_where_we_at;
|
||||
tNet_message_mechanics_info mech;
|
||||
tNet_message_non_car_info non_car;
|
||||
tNet_message_time_sync time_sync;
|
||||
tNet_message_players_confirm confirm;
|
||||
tNet_message_disable_car disable_car;
|
||||
tNet_message_enable_car enabled_car;
|
||||
tNet_message_powerup powerup;
|
||||
tNet_message_recover recover;
|
||||
tNet_message_scores scores;
|
||||
tNet_message_wasted wasted;
|
||||
tNet_message_pedestrian pedestrian;
|
||||
tNet_message_gameplay gameplay;
|
||||
tNet_message_non_car_position non_car_position;
|
||||
tNet_message_cop_info cop_info;
|
||||
tNet_message_car_details_req car_details_req;
|
||||
tNet_message_car_details car_details;
|
||||
tNet_message_game_scores game_scores;
|
||||
tNet_message_oil_spill oil_spill;
|
||||
tNet_message_crush_point crush;
|
||||
};
|
||||
typedef union tNet_contents { // size: 0x160
|
||||
struct { // size: 0x2
|
||||
tU8 contents_size; // @0x0
|
||||
tNet_message_type type; // @0x1
|
||||
} header; // @0x0
|
||||
union { // size: 0x160
|
||||
tNet_message_send_me_details send_details; // @0x0
|
||||
tNet_message_my_details details; // @0x0
|
||||
tNet_message_join join; // @0x0
|
||||
tNet_message_leave leave; // @0x0
|
||||
tNet_message_host_pissing_off hosticide; // @0x0
|
||||
tNet_message_new_player_list player_list; // @0x0
|
||||
tNet_message_race_over race_over; // @0x0
|
||||
tNet_message_status_report report; // @0x0
|
||||
tNet_message_start_race start_race; // @0x0
|
||||
tNet_message_guarantee_reply reply; // @0x0
|
||||
tNet_message_headup headup; // @0x0
|
||||
tNet_message_host_query where_we_at; // @0x0
|
||||
tNet_message_host_reply heres_where_we_at; // @0x0
|
||||
tNet_message_mechanics_info mech; // @0x0
|
||||
tNet_message_non_car_info non_car; // @0x0
|
||||
tNet_message_time_sync time_sync; // @0x0
|
||||
tNet_message_players_confirm confirm; // @0x0
|
||||
tNet_message_disable_car disable_car; // @0x0
|
||||
tNet_message_enable_car enabled_car; // @0x0
|
||||
tNet_message_powerup powerup; // @0x0
|
||||
tNet_message_recover recover; // @0x0
|
||||
tNet_message_scores scores; // @0x0
|
||||
tNet_message_wasted wasted; // @0x0
|
||||
tNet_message_pedestrian pedestrian; // @0x0
|
||||
tNet_message_gameplay gameplay; // @0x0
|
||||
tNet_message_non_car_position non_car_position; // @0x0
|
||||
tNet_message_cop_info cop_info; // @0x0
|
||||
tNet_message_car_details_req car_details_req; // @0x0
|
||||
tNet_message_car_details car_details; // @0x0
|
||||
tNet_message_game_scores game_scores; // @0x0
|
||||
tNet_message_oil_spill oil_spill; // @0x0
|
||||
tNet_message_crush_point crush; // @0x0
|
||||
} data; // @0x0
|
||||
} tNet_contents;
|
||||
|
||||
typedef struct tNet_message {
|
||||
|
@ -2487,18 +2488,18 @@ typedef struct tReduced_pos {
|
|||
tS16 v[3];
|
||||
} tReduced_pos;
|
||||
|
||||
typedef struct tIncident_info {
|
||||
struct {
|
||||
tCar_spec* car;
|
||||
br_vector3 impact_point;
|
||||
};
|
||||
struct {
|
||||
br_actor* ped_actor;
|
||||
br_actor* murderer_actor;
|
||||
};
|
||||
struct {
|
||||
br_vector3 pos;
|
||||
};
|
||||
typedef union tIncident_info { // size: 0x10
|
||||
struct { // size: 0x10
|
||||
tCar_spec* car; // @0x0
|
||||
br_vector3 impact_point; // @0x4
|
||||
} car_info; // @0x0
|
||||
struct { // size: 0x8
|
||||
br_actor* ped_actor; // @0x0
|
||||
br_actor* murderer_actor; // @0x4
|
||||
} ped_info; // @0x0
|
||||
struct { // size: 0xc
|
||||
br_vector3 pos; // @0x0
|
||||
} wall_info; // @0x0
|
||||
} tIncident_info;
|
||||
|
||||
typedef struct tChanged_vertex {
|
||||
|
@ -2614,21 +2615,21 @@ typedef struct tPipe_ped_gib_data {
|
|||
br_matrix34 transform;
|
||||
} tPipe_ped_gib_data;
|
||||
|
||||
typedef struct tPipe_incident_data {
|
||||
float severity;
|
||||
struct {
|
||||
struct {
|
||||
tU16 car_ID;
|
||||
br_vector3 impact_point;
|
||||
};
|
||||
struct {
|
||||
tU16 ped_index;
|
||||
br_actor* actor;
|
||||
};
|
||||
struct {
|
||||
br_vector3 pos;
|
||||
};
|
||||
};
|
||||
typedef struct tPipe_incident_data { // size: 0x14
|
||||
float severity; // @0x0
|
||||
union { // size: 0x10
|
||||
struct { // size: 0x10
|
||||
tU16 car_ID; // @0x0
|
||||
br_vector3 impact_point; // @0x4
|
||||
} car_info; // @0x0
|
||||
struct { // size: 0x8
|
||||
tU16 ped_index; // @0x0
|
||||
br_actor* actor; // @0x4
|
||||
} ped_info; // @0x0
|
||||
struct { // size: 0xc
|
||||
br_vector3 pos; // @0x0
|
||||
} wall_info; // @0x0
|
||||
} info; // @0x4
|
||||
} tPipe_incident_data;
|
||||
|
||||
typedef struct tPipe_spark_data {
|
||||
|
@ -2707,42 +2708,42 @@ typedef struct tPipe_skid_adjustment {
|
|||
int material_index;
|
||||
} tPipe_skid_adjustment;
|
||||
|
||||
typedef struct tPipe_chunk {
|
||||
tChunk_subject_index subject_index;
|
||||
struct {
|
||||
tPipe_actor_rstyle_data actor_rstyle_data;
|
||||
tPipe_actor_translate_data actor_translate_data;
|
||||
tPipe_actor_transform_data actor_transform_data;
|
||||
tPipe_actor_create_data actor_create_data;
|
||||
tPipe_actor_destroy_data actor_destroy_data;
|
||||
tPipe_actor_relink_data actor_relink_data;
|
||||
tPipe_actor_material_data actor_material_data;
|
||||
tPipe_face_material_data face_material_data;
|
||||
tPipe_material_trans_data material_trans_data;
|
||||
tPipe_material_pixelmap_data material_pixelmap_data;
|
||||
tPipe_model_geometry_data model_geometry_data;
|
||||
tPipe_pedestrian_data pedestrian_data;
|
||||
tPipe_frame_boundary_data frame_boundary_data;
|
||||
tPipe_car_data car_data;
|
||||
tPipe_sound_data sound_data;
|
||||
tPipe_damage_data damage_data;
|
||||
tPipe_special_data special_data;
|
||||
tPipe_ped_gib_data ped_gib_data;
|
||||
tPipe_incident_data incident_data;
|
||||
tPipe_spark_data spark_data;
|
||||
tPipe_shrapnel_data shrapnel_data;
|
||||
tPipe_screen_shake_data screen_shake_data;
|
||||
tPipe_groove_stop_data groove_stop_data;
|
||||
tPipe_non_car_data non_car_data;
|
||||
tPipe_smoke_data smoke_data;
|
||||
tPipe_oil_spill_data oil_data;
|
||||
tPipe_smoke_column_data smoke_column_data;
|
||||
tPipe_flame_data flame_data;
|
||||
tPipe_smudge_data smudge_data;
|
||||
tPipe_splash_data splash_data;
|
||||
tPipe_prox_ray_data prox_ray_data;
|
||||
tPipe_skid_adjustment skid_adjustment;
|
||||
};
|
||||
typedef struct tPipe_chunk { // size: 0x58
|
||||
tChunk_subject_index subject_index; // @0x0
|
||||
union { // size: 0x54
|
||||
tPipe_actor_rstyle_data actor_rstyle_data; // @0x0
|
||||
tPipe_actor_translate_data actor_translate_data; // @0x0
|
||||
tPipe_actor_transform_data actor_transform_data; // @0x0
|
||||
tPipe_actor_create_data actor_create_data; // @0x0
|
||||
tPipe_actor_destroy_data actor_destroy_data; // @0x0
|
||||
tPipe_actor_relink_data actor_relink_data; // @0x0
|
||||
tPipe_actor_material_data actor_material_data; // @0x0
|
||||
tPipe_face_material_data face_material_data; // @0x0
|
||||
tPipe_material_trans_data material_trans_data; // @0x0
|
||||
tPipe_material_pixelmap_data material_pixelmap_data; // @0x0
|
||||
tPipe_model_geometry_data model_geometry_data; // @0x0
|
||||
tPipe_pedestrian_data pedestrian_data; // @0x0
|
||||
tPipe_frame_boundary_data frame_boundary_data; // @0x0
|
||||
tPipe_car_data car_data; // @0x0
|
||||
tPipe_sound_data sound_data; // @0x0
|
||||
tPipe_damage_data damage_data; // @0x0
|
||||
tPipe_special_data special_data; // @0x0
|
||||
tPipe_ped_gib_data ped_gib_data; // @0x0
|
||||
tPipe_incident_data incident_data; // @0x0
|
||||
tPipe_spark_data spark_data; // @0x0
|
||||
tPipe_shrapnel_data shrapnel_data; // @0x0
|
||||
tPipe_screen_shake_data screen_shake_data; // @0x0
|
||||
tPipe_groove_stop_data groove_stop_data; // @0x0
|
||||
tPipe_non_car_data non_car_data; // @0x0
|
||||
tPipe_smoke_data smoke_data; // @0x0
|
||||
tPipe_oil_spill_data oil_data; // @0x0
|
||||
tPipe_smoke_column_data smoke_column_data; // @0x0
|
||||
tPipe_flame_data flame_data; // @0x0
|
||||
tPipe_smudge_data smudge_data; // @0x0
|
||||
tPipe_splash_data splash_data; // @0x0
|
||||
tPipe_prox_ray_data prox_ray_data; // @0x0
|
||||
tPipe_skid_adjustment skid_adjustment; // @0x0
|
||||
} chunk_data; // @0x4
|
||||
} tPipe_chunk;
|
||||
|
||||
typedef struct tPipe_session {
|
||||
|
@ -3075,47 +3076,48 @@ typedef enum tFancy_stage {
|
|||
eFancy_stage_readying = 3,
|
||||
eFancy_stage_leaving = 4
|
||||
} tFancy_stage;
|
||||
typedef struct tHeadup {
|
||||
tHeadup_type type;
|
||||
int x;
|
||||
int y;
|
||||
int original_x;
|
||||
int right_edge;
|
||||
int flash_period;
|
||||
int slot_index;
|
||||
int dimmed_background;
|
||||
int dim_left;
|
||||
int dim_top;
|
||||
int dim_right;
|
||||
int dim_bottom;
|
||||
int clever;
|
||||
int cockpit_anchored;
|
||||
int flash_state;
|
||||
tJustification justification;
|
||||
tU32 end_time;
|
||||
tU32 last_flash;
|
||||
struct {
|
||||
struct {
|
||||
char text[250];
|
||||
int colour;
|
||||
br_font* font;
|
||||
} a;
|
||||
struct {
|
||||
char text[250];
|
||||
tDR_font* coloured_font;
|
||||
} b;
|
||||
struct {
|
||||
br_pixelmap* image;
|
||||
} c;
|
||||
struct {
|
||||
br_pixelmap* image;
|
||||
int offset;
|
||||
int shear_amount;
|
||||
int end_offset;
|
||||
tFancy_stage fancy_stage;
|
||||
tU32 start_time;
|
||||
} d;
|
||||
};
|
||||
|
||||
typedef struct tHeadup { // size: 0x14c
|
||||
tHeadup_type type; // @0x0
|
||||
int x; // @0x4
|
||||
int y; // @0x8
|
||||
int original_x; // @0xc
|
||||
int right_edge; // @0x10
|
||||
int flash_period; // @0x14
|
||||
int slot_index; // @0x18
|
||||
int dimmed_background; // @0x1c
|
||||
int dim_left; // @0x20
|
||||
int dim_top; // @0x24
|
||||
int dim_right; // @0x28
|
||||
int dim_bottom; // @0x2c
|
||||
int clever; // @0x30
|
||||
int cockpit_anchored; // @0x34
|
||||
int flash_state; // @0x38
|
||||
tJustification justification; // @0x3c
|
||||
tU32 end_time; // @0x40
|
||||
tU32 last_flash; // @0x44
|
||||
union { // size: 0x104
|
||||
struct { // size: 0x104
|
||||
char text[250]; // @0x0
|
||||
int colour; // @0xfc
|
||||
br_font* font; // @0x100
|
||||
} text_info; // @0x0
|
||||
struct { // size: 0x100
|
||||
char text[250]; // @0x0
|
||||
tDR_font* coloured_font; // @0xfc
|
||||
} coloured_text_info; // @0x0
|
||||
struct { // size: 0x4
|
||||
br_pixelmap* image; // @0x0
|
||||
} image_info; // @0x0
|
||||
struct { // size: 0x18
|
||||
br_pixelmap* image; // @0x0
|
||||
int offset; // @0x4
|
||||
int shear_amount; // @0x8
|
||||
int end_offset; // @0xc
|
||||
tFancy_stage fancy_stage; // @0x10
|
||||
tU32 start_time; // @0x14
|
||||
} fancy_info; // @0x0
|
||||
} data; // @0x48
|
||||
} tHeadup;
|
||||
|
||||
typedef struct tQueued_headup {
|
||||
|
@ -3529,27 +3531,27 @@ typedef struct tPed_choice {
|
|||
tU8 marker_ref;
|
||||
} tPed_choice;
|
||||
|
||||
typedef struct tPedestrian_instruction {
|
||||
tPed_instruc_type type;
|
||||
struct {
|
||||
struct {
|
||||
br_vector3 position;
|
||||
int irreversable;
|
||||
};
|
||||
struct {
|
||||
int number_of_choices;
|
||||
tPed_choice choices[2];
|
||||
};
|
||||
struct {
|
||||
int death_sequence;
|
||||
};
|
||||
struct {
|
||||
int marker_ref;
|
||||
};
|
||||
struct {
|
||||
int action_index;
|
||||
};
|
||||
};
|
||||
typedef struct tPedestrian_instruction { // size: 0x14
|
||||
tPed_instruc_type type; // @0x0
|
||||
union { // size: 0x10
|
||||
struct { // size: 0x10
|
||||
br_vector3 position; // @0x0
|
||||
int irreversable; // @0xc
|
||||
} point_data; // @0x0
|
||||
struct { // size: 0xc
|
||||
int number_of_choices; // @0x0
|
||||
tPed_choice choices[2]; // @0x4
|
||||
} choice_data; // @0x0
|
||||
struct { // size: 0x4
|
||||
int death_sequence; // @0x0
|
||||
} death_data; // @0x0
|
||||
struct { // size: 0x4
|
||||
int marker_ref; // @0x0
|
||||
} marker_data; // @0x0
|
||||
struct { // size: 0x4
|
||||
int action_index; // @0x0
|
||||
} action_data; // @0x0
|
||||
} data; // @0x4
|
||||
} tPedestrian_instruction;
|
||||
|
||||
typedef struct tBearing_sequence {
|
||||
|
@ -3908,129 +3910,130 @@ typedef enum tScale_mode {
|
|||
eScale_mode_y = 2,
|
||||
eScale_mode_z = 3
|
||||
} tScale_mode;
|
||||
typedef struct tFunkotronic_spec {
|
||||
int owner;
|
||||
br_material* material;
|
||||
tFunk_trigger_mode mode;
|
||||
tMatrix_mod_type matrix_mod_type;
|
||||
tMove_mode matrix_mode;
|
||||
struct {
|
||||
struct {
|
||||
float period;
|
||||
} a;
|
||||
struct {
|
||||
float period;
|
||||
br_scalar x_centre;
|
||||
br_scalar y_centre;
|
||||
float rock_angle;
|
||||
} b;
|
||||
struct {
|
||||
float x_period;
|
||||
float y_period;
|
||||
br_scalar x_centre;
|
||||
br_scalar y_centre;
|
||||
float x_magnitude;
|
||||
float y_magnitude;
|
||||
} c;
|
||||
struct {
|
||||
float x_period;
|
||||
float y_period;
|
||||
float x_magnitude;
|
||||
float y_magnitude;
|
||||
} d;
|
||||
struct {
|
||||
float x_period;
|
||||
float y_period;
|
||||
} e;
|
||||
};
|
||||
tMove_mode lighting_animation_type;
|
||||
float lighting_animation_period;
|
||||
float ambient_base;
|
||||
float ambient_delta;
|
||||
float direct_base;
|
||||
float direct_delta;
|
||||
float specular_base;
|
||||
float specular_delta;
|
||||
tTexture_animation_type texture_animation_type;
|
||||
tAnimation_time_mode time_mode;
|
||||
float last_frame;
|
||||
struct {
|
||||
struct {
|
||||
tMove_mode mode;
|
||||
float period;
|
||||
int texture_count;
|
||||
int current_frame;
|
||||
br_pixelmap* textures[8];
|
||||
} f;
|
||||
struct {
|
||||
tU8* flic_data;
|
||||
tU32 flic_data_length;
|
||||
tFlic_descriptor flic_descriptor;
|
||||
} g;
|
||||
};
|
||||
int proximity_count;
|
||||
br_vector3* proximity_array;
|
||||
|
||||
typedef struct tFunkotronic_spec { // size: 0xd8
|
||||
int owner; // @0x0
|
||||
br_material* material; // @0x4
|
||||
tFunk_trigger_mode mode; // @0x8
|
||||
tMatrix_mod_type matrix_mod_type; // @0xc
|
||||
tMove_mode matrix_mode; // @0x10
|
||||
union { // size: 0x18
|
||||
struct { // size: 0x4
|
||||
float period; // @0x0
|
||||
} spin_info; // @0x0
|
||||
struct { // size: 0x10
|
||||
float period; // @0x0
|
||||
br_scalar x_centre; // @0x4
|
||||
br_scalar y_centre; // @0x8
|
||||
float rock_angle; // @0xc
|
||||
} rock_info; // @0x0
|
||||
struct { // size: 0x18
|
||||
float x_period; // @0x0
|
||||
float y_period; // @0x4
|
||||
br_scalar x_centre; // @0x8
|
||||
br_scalar y_centre; // @0xc
|
||||
float x_magnitude; // @0x10
|
||||
float y_magnitude; // @0x14
|
||||
} throb_info; // @0x0
|
||||
struct { // size: 0x10
|
||||
float x_period; // @0x0
|
||||
float y_period; // @0x4
|
||||
float x_magnitude; // @0x8
|
||||
float y_magnitude; // @0xc
|
||||
} slither_info; // @0x0
|
||||
struct { // size: 0x8
|
||||
float x_period; // @0x0
|
||||
float y_period; // @0x4
|
||||
} roll_info; // @0x0
|
||||
} matrix_mod_data; // @0x14
|
||||
tMove_mode lighting_animation_type; // @0x2c
|
||||
float lighting_animation_period; // @0x30
|
||||
float ambient_base; // @0x34
|
||||
float ambient_delta; // @0x38
|
||||
float direct_base; // @0x3c
|
||||
float direct_delta; // @0x40
|
||||
float specular_base; // @0x44
|
||||
float specular_delta; // @0x48
|
||||
tTexture_animation_type texture_animation_type; // @0x4c
|
||||
tAnimation_time_mode time_mode; // @0x50
|
||||
float last_frame; // @0x54
|
||||
union { // size: 0x78
|
||||
struct { // size: 0x30
|
||||
tMove_mode mode; // @0x0
|
||||
float period; // @0x4
|
||||
int texture_count; // @0x8
|
||||
int current_frame; // @0xc
|
||||
br_pixelmap* textures[8]; // @0x10
|
||||
} frames_info; // @0x0
|
||||
struct { // size: 0x78
|
||||
tU8* flic_data; // @0x0
|
||||
tU32 flic_data_length; // @0x4
|
||||
tFlic_descriptor flic_descriptor; // @0x8
|
||||
} flic_info; // @0x0
|
||||
} texture_animation_data; // @0x58
|
||||
int proximity_count; // @0xd0
|
||||
br_vector3* proximity_array; // @0xd4
|
||||
} tFunkotronic_spec;
|
||||
|
||||
typedef struct tGroovidelic_spec {
|
||||
int owner;
|
||||
int done_this_frame;
|
||||
br_actor* actor;
|
||||
tLollipop_mode lollipop_mode;
|
||||
tGroove_trigger_mode mode;
|
||||
tGroove_path_mode path_type;
|
||||
tMove_mode path_mode;
|
||||
tInterrupt_status path_interrupt_status;
|
||||
float path_resumption_value;
|
||||
struct {
|
||||
struct {
|
||||
float period;
|
||||
float x_delta;
|
||||
float y_delta;
|
||||
float z_delta;
|
||||
br_vector3 centre;
|
||||
} a;
|
||||
struct {
|
||||
float period;
|
||||
float radius;
|
||||
br_vector3 centre;
|
||||
tGroove_axis_mode axis;
|
||||
} b;
|
||||
};
|
||||
br_vector3 object_centre;
|
||||
br_vector3 object_position;
|
||||
tGroove_object_mode object_type;
|
||||
tMove_mode object_mode;
|
||||
tInterrupt_status object_interrupt_status;
|
||||
float object_resumption_value;
|
||||
struct {
|
||||
struct {
|
||||
float period;
|
||||
tGroove_axis_mode axis;
|
||||
} c;
|
||||
struct {
|
||||
float period;
|
||||
float max_angle;
|
||||
float current_angle;
|
||||
tGroove_axis_mode axis;
|
||||
} d;
|
||||
struct {
|
||||
float x_period;
|
||||
float y_period;
|
||||
float z_period;
|
||||
float x_magnitude;
|
||||
float y_magnitude;
|
||||
float z_magnitude;
|
||||
} e;
|
||||
struct {
|
||||
float x_period;
|
||||
float y_period;
|
||||
float z_period;
|
||||
float x_magnitude;
|
||||
float y_magnitude;
|
||||
float z_magnitude;
|
||||
} f;
|
||||
};
|
||||
typedef struct tGroovidelic_spec { // size: 0x80
|
||||
int owner; // @0x0
|
||||
int done_this_frame; // @0x4
|
||||
br_actor* actor; // @0x8
|
||||
tLollipop_mode lollipop_mode; // @0xc
|
||||
tGroove_trigger_mode mode; // @0x10
|
||||
tGroove_path_mode path_type; // @0x14
|
||||
tMove_mode path_mode; // @0x18
|
||||
tInterrupt_status path_interrupt_status; // @0x1c
|
||||
float path_resumption_value; // @0x20
|
||||
union { // size: 0x1c
|
||||
struct { // size: 0x1c
|
||||
float period; // @0x0
|
||||
float x_delta; // @0x4
|
||||
float y_delta; // @0x8
|
||||
float z_delta; // @0xc
|
||||
br_vector3 centre; // @0x10
|
||||
} straight_info; // @0x0
|
||||
struct { // size: 0x18
|
||||
float period; // @0x0
|
||||
float radius; // @0x4
|
||||
br_vector3 centre; // @0x8
|
||||
tGroove_axis_mode axis; // @0x14
|
||||
} circular_info; // @0x0
|
||||
} path_data; // @0x24
|
||||
br_vector3 object_centre; // @0x40
|
||||
br_vector3 object_position; // @0x4c
|
||||
tGroove_object_mode object_type; // @0x58
|
||||
tMove_mode object_mode; // @0x5c
|
||||
tInterrupt_status object_interrupt_status; // @0x60
|
||||
float object_resumption_value; // @0x64
|
||||
union { // size: 0x18
|
||||
struct { // size: 0x8
|
||||
float period; // @0x0
|
||||
tGroove_axis_mode axis; // @0x4
|
||||
} spin_info; // @0x0
|
||||
struct { // size: 0x10
|
||||
float period; // @0x0
|
||||
float max_angle; // @0x4
|
||||
float current_angle; // @0x8
|
||||
tGroove_axis_mode axis; // @0xc
|
||||
} rock_info; // @0x0
|
||||
struct { // size: 0x18
|
||||
float x_period; // @0x0
|
||||
float y_period; // @0x4
|
||||
float z_period; // @0x8
|
||||
float x_magnitude; // @0xc
|
||||
float y_magnitude; // @0x10
|
||||
float z_magnitude; // @0x14
|
||||
} throb_info; // @0x0
|
||||
struct { // size: 0x18
|
||||
float x_period; // @0x0
|
||||
float y_period; // @0x4
|
||||
float z_period; // @0x8
|
||||
float x_magnitude; // @0xc
|
||||
float y_magnitude; // @0x10
|
||||
float z_magnitude; // @0x14
|
||||
} shear_info; // @0x0
|
||||
} object_data; // @0x68
|
||||
} tGroovidelic_spec;
|
||||
|
||||
typedef struct DWORDREGS {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#define LOG_TRACE(...) debug_printf("[TRACE] %s", __FUNCTION__, __VA_ARGS__)
|
||||
#define LOG_DEBUG(...) debug_printf("[TRACE] %s", __FUNCTION__, __VA_ARGS__)
|
||||
#define LOG_WARN(...) debug_printf("[WARN] %s", __FUNCTION__, __VA_ARGS__)
|
||||
|
||||
void debug_printf(const char* fmt, const char* fn, const char* fmt2, ...);
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "brender.h"
|
||||
#include "common/car.h"
|
||||
#include "common/drdebug.h"
|
||||
#include "common/globvars.h"
|
||||
|
@ -305,6 +306,16 @@ int PDInitScreenVars(int pArgc, char** pArgv) {
|
|||
// Offset: 3300
|
||||
// Size: 24
|
||||
void PDInitScreen() {
|
||||
gScreen = DOSGfxBegin(gGraf_specs[gGraf_spec_index].gfx_init_string);
|
||||
gScreen->origin_x = 0;
|
||||
gDOSGfx_initialized = 1;
|
||||
gScreen->origin_y = 0;
|
||||
gBack_screen = BrPixelmapMatch(gScreen, BR_PMMATCH_OFFSCREEN);
|
||||
gBack_screen->origin_x = 0;
|
||||
gBack_screen->origin_y = 0;
|
||||
gTemp_screen = BrPixelmapMatch(gScreen, BR_PMMATCH_OFFSCREEN);
|
||||
gTemp_screen->origin_x = 0;
|
||||
gTemp_screen->origin_y = 0;
|
||||
}
|
||||
|
||||
// Offset: 3324
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "new/stack_trace_handler.h"
|
||||
#include "dr_types.h"
|
||||
#include "pc-dos/dossys.h"
|
||||
#include "stack_trace_handler.h"
|
||||
|
||||
extern int _main(int pArgc, char* pArgv[]);
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
BUILD_DIR ?= ./build
|
||||
SRC_DIR ?= .
|
||||
|
||||
SRCS := $(shell find $(SRC_DIR) -name "*.c")
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d)
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
CFLAGS ?= $(INC_FLAGS) -g -Wno-return-type -Wno-missing-declarations -Werror=implicit-function-declaration
|
||||
|
||||
.PHONY: clean build
|
||||
|
||||
build: $(OBJS)
|
||||
|
||||
# c source
|
||||
$(BUILD_DIR)/%.c.o: %.c
|
||||
@$(MKDIR_P) $(dir $@)
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
@$(RM) -r $(BUILD_DIR)
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
MKDIR_P ?= mkdir -p
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#define LOG_TRACE(...) debug_printf("[TRACE] %s", __FUNCTION__, __VA_ARGS__)
|
||||
#define LOG_DEBUG(...) debug_printf("[DEBUG] %s ", __FUNCTION__, __VA_ARGS__)
|
||||
#define LOG_WARN(...) debug_printf("[WARN] %s ", __FUNCTION__, __VA_ARGS__)
|
||||
#define LOG_PANIC(...) \
|
||||
debug_printf("[PANIC] %s ", __FUNCTION__, __VA_ARGS__); \
|
||||
exit(1);
|
||||
|
||||
void debug_printf(const char* fmt, const char* fn, const char* fmt2, ...);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
#include "brender.h"
|
||||
#include "framework/unity.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void test_actsupt_BrActorAllocateAndFree() {
|
||||
br_actor* a;
|
||||
a = BrActorAllocate(BR_ACTOR_LIGHT, NULL);
|
||||
TEST_ASSERT_NOT_NULL(a);
|
||||
TEST_ASSERT_EQUAL_INT(BR_ACTOR_LIGHT, a->type);
|
||||
TEST_ASSERT_NULL(a->children);
|
||||
BrActorFree(a);
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
TEST_ASSERT_NOT_NULL(a);
|
||||
TEST_ASSERT_NULL(a->type_data)
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_CAMERA, NULL);
|
||||
TEST_ASSERT_NOT_NULL(a);
|
||||
TEST_ASSERT_EQUAL_FLOAT(((br_camera*)a->type_data)->yon_z, 10.f);
|
||||
BrActorFree(a);
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_BOUNDS, NULL);
|
||||
BrActorFree(a);
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_BOUNDS_CORRECT, NULL);
|
||||
BrActorFree(a);
|
||||
|
||||
a = BrActorAllocate(BR_ACTOR_CLIP_PLANE, NULL);
|
||||
BrActorFree(a);
|
||||
}
|
||||
|
||||
void test_actsupt_BrActorAllocateAndFreeChild() {
|
||||
br_actor* a;
|
||||
a = BrActorAllocate(BR_ACTOR_CAMERA, NULL);
|
||||
a->identifier = BrResStrDup(a, "actor_name");
|
||||
BrActorFree(a);
|
||||
}
|
||||
|
||||
void test_actsupt_BrActorAdd() {
|
||||
br_actor* a;
|
||||
br_actor* b;
|
||||
a = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
b = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
BrActorAdd(a, b);
|
||||
TEST_ASSERT_EQUAL_INT(0, a->depth);
|
||||
TEST_ASSERT_EQUAL_INT(1, b->depth);
|
||||
TEST_ASSERT_EQUAL_PTR(b, a->children);
|
||||
TEST_ASSERT_EQUAL_PTR(a, b->parent);
|
||||
TEST_ASSERT_NULL(a->children->next);
|
||||
TEST_ASSERT_NULL(a->children->children);
|
||||
}
|
||||
|
||||
void test_actsupt_suite() {
|
||||
RUN_TEST(test_actsupt_BrActorAllocateAndFree);
|
||||
RUN_TEST(test_actsupt_BrActorAllocateAndFreeChild);
|
||||
RUN_TEST(test_actsupt_BrActorAdd);
|
||||
}
|
|
@ -48,6 +48,36 @@ void test_brlists_BrSimpleList() {
|
|||
free(three);
|
||||
}
|
||||
|
||||
void test_brlists_BrSimpleRemove() {
|
||||
br_simple_list list;
|
||||
br_simple_node one;
|
||||
br_simple_node two;
|
||||
br_simple_node three;
|
||||
|
||||
BrSimpleNewList(&list);
|
||||
TEST_ASSERT_NULL(list.head);
|
||||
BrSimpleAddHead(&list, &one);
|
||||
TEST_ASSERT_NOT_NULL(list.head);
|
||||
BrSimpleRemove(&one);
|
||||
|
||||
// removed the only item, so head points to null
|
||||
TEST_ASSERT_NULL(list.head);
|
||||
TEST_ASSERT_NULL(one.next);
|
||||
TEST_ASSERT_NULL(one.prev);
|
||||
|
||||
BrSimpleAddHead(&list, &one);
|
||||
BrSimpleAddHead(&list, &two);
|
||||
BrSimpleAddHead(&list, &three);
|
||||
BrSimpleRemove(&two);
|
||||
|
||||
// we removed the middle element, so we are left with head -> 3 -> 1 and list <- 3 <- 1
|
||||
TEST_ASSERT_EQUAL_PTR(&three, list.head);
|
||||
TEST_ASSERT_EQUAL_PTR(three.next, &one);
|
||||
TEST_ASSERT_EQUAL_PTR(one.prev, &three);
|
||||
TEST_ASSERT_EQUAL_PTR(three.prev, &list);
|
||||
}
|
||||
|
||||
void test_brlists_suite() {
|
||||
RUN_TEST(test_brlists_BrSimpleList);
|
||||
RUN_TEST(test_brlists_BrSimpleRemove);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
#include "CORE/PIXELMAP/genclip.h"
|
||||
#include "framework/unity.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void test_genclip_PixelmapRectangleClip() {
|
||||
br_rectangle out;
|
||||
br_rectangle in;
|
||||
br_pixelmap pm;
|
||||
br_clip_result result;
|
||||
|
||||
pm.origin_x = 0;
|
||||
pm.origin_y = 0;
|
||||
pm.height = 10;
|
||||
pm.width = 20;
|
||||
|
||||
in.x = 100; // out of bounds
|
||||
in.w = 5;
|
||||
in.h = 5;
|
||||
result = PixelmapRectangleClip(&out, &in, &pm);
|
||||
TEST_ASSERT_EQUAL(BR_CLIP_REJECT, result);
|
||||
|
||||
in.x = 0;
|
||||
in.y = 21; // out of bounds
|
||||
result = PixelmapRectangleClip(&out, &in, &pm);
|
||||
TEST_ASSERT_EQUAL(BR_CLIP_REJECT, result);
|
||||
|
||||
in.x = 1;
|
||||
in.y = 1;
|
||||
result = PixelmapRectangleClip(&out, &in, &pm);
|
||||
TEST_ASSERT_EQUAL(BR_CLIP_PARTIAL, result);
|
||||
|
||||
in.w = 100;
|
||||
in.h = 100;
|
||||
result = PixelmapRectangleClip(&out, &in, &pm);
|
||||
TEST_ASSERT_EQUAL(BR_CLIP_PARTIAL, result);
|
||||
TEST_ASSERT_EQUAL(19, out.w);
|
||||
TEST_ASSERT_EQUAL(9, out.h);
|
||||
TEST_ASSERT_EQUAL(1, out.x);
|
||||
TEST_ASSERT_EQUAL(1, out.y);
|
||||
}
|
||||
|
||||
void test_genclip_suite() {
|
||||
RUN_TEST(test_genclip_PixelmapRectangleClip);
|
||||
}
|
|
@ -11,6 +11,9 @@ void test_resource_BrResAllocate() {
|
|||
|
||||
parent = BrResAllocate(NULL, 0, BR_MEMORY_ANCHOR);
|
||||
TEST_ASSERT_NOT_NULL(parent);
|
||||
|
||||
// A brender resource consists of a header and a body. The pointer to the body is what is returned to the caller,
|
||||
// so we have to jump the pointer backwards to inspect the header.
|
||||
parent_header = (resource_header*)(((char*)parent) - sizeof(resource_header) - 4);
|
||||
TEST_ASSERT_EQUAL_UINT32(0xDEADBEEF, parent_header->magic_num);
|
||||
TEST_ASSERT_NULL(parent_header->children.head);
|
||||
|
@ -21,9 +24,42 @@ void test_resource_BrResAllocate() {
|
|||
child_header = (resource_header*)(((char*)child) - sizeof(resource_header) - 4);
|
||||
TEST_ASSERT_EQUAL_PTR(&child_header->node, parent_header->children.head);
|
||||
TEST_ASSERT_NULL(parent_header->children.head->next);
|
||||
// ? TEST_ASSERT_NULL(parent_header->children.head->prev);
|
||||
}
|
||||
|
||||
void test_resource_BrResFree() {
|
||||
void* r;
|
||||
void* child;
|
||||
|
||||
// simple case
|
||||
r = BrResAllocate(NULL, 0, BR_MEMORY_ANCHOR);
|
||||
TEST_ASSERT_NOT_NULL(r);
|
||||
printf("Got res allocated at %p\n", r);
|
||||
BrResFree(r);
|
||||
}
|
||||
|
||||
void test_resource_BrResFree_Child() {
|
||||
void* r;
|
||||
void* child;
|
||||
resource_header* header;
|
||||
|
||||
r = BrResAllocate(NULL, 0, BR_MEMORY_ANCHOR);
|
||||
TEST_ASSERT_NOT_NULL(r);
|
||||
child = BrResAllocate(r, 0, BR_MEMORY_ANCHOR);
|
||||
TEST_ASSERT_NOT_NULL(child);
|
||||
|
||||
header = (resource_header*)(((char*)child) - sizeof(resource_header) - 4);
|
||||
TEST_ASSERT_EQUAL_INT(0xDEADBEEF, header->magic_num);
|
||||
BrResFree(r);
|
||||
// when the res is free'd, magic_num is set to 1. We make sure the child was free'd when the parent was
|
||||
TEST_ASSERT_EQUAL_INT(1, header->magic_num);
|
||||
|
||||
// And the parent should have the child unlinked from its list of children
|
||||
header = (resource_header*)(((char*)r) - sizeof(resource_header) - 4);
|
||||
TEST_ASSERT_NULL(header->children.head);
|
||||
}
|
||||
|
||||
void test_resource_suite() {
|
||||
RUN_TEST(test_resource_BrResAllocate);
|
||||
RUN_TEST(test_resource_BrResFree);
|
||||
RUN_TEST(test_resource_BrResFree_Child);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#include "framework/unity.h"
|
||||
|
||||
#include "CORE/V1DB/actsupt.h"
|
||||
#include "common/globvars.h"
|
||||
#include "common/init.h"
|
||||
|
||||
void test_init_AllocateCamera() {
|
||||
gSelf = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
gUniverse_actor = BrActorAllocate(BR_ACTOR_NONE, NULL);
|
||||
AllocateCamera();
|
||||
TEST_ASSERT_NOT_NULL(gRearview_camera);
|
||||
}
|
||||
|
||||
void test_init_suite() {
|
||||
RUN_TEST(test_init_AllocateCamera);
|
||||
}
|
|
@ -4,16 +4,18 @@ BUILD_DIR ?= ./build
|
|||
SRC_DIR ?= .
|
||||
DR_SRC_DIR ?= ../src/DETHRACE
|
||||
BR_SRC_DIR ?= ../src/BRSRC13
|
||||
FW_SRC_DIR ?= ../src/framework
|
||||
|
||||
SRCS := $(shell find $(SRC_DIR) -name "*.c")
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
OBJS += $(shell find $(BR_SRC_DIR) -name "*.o")
|
||||
OBJS += $(shell find $(FW_SRC_DIR) -name "*.o")
|
||||
# include all DR objects except the main method to avoid _main symbol collision
|
||||
OBJS += $(shell find $(DR_SRC_DIR) -name *.o | grep -v pc-dos/main.c.o)
|
||||
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d) $(BR_SRC_DIR) $(DR_SRC_DIR)
|
||||
INC_DIRS := $(shell find $(SRC_DIR) -type d) $(BR_SRC_DIR) $(DR_SRC_DIR) $(FW_SRC_DIR)
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
CFLAGS ?= $(INC_FLAGS) -g
|
||||
|
|
11
test/main.c
11
test/main.c
|
@ -11,7 +11,7 @@
|
|||
#include "CORE/V1DB/dbsetup.h"
|
||||
|
||||
#include "common/globvars.h"
|
||||
#include "new/stack_trace_handler.h"
|
||||
#include "stack_trace_handler.h"
|
||||
|
||||
#define debug(format_, ...) fprintf(stderr, format_, __VA_ARGS__)
|
||||
|
||||
|
@ -23,10 +23,12 @@ extern void test_controls_suite();
|
|||
extern void test_input_suite();
|
||||
extern void test_errors_suite();
|
||||
extern void test_dossys_suite();
|
||||
|
||||
extern void test_init_suite();
|
||||
extern void test_brlists_suite();
|
||||
extern void test_fwsetup_suite();
|
||||
extern void test_resource_suite();
|
||||
extern void test_actsupt_suite();
|
||||
extern void test_genclip_suite();
|
||||
|
||||
void setUp(void) {
|
||||
}
|
||||
|
@ -54,13 +56,18 @@ int main(int argc, char** argv) {
|
|||
|
||||
BrV1dbBeginWrapper_Float();
|
||||
|
||||
printf("Completed setup\n");
|
||||
|
||||
// BRSRC13
|
||||
test_brlists_suite();
|
||||
test_fwsetup_suite();
|
||||
test_resource_suite();
|
||||
test_actsupt_suite();
|
||||
test_genclip_suite();
|
||||
|
||||
// DETHRACE
|
||||
test_utility_suite();
|
||||
test_init_suite();
|
||||
test_loading_suite();
|
||||
test_controls_suite();
|
||||
test_input_suite();
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
# Parses Watcom "exedump" output into c skeleton coode
|
||||
# exedump: https://github.com/jeff-1amstudios/open-watcom-v2/tree/master/bld/exedump
|
||||
#
|
||||
# Writes c code into "./_generated" directory
|
||||
#
|
||||
# Usage: codegen.py <path to dump file>
|
||||
# Usage: codegen.py <path to dump file> <path to write generated code>
|
||||
#######################################################
|
||||
import sys
|
||||
import re
|
||||
|
@ -14,7 +12,7 @@ import os
|
|||
import errno
|
||||
import shutil
|
||||
|
||||
BASE_OUTPUT_DIR = '_generated/'
|
||||
#BASE_OUTPUT_DIR = '_generated/'
|
||||
|
||||
module_start_regex = '\d+\\) Name:\s+(\S+)'
|
||||
LOCAL_HEADER_REGEX = '(\S+):\s+(\S+)'
|
||||
|
@ -40,6 +38,7 @@ ENUM_ITEM_REGEX = '"(\S+)" value = (\S+)'
|
|||
SECTION_UNDERLINE = '^(=*)$' # ignore these lines
|
||||
|
||||
fp = open(sys.argv[1], 'r')
|
||||
BASE_OUTPUT_DIR = sys.argv[2]
|
||||
|
||||
STATE_NONE = 0
|
||||
STATE_MODULE = 1
|
||||
|
@ -111,7 +110,7 @@ def read_file():
|
|||
modules.append(current_module)
|
||||
last_fn = None
|
||||
last_local_type = ''
|
||||
# if len(modules) == 3:
|
||||
# if len(modules) == 2:
|
||||
# break
|
||||
|
||||
elif line == LOCALS_SECTION_HEADER:
|
||||
|
@ -381,7 +380,7 @@ def resolve_type_str(module, type_idx, var_name, decl=True):
|
|||
|
||||
def resolve_function_header(module, fn):
|
||||
text = ''
|
||||
text += '// Offset: ' + str(fn['offset']) + '\n// Size: ' + str(fn['size'])
|
||||
text += '// Offset: ' + str(fn['offset']) + '\n// Size: ' + hex(fn['size'])
|
||||
text += '\n//IDA: ' + resolve_function_ida_signature(module, fn)
|
||||
return text
|
||||
|
||||
|
@ -498,11 +497,12 @@ def get_struct_name(module, t):
|
|||
for i in module['types']:
|
||||
t2 = module['types'][i]
|
||||
if 'type_idx' in t2 and t2['type_idx'] == target_id:
|
||||
print ('t2', t2)
|
||||
if t2['scope_idx'] == '0':
|
||||
return t2['value']
|
||||
found_id = t2['id']
|
||||
found_name = t2['value']
|
||||
#print ('found1', t2['value'])
|
||||
print ('found1', t2['value'])
|
||||
if found_id is None:
|
||||
print ('ERROR1: not found', t)
|
||||
return None
|
||||
|
@ -537,22 +537,25 @@ def get_type_declaration(module, t, name):
|
|||
#print ('type decl', t)
|
||||
if t['type'] == 'FIELD_LIST':
|
||||
s = 'struct'
|
||||
print('struct', )
|
||||
tag_name = get_struct_tag_name(module, t)
|
||||
if tag_name is not None:
|
||||
s += ' ' + tag_name
|
||||
s += ' {'
|
||||
s += '\t\t// size: ' + str(t['size'])
|
||||
s += '\t\t// size: ' + hex(t['size'])
|
||||
first_elem = True
|
||||
for e in reversed(t['fields']):
|
||||
s += '\n'
|
||||
s += ' ' * (indent * INDENT_SPACES)
|
||||
s += (' ' * INDENT_SPACES) + resolve_type_str(module, e['type_idx'], e['name']);
|
||||
if e['type'] == 'BIT_BYTE':
|
||||
if e['type'] == 'BIT_BYTE' or e['type'] == 'BIT_WORD':
|
||||
s += ': ' + str(e['bit_size'])
|
||||
s += ';'
|
||||
s += '\t\t// @' + str(e['offset'])
|
||||
s += '\t\t// @' + hex(e['offset'])
|
||||
first_elem = False
|
||||
s += '\n' + ' ' * (indent * INDENT_SPACES) + '}'
|
||||
if get_struct_name(module, t) is None:
|
||||
s += ' ' + name
|
||||
return s
|
||||
elif t['type'] == 'NEAR386 PROC':
|
||||
return_type = resolve_type_str(module, t['return_type'], '')
|
||||
|
@ -576,7 +579,7 @@ def generate_c_skeleton():
|
|||
global br_types_file
|
||||
|
||||
try:
|
||||
shutil.rmtree(BASE_OUTPUT_DIR)
|
||||
shutil.rmtree(BASE_OUTPUT_DIR + '/*')
|
||||
except:
|
||||
pass
|
||||
mkdir_p(BASE_OUTPUT_DIR + '/types')
|
||||
|
|
Loading…
Reference in New Issue