wip
This commit is contained in:
parent
998a0b6af8
commit
afe57853e2
|
@ -944,8 +944,11 @@ void DisposeRace(void) {
|
|||
// when exiting a race, skid mark materials are unloaded, but material_modifiers is not changed.
|
||||
// In 3dfx mode, `FrobFog` is called during loading the next track, which iterates over the material_modifiers
|
||||
// causing a use-after-free
|
||||
for (int i = 0; i < COUNT_OF(gCurrent_race.material_modifiers); i++) {
|
||||
gCurrent_race.material_modifiers[i].skid_mark_material = NULL;
|
||||
if (1) {
|
||||
int i;
|
||||
for (i = 0; i < COUNT_OF(gCurrent_race.material_modifiers); i++) {
|
||||
gCurrent_race.material_modifiers[i].skid_mark_material = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -321,9 +321,9 @@ void PDInitialiseSystem(void) {
|
|||
fread(gASCII_shift_table, len / 2, 1, f);
|
||||
fclose(f);
|
||||
#if BR_ENDIAN_BIG
|
||||
for (int i = 0; i < 128; i++) {
|
||||
gASCII_table[i] = BrSwap32(gASCII_table[i]);
|
||||
gASCII_shift_table[i] = BrSwap32(gASCII_shift_table[i]);
|
||||
for (len = 0; len < BR_ASIZE(gASCII_table); len++) {
|
||||
gASCII_table[len] = BrSwap32(gASCII_table[len]);
|
||||
gASCII_shift_table[len] = BrSwap32(gASCII_shift_table[len]);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
|
|
@ -19,7 +19,7 @@ extern void Harness_Platform_Init(tHarness_platform* platform);
|
|||
extern const tPlatform_bootstrap SDL1_bootstrap;
|
||||
extern const tPlatform_bootstrap SDL2_bootstrap;
|
||||
|
||||
static const tPlatform_bootstrap *platform_bootstraps[] = {
|
||||
static const tPlatform_bootstrap* platform_bootstraps[] = {
|
||||
#ifdef DETHRACE_PLATFORM_SDL2
|
||||
&SDL2_bootstrap,
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@ tHarness_platform gHarness_platform;
|
|||
static int force_null_platform = 0;
|
||||
|
||||
typedef struct {
|
||||
const char *platform_name;
|
||||
const char* platform_name;
|
||||
uint32_t platform_capabilityies;
|
||||
int install_signalhandler;
|
||||
} tArgument_config;
|
||||
|
@ -282,7 +282,8 @@ void Harness_ForceNullPlatform(void) {
|
|||
}
|
||||
|
||||
int Harness_ProcessCommandLine(tArgument_config* config, int* argc, char* argv[]) {
|
||||
for (int i = 1; i < *argc;) {
|
||||
int i, j;
|
||||
for (i = 1; i < *argc;) {
|
||||
int consumed = -1;
|
||||
|
||||
if (strcasecmp(argv[i], "--cdcheck") == 0) {
|
||||
|
@ -367,7 +368,7 @@ int Harness_ProcessCommandLine(tArgument_config* config, int* argc, char* argv[]
|
|||
|
||||
if (consumed > 0) {
|
||||
// shift args downwards
|
||||
for (int j = i; j < *argc - consumed; j++) {
|
||||
for (j = i; j < *argc - consumed; j++) {
|
||||
argv[j] = argv[j + consumed];
|
||||
}
|
||||
*argc -= consumed;
|
||||
|
@ -386,10 +387,11 @@ FILE* Harness_Hook_fopen(const char* pathname, const char* mode) {
|
|||
|
||||
// Localization
|
||||
int Harness_Hook_isalnum(int c) {
|
||||
int i;
|
||||
if (harness_game_info.localization == eGameLocalization_polish) {
|
||||
// Polish diacritic letters in Windows-1250
|
||||
unsigned char letters[] = { 140, 143, 156, 159, 163, 165, 175, 179, 185, 191, 198, 202, 209, 211, 230, 234, 241, 243 };
|
||||
for (int i = 0; i < (int)sizeof(letters); i++) {
|
||||
for (i = 0; i < (int)sizeof(letters); i++) {
|
||||
if ((unsigned char)c == letters[i]) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -42,43 +42,3 @@ void panic_printf(const char* fmt, const char* fn, const char* fmt2, ...) {
|
|||
}
|
||||
puts("\033[0m");
|
||||
}
|
||||
|
||||
void debug_print_vector3(const char* fmt, const char* fn, char* msg, br_vector3* v) {
|
||||
printf(fmt, fn);
|
||||
printf("%s %f, %f, %f\n", msg, v->v[0], v->v[1], v->v[2]);
|
||||
puts("\033[0m");
|
||||
}
|
||||
|
||||
void debug_print_matrix34(const char* fmt, const char* fn, char* msg, br_matrix34* m) {
|
||||
printf(fmt, fn);
|
||||
printf("matrix34 \"%s\"\n", msg);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
printf(" %f, %f, %f\n", m->m[i][0], m->m[i][1], m->m[i][2]);
|
||||
}
|
||||
puts("\033[0m");
|
||||
}
|
||||
|
||||
void debug_print_matrix4(const char* fmt, const char* fn, char* msg, br_matrix4* m) {
|
||||
printf(fmt, fn);
|
||||
printf("matrix34 \"%s\"\n", msg);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
printf(" %f, %f, %f, %f\n", m->m[i][0], m->m[i][1], m->m[i][2], m->m[i][3]);
|
||||
}
|
||||
puts("\033[0m");
|
||||
}
|
||||
|
||||
// int count_open_fds(void) {
|
||||
// DIR* dp = opendir("/dev/fd/");
|
||||
// struct dirent* de;
|
||||
// int count = -3; // '.', '..', dp
|
||||
|
||||
// if (dp == NULL)
|
||||
// return -1;
|
||||
|
||||
// while ((de = readdir(dp)) != NULL)
|
||||
// count++;
|
||||
|
||||
// (void)closedir(dp);
|
||||
|
||||
// return count;
|
||||
// }
|
||||
|
|
|
@ -225,13 +225,14 @@ static void limit_fps(void) {
|
|||
}
|
||||
|
||||
static void SDL1_Renderer_Present(br_pixelmap* src) {
|
||||
int i;
|
||||
// fastest way to convert 8 bit indexed to 32 bit
|
||||
uint8_t* src_pixels = src->pixels;
|
||||
uint32_t* dest_pixels;
|
||||
|
||||
SDL1_LockSurface(screen);
|
||||
dest_pixels = screen->pixels;
|
||||
for (int i = 0; i < src->height * src->width; i++) {
|
||||
for (i = 0; i < src->height * src->width; i++) {
|
||||
*dest_pixels = converted_palette[*src_pixels];
|
||||
dest_pixels++;
|
||||
src_pixels++;
|
||||
|
@ -263,7 +264,8 @@ static void SDL1_Harness_Swap(br_pixelmap* back_buffer) {
|
|||
}
|
||||
|
||||
static void SDL1_Harness_PaletteChanged(br_colour entries[256]) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
converted_palette[i] = (0xff << 24 | BR_RED(entries[i]) << 16 | BR_GRN(entries[i]) << 8 | BR_BLU(entries[i]));
|
||||
}
|
||||
if (last_screen_src != NULL) {
|
||||
|
|
|
@ -323,18 +323,20 @@ static void SDL2_Harness_CreateWindow(const char* title, int width, int height,
|
|||
}
|
||||
|
||||
static void SDL2_Harness_Swap(br_pixelmap* back_buffer) {
|
||||
int i;
|
||||
int dest_pitch;
|
||||
uint8_t* src_pixels;
|
||||
uint32_t* dest_pixels;
|
||||
|
||||
SDL2_Harness_ProcessWindowMessages();
|
||||
|
||||
if (gl_context != NULL) {
|
||||
SDL2_GL_SwapWindow(window);
|
||||
} else {
|
||||
uint8_t* src_pixels = back_buffer->pixels;
|
||||
uint32_t* dest_pixels;
|
||||
int dest_pitch;
|
||||
src_pixels = back_buffer->pixels;
|
||||
|
||||
SDL2_LockTexture(screen_texture, NULL, (void**)&dest_pixels, &dest_pitch);
|
||||
for (int i = 0; i < back_buffer->height * back_buffer->width; i++) {
|
||||
for (i = 0; i < back_buffer->height * back_buffer->width; i++) {
|
||||
*dest_pixels = converted_palette[*src_pixels];
|
||||
dest_pixels++;
|
||||
src_pixels++;
|
||||
|
@ -352,7 +354,8 @@ static void SDL2_Harness_Swap(br_pixelmap* back_buffer) {
|
|||
}
|
||||
|
||||
static void SDL2_Harness_PaletteChanged(br_colour entries[256]) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
converted_palette[i] = (0xff << 24 | BR_RED(entries[i]) << 16 | BR_GRN(entries[i]) << 8 | BR_BLU(entries[i]));
|
||||
}
|
||||
if (last_screen_src != NULL) {
|
||||
|
|
Loading…
Reference in New Issue