Remove some unused db functions
This commit is contained in:
parent
060c79fc20
commit
6ab08bd22b
55
src/art.cc
55
src/art.cc
|
@ -149,26 +149,11 @@ int artInit()
|
|||
gArtListDescriptions[objectType].flags = 0;
|
||||
snprintf(path, sizeof(path), "%s%s%s\\%s.lst", _cd_path_base, "art\\", gArtListDescriptions[objectType].name, gArtListDescriptions[objectType].name);
|
||||
|
||||
int oldDb;
|
||||
if (objectType == OBJ_TYPE_CRITTER) {
|
||||
oldDb = _db_current();
|
||||
critterDbSelected = true;
|
||||
_db_select(_critter_db_handle);
|
||||
}
|
||||
|
||||
if (artReadList(path, &(gArtListDescriptions[objectType].fileNames), &(gArtListDescriptions[objectType].fileNamesLength)) != 0) {
|
||||
debugPrint("art_read_lst failed in art_init\n");
|
||||
if (critterDbSelected) {
|
||||
_db_select(oldDb);
|
||||
}
|
||||
cacheFree(&gArtCache);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (objectType == OBJ_TYPE_CRITTER) {
|
||||
critterDbSelected = false;
|
||||
_db_select(oldDb);
|
||||
}
|
||||
}
|
||||
|
||||
_anon_alias = (int*)internal_malloc(sizeof(*_anon_alias) * gArtListDescriptions[OBJ_TYPE_CRITTER].fileNamesLength);
|
||||
|
@ -859,12 +844,6 @@ ArtFrame* artGetFrame(Art* art, int frame, int rotation)
|
|||
bool artExists(int fid)
|
||||
{
|
||||
bool result = false;
|
||||
int oldDb = -1;
|
||||
|
||||
if (FID_TYPE(fid) == OBJ_TYPE_CRITTER) {
|
||||
oldDb = _db_current();
|
||||
_db_select(_critter_db_handle);
|
||||
}
|
||||
|
||||
char* filePath = artBuildFilePath(fid);
|
||||
if (filePath != NULL) {
|
||||
|
@ -874,10 +853,6 @@ bool artExists(int fid)
|
|||
}
|
||||
}
|
||||
|
||||
if (oldDb != -1) {
|
||||
_db_select(oldDb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -887,12 +862,6 @@ bool artExists(int fid)
|
|||
bool _art_fid_valid(int fid)
|
||||
{
|
||||
bool result = false;
|
||||
int oldDb = -1;
|
||||
|
||||
if (FID_TYPE(fid) == OBJ_TYPE_CRITTER) {
|
||||
oldDb = _db_current();
|
||||
_db_select(_critter_db_handle);
|
||||
}
|
||||
|
||||
char* filePath = artBuildFilePath(fid);
|
||||
if (filePath != NULL) {
|
||||
|
@ -902,10 +871,6 @@ bool _art_fid_valid(int fid)
|
|||
}
|
||||
}
|
||||
|
||||
if (oldDb != -1) {
|
||||
_db_select(oldDb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -952,14 +917,8 @@ int artAliasFid(int fid)
|
|||
// 0x419A78
|
||||
static int artCacheGetFileSizeImpl(int fid, int* sizePtr)
|
||||
{
|
||||
int oldDb = -1;
|
||||
int result = -1;
|
||||
|
||||
if (FID_TYPE(fid) == OBJ_TYPE_CRITTER) {
|
||||
oldDb = _db_current();
|
||||
_db_select(_critter_db_handle);
|
||||
}
|
||||
|
||||
char* artFilePath = artBuildFilePath(fid);
|
||||
if (artFilePath != NULL) {
|
||||
int fileSize;
|
||||
|
@ -991,24 +950,14 @@ static int artCacheGetFileSizeImpl(int fid, int* sizePtr)
|
|||
}
|
||||
}
|
||||
|
||||
if (oldDb != -1) {
|
||||
_db_select(oldDb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 0x419B78
|
||||
static int artCacheReadDataImpl(int fid, int* sizePtr, unsigned char* data)
|
||||
{
|
||||
int oldDb = -1;
|
||||
int result = -1;
|
||||
|
||||
if (FID_TYPE(fid) == OBJ_TYPE_CRITTER) {
|
||||
oldDb = _db_current();
|
||||
_db_select(_critter_db_handle);
|
||||
}
|
||||
|
||||
char* artFileName = artBuildFilePath(fid);
|
||||
if (artFileName != NULL) {
|
||||
bool loaded = false;
|
||||
|
@ -1039,10 +988,6 @@ static int artCacheReadDataImpl(int fid, int* sizePtr, unsigned char* data)
|
|||
}
|
||||
}
|
||||
|
||||
if (oldDb != -1) {
|
||||
_db_select(oldDb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
28
src/db.cc
28
src/db.cc
|
@ -63,18 +63,6 @@ int dbOpen(const char* filePath1, int a2, const char* filePath2, int a4)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// 0x4C5D54
|
||||
int _db_select(int dbHandle)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: Uncollapsed 0x4C5D54.
|
||||
int _db_current()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x4C5D58
|
||||
int _db_total()
|
||||
{
|
||||
|
@ -700,14 +688,6 @@ void fileNameListFree(char*** fileNameListPtr, int a2)
|
|||
free(currentFileList);
|
||||
}
|
||||
|
||||
// NOTE: This function does nothing. It was probably used to set memory procs
|
||||
// for building file name list.
|
||||
//
|
||||
// 0x4C68B8
|
||||
void _db_register_mem(MallocProc* mallocProc, StrdupProc* strdupProc, FreeProc* freeProc)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Return type should be long.
|
||||
//
|
||||
// 0x4C68BC
|
||||
|
@ -728,14 +708,6 @@ void fileSetReadProgressHandler(FileReadProgressHandler* handler, int size)
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: This function is called when fallout2.cfg has "hashing" enabled, but
|
||||
// it does nothing. It's impossible to guess it's name.
|
||||
//
|
||||
// 0x4C68E4
|
||||
void _db_enable_hash_table_()
|
||||
{
|
||||
}
|
||||
|
||||
// 0x4C68E8
|
||||
int _db_list_compare(const void* p1, const void* p2)
|
||||
{
|
||||
|
|
5
src/db.h
5
src/db.h
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "memory_defs.h"
|
||||
#include "xfile.h"
|
||||
|
||||
namespace fallout {
|
||||
|
@ -13,8 +12,6 @@ typedef void FileReadProgressHandler();
|
|||
typedef char* StrdupProc(const char* string);
|
||||
|
||||
int dbOpen(const char* filePath1, int a2, const char* filePath2, int a4);
|
||||
int _db_select(int dbHandle);
|
||||
int _db_current();
|
||||
int _db_total();
|
||||
void dbExit();
|
||||
int dbGetFileSize(const char* filePath, int* sizePtr);
|
||||
|
@ -63,10 +60,8 @@ int _db_fwriteLongCount(File* stream, int* arr, int count);
|
|||
int fileWriteUInt32List(File* stream, unsigned int* arr, int count);
|
||||
int fileNameListInit(const char* pattern, char*** fileNames, int a3, int a4);
|
||||
void fileNameListFree(char*** fileNames, int a2);
|
||||
void _db_register_mem(MallocProc* mallocProc, StrdupProc* strdupProc, FreeProc* freeProc);
|
||||
int fileGetSize(File* stream);
|
||||
void fileSetReadProgressHandler(FileReadProgressHandler* handler, int size);
|
||||
void _db_enable_hash_table_();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
|
27
src/game.cc
27
src/game.cc
|
@ -117,16 +117,6 @@ int _game_user_wants_to_quit = 0;
|
|||
// 0x58E940
|
||||
MessageList gMiscMessageList;
|
||||
|
||||
// master.dat loading result
|
||||
//
|
||||
// 0x58E948
|
||||
int _master_db_handle;
|
||||
|
||||
// critter.dat loading result
|
||||
//
|
||||
// 0x58E94C
|
||||
int _critter_db_handle;
|
||||
|
||||
// 0x442580
|
||||
int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4, int argc, char** argv)
|
||||
{
|
||||
|
@ -1283,20 +1273,14 @@ int showQuitConfirmationDialog()
|
|||
// 0x44418C
|
||||
static int gameDbInit()
|
||||
{
|
||||
int hashing;
|
||||
const char* main_file_name;
|
||||
const char* patch_file_name;
|
||||
int patch_index;
|
||||
char filename[COMPAT_MAX_PATH];
|
||||
|
||||
hashing = 0;
|
||||
main_file_name = NULL;
|
||||
patch_file_name = NULL;
|
||||
|
||||
if (settings.system.hashing) {
|
||||
_db_enable_hash_table_();
|
||||
}
|
||||
|
||||
main_file_name = settings.system.master_dat_path.c_str();
|
||||
if (*main_file_name == '\0') {
|
||||
main_file_name = NULL;
|
||||
|
@ -1307,8 +1291,8 @@ static int gameDbInit()
|
|||
patch_file_name = NULL;
|
||||
}
|
||||
|
||||
_master_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
if (_master_db_handle == -1) {
|
||||
int master_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
if (master_db_handle == -1) {
|
||||
showMesageBox("Could not find the master datafile. Please make sure the FALLOUT CD is in the drive and that you are running FALLOUT from the directory you installed it to.");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1323,9 +1307,8 @@ static int gameDbInit()
|
|||
patch_file_name = NULL;
|
||||
}
|
||||
|
||||
_critter_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
if (_critter_db_handle == -1) {
|
||||
_db_select(_master_db_handle);
|
||||
int critter_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
if (critter_db_handle == -1) {
|
||||
showMesageBox("Could not find the critter datafile. Please make sure the FALLOUT CD is in the drive and that you are running FALLOUT from the directory you installed it to.");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1338,8 +1321,6 @@ static int gameDbInit()
|
|||
}
|
||||
}
|
||||
|
||||
_db_select(_master_db_handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ extern const char* asc_5186C8;
|
|||
extern int _game_user_wants_to_quit;
|
||||
|
||||
extern MessageList gMiscMessageList;
|
||||
extern int _master_db_handle;
|
||||
extern int _critter_db_handle;
|
||||
|
||||
int gameInitWithOptions(const char* windowTitle, bool isMapper, int a3, int a4, int argc, char** argv);
|
||||
void gameReset();
|
||||
|
|
|
@ -16,7 +16,6 @@ static void gameMemoryFree(void* ptr);
|
|||
int gameMemoryInit()
|
||||
{
|
||||
dictionarySetMemoryProcs(internal_malloc, internal_realloc, internal_free);
|
||||
_db_register_mem(internal_malloc, internal_strdup, internal_free);
|
||||
memoryManagerSetProcs(gameMemoryMalloc, gameMemoryRealloc, gameMemoryFree);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue