Removes incorrect NOT_IMPLEMENTED guards, adds DR filesystem (#26)

This commit is contained in:
Jeff Harris 2020-05-22 22:36:54 -07:00 committed by GitHub
parent 12da0ed779
commit 87930e0af9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 71 additions and 46 deletions

View File

@ -123,7 +123,13 @@ br_diaghandler* BrDiagHandlerSet(br_diaghandler* newdh) {
// Size: 73
br_filesystem* BrFilesystemSet(br_filesystem* newfs) {
br_filesystem* old;
NOT_IMPLEMENTED();
old = fw.fsys;
if (!newfs) {
newfs = _BrDefaultFilesystem;
}
fw.fsys = newfs;
return old;
}
// Offset: 643

View File

@ -184,7 +184,7 @@ br_error BrTokenValueSetMany(void* mem, br_int_32* pcount, br_uint_32* pcombined
br_int_32 n;
br_error r;
br_uint_32 cm;
NOT_IMPLEMENTED();
LOG_WARN("Not implemented");
}
// Offset: 6409

View File

@ -168,7 +168,6 @@ void CheckDispatch(br_device_pixelmap* pm) {
// if (!pm->dispatch) {
// pm->dispatch = &devicePixelmapDispatch;
// }
NOT_IMPLEMENTED();
}
// Offset: 631

View File

@ -147,7 +147,7 @@ br_error BrV1dbRendererEnd() {
// Size: 94
void BrZbBegin(br_uint_8 colour_type, br_uint_8 depth_type) {
LOG_TRACE("(%d, %d)", colour_type, depth_type);
NOT_IMPLEMENTED();
LOG_WARN("Not implemented");
}
// Offset: 2133

View File

@ -1,6 +1,8 @@
#include "regsupt.h"
#include "CORE/FW/register.h"
#include "CORE/V1DB/dbsetup.h"
#include "CORE/V1DB/prepmesh.h"
#include "debug.h"
char rscid[51];
@ -8,7 +10,9 @@ char rscid[51];
// Offset: 11
// Size: 148
br_model* BrModelAdd(br_model* model) {
NOT_IMPLEMENTED();
BrRegistryAdd(&v1db.reg_models, model);
BrModelUpdate(model, 0x7FFF);
return model;
}
// Offset: 173

View File

@ -1,5 +1,9 @@
// This is a temporary solution to avoid userland (dethrace) code from having to understand brender internal paths.
// Probably should end up just being a bunch of function prototypes.
#include "CORE/DOSIO/dosio.h"
#include "CORE/FW/fwsetup.h"
#include "CORE/FW/mem.h"
#include "CORE/FW/resource.h"
#include "CORE/FW/resreg.h"
#include "CORE/MATH/matrix34.h"

View File

@ -156,12 +156,10 @@ void RenderTrack(br_actor* pWorld, tTrack_spec* pTrack_spec, br_actor* pCamera,
// Size: 47
br_scalar GetYonFactor() {
return gYon_factor;
NOT_IMPLEMENTED();
}
// Offset: 6248
// Size: 44
void SetYonFactor(br_scalar pNew) {
gYon_factor = pNew;
NOT_IMPLEMENTED();
}

View File

@ -820,7 +820,6 @@ void CycleYonFactor() {
void SetSoundDetailLevel(int pLevel) {
LOG_TRACE("(%d)", pLevel);
gSound_detail_level = pLevel;
NOT_IMPLEMENTED();
}
// Offset: 17256

View File

@ -493,7 +493,6 @@ void SetDepthCueingOn(int pOn) {
gSwap_depth_effect_end = gProgram_state.current_depth_effect.end;
}
gDepth_cueing_on = pOn;
NOT_IMPLEMENTED();
}
// Offset: 10864

View File

@ -1,43 +1,77 @@
#include "drfile.h"
#include "brender.h"
#include "loading.h"
#include <stdlib.h>
br_filesystem* gOld_file_system;
br_filesystem gFilesystem;
br_filesystem gFilesystem = {
"Carmageddon",
NULL,
&DRStdioOpenRead,
&DRStdioOpenWrite,
&DRStdioClose,
NULL,
NULL,
NULL,
&DRStdioRead,
&DRStdioWrite,
NULL,
NULL,
NULL
};
// Added by JeffH
#define DR_MEMORY_FILESYSTEM 140
// Offset: 0
// Size: 64
void* DRStdioOpenRead(char* name, br_size_t n_magics, br_mode_test_cbfn* identify, int* mode_result) {
NOT_IMPLEMENTED();
if (mode_result) {
*mode_result = 0;
}
return DRfopen(name, "rb");
}
// Offset: 64
// Size: 56
void* DRStdioOpenWrite(char* name, int mode) {
NOT_IMPLEMENTED();
return gOld_file_system->open_write(name, mode);
}
// Offset: 120
// Size: 46
void DRStdioClose(void* f) {
NOT_IMPLEMENTED();
gOld_file_system->close(f);
}
// Offset: 168
// Size: 70
br_size_t DRStdioRead(void* buf, br_size_t size, unsigned int n, void* f) {
br_size_t result;
NOT_IMPLEMENTED();
return gOld_file_system->read(buf, size, n, f);
}
// Offset: 240
// Size: 70
br_size_t DRStdioWrite(void* buf, br_size_t size, unsigned int n, void* f) {
br_size_t result;
NOT_IMPLEMENTED();
return gOld_file_system->write(buf, size, n, f);
}
// Offset: 312
// Size: 187
void InstallDRFileCalls() {
NOT_IMPLEMENTED();
br_filesystem* temp_system;
LOG_TRACE("()");
temp_system = BrMemAllocate(sizeof(br_filesystem), DR_MEMORY_FILESYSTEM);
gOld_file_system = BrFilesystemSet(temp_system);
gFilesystem.attributes = gOld_file_system->attributes;
gFilesystem.eof = gOld_file_system->eof;
gFilesystem.getchr = gOld_file_system->getchr;
gFilesystem.putchr = gOld_file_system->putchr;
gFilesystem.getline = gOld_file_system->getline;
gFilesystem.putline = gOld_file_system->putline;
gFilesystem.advance = gOld_file_system->advance;
BrFilesystemSet(&gFilesystem);
BrMemFree(temp_system);
}

View File

@ -314,28 +314,24 @@ void* DRStdlibAllocate(br_size_t size, br_uint_8 type) {
void DRStdlibFree(void* mem) {
int i;
free(mem);
NOT_IMPLEMENTED();
}
// Offset: 444
// Size: 40
br_size_t DRStdlibInquire(br_uint_8 type) {
return 0;
NOT_IMPLEMENTED();
}
// Offset: 484
// Size: 40
br_uint_32 Claim4ByteAlignment(br_uint_8 type) {
return 4;
NOT_IMPLEMENTED();
}
// Offset: 524
// Size: 48
void InstallDRMemCalls() {
BrAllocatorSet(&gAllocator);
NOT_IMPLEMENTED();
}
// Offset: 572

View File

@ -268,7 +268,7 @@ void CopyStripImage(br_pixelmap* pDest, br_int_16 pDest_x, br_int_16 pOffset_x,
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();
PDAllocateScreenAndBack();
if (!pWidth) {
pWidth = gBack_screen->width;
}
@ -1164,7 +1164,6 @@ void TellyOutImage(br_pixelmap* pImage, int pLeft, int pTop) {
void SetShadowLevel(tShadow_level pLevel) {
LOG_TRACE("(%d)", pLevel);
gShadow_level = pLevel;
NOT_IMPLEMENTED();
}
// Offset: 30520

View File

@ -363,5 +363,4 @@ int GetScreenSize() {
void SetScreenSize(int pNew_size) {
LOG_TRACE("(%d)", pNew_size);
gRender_indent = pNew_size;
NOT_IMPLEMENTED();
}

View File

@ -436,7 +436,6 @@ void InitNetGameplayStuff() {
// Size: 49
void DefaultNetName() {
NetObtainSystemUserName(gNet_player_name, 32);
NOT_IMPLEMENTED();
}
// Offset: 19160

View File

@ -295,7 +295,6 @@ int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index)
void NetObtainSystemUserName(char* pName, int pMax_length) {
PDNetObtainSystemUserName(pName, pMax_length);
pName[9] = 0;
NOT_IMPLEMENTED();
}
// Offset: 5668

View File

@ -396,7 +396,7 @@ void RevertToDefaults() {
void DefaultNetSettings() {
FILE* f;
int i;
NOT_IMPLEMENTED();
LOG_WARN("Not implemented");
}
// Offset: 7964

View File

@ -705,7 +705,6 @@ void ResetSmokeColumns() {
void SetSmokeOn(int pSmoke_on) {
LOG_TRACE("(%d)", pSmoke_on);
gSmoke_on = pSmoke_on;
NOT_IMPLEMENTED();
}
// Offset: 32060

View File

@ -986,7 +986,6 @@ br_material* WallLinearToPersp(br_model* pModel, tU16 pFace) {
// Size: 45
tRoad_texturing_level GetRoadTexturingLevel() {
return gRoad_texturing_level;
NOT_IMPLEMENTED();
}
// Offset: 22220
@ -995,7 +994,6 @@ tRoad_texturing_level GetRoadTexturingLevel() {
void SetRoadTexturingLevel(tRoad_texturing_level pLevel) {
LOG_TRACE("(%d)", pLevel);
gRoad_texturing_level = pLevel;
NOT_IMPLEMENTED();
}
// Offset: 22268
@ -1017,7 +1015,6 @@ tWall_texturing_level GetWallTexturingLevel() {
void SetWallTexturingLevel(tWall_texturing_level pLevel) {
LOG_TRACE("(%d)", pLevel);
gWall_texturing_level = pLevel;
NOT_IMPLEMENTED();
}
// Offset: 22452
@ -1055,7 +1052,6 @@ br_uint_32 SetAccessoryRenderingCB(br_actor* pActor, void* pFlag) {
pActor->render_style = *(br_uint_8*)pFlag;
}
return 0;
NOT_IMPLEMENTED();
}
// Offset: 23076
@ -1089,7 +1085,6 @@ int GetAccessoryRendering() {
void SetCarSimplificationLevel(int pLevel) {
LOG_TRACE("(%d)", pLevel);
gCar_simplification_level = pLevel;
NOT_IMPLEMENTED();
}
// Offset: 23272

View File

@ -396,7 +396,6 @@ tPlayer_ID PDNetExtractPlayerID(tNet_game_details* pDetails) {
void PDNetObtainSystemUserName(char* pName, int pMax_length) {
DrDebugMessage("PDNetObtainSystemUserName()\n");
strcpy(pName, "Ron Turn");
NOT_IMPLEMENTED();
}
// Offset: 7736

View File

@ -313,23 +313,11 @@ int PDInitScreenVars(int pArgc, char** pArgv) {
gGraf_specs[gGraf_spec_index].phys_width = gGraf_specs[gGraf_spec_index].total_width;
gGraf_specs[gGraf_spec_index].phys_height = gGraf_specs[gGraf_spec_index].total_height;
return 1;
NOT_IMPLEMENTED();
}
// 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;
NOT_IMPLEMENTED();
}
// Offset: 3324
@ -347,7 +335,16 @@ void PDUnlockRealBackScreen() {
// Offset: 3488
// Size: 431
void PDAllocateScreenAndBack() {
NOT_IMPLEMENTED();
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: 3920