From cdfd308193f08211d0259861e454412f13d42ee2 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sun, 23 Jul 2023 11:01:03 +0300 Subject: [PATCH] Add mapper_main --- src/mapper/mapper.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ src/mapper/mapper.h | 1 + src/memory.cc | 5 +---- src/memory.h | 1 + 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/mapper/mapper.cc b/src/mapper/mapper.cc index e419825..c1cc87b 100644 --- a/src/mapper/mapper.cc +++ b/src/mapper/mapper.cc @@ -10,6 +10,7 @@ #include "inventory.h" #include "kb.h" #include "mapper/mp_proto.h" +#include "memory.h" #include "object.h" #include "proto.h" #include "settings.h" @@ -19,6 +20,8 @@ namespace fallout { static void MapperInit(); +static int mapper_edit_init(int argc, char** argv); +static void mapper_edit_exit(); static int bookmarkInit(); static int bookmarkExit(); static void bookmarkHide(); @@ -29,6 +32,7 @@ static int categoryHide(); static int categoryToggleState(); static int categoryUnhide(); static bool proto_user_is_librarian(); +static void edit_mapper(); static void redraw_toolname(); static void clear_toolname(); static void update_high_obj_name(Object* obj); @@ -62,6 +66,24 @@ unsigned char* tool; // 0x6EC4AC int tool_win; +// gnw_main +// 0x485DD0 +int mapper_main(int argc, char** argv) +{ + MapperInit(); + + if (mapper_edit_init(argc, argv) == -1) { + mem_check(); + return 0; + } + + edit_mapper(); + mapper_edit_exit(); + mem_check(); + + return 0; +} + // 0x485E00 void MapperInit() { @@ -106,6 +128,20 @@ void MapperInit() menu_val_2[7] = 5544; } +// 0x485F94 +int mapper_edit_init(int argc, char** argv) +{ + // TODO: Incomplete. + + return 0; +} + +// 0x48752C +void mapper_edit_exit() +{ + // TODO: Incomplete. +} + // 0x4875B4 int bookmarkInit() { @@ -207,6 +243,12 @@ bool proto_user_is_librarian() return true; } +// 0x4877D0 +void edit_mapper() +{ + // TODO: Incomplete. +} + // 0x48B16C void print_toolbar_name(int object_type) { diff --git a/src/mapper/mapper.h b/src/mapper/mapper.h index 3eb594c..4ae73cf 100644 --- a/src/mapper/mapper.h +++ b/src/mapper/mapper.h @@ -14,6 +14,7 @@ extern int menu_val_1[21]; extern unsigned char* tool; extern int tool_win; +int mapper_main(int argc, char** argv); void print_toolbar_name(int object_type); int mapper_inven_unwield(Object* obj, int right_hand); diff --git a/src/memory.cc b/src/memory.cc index 5f15047..c51ff39 100644 --- a/src/memory.cc +++ b/src/memory.cc @@ -32,7 +32,6 @@ typedef struct MemoryBlockFooter { static void* memoryBlockMallocImpl(size_t size); static void* memoryBlockReallocImpl(void* ptr, size_t size); static void memoryBlockFreeImpl(void* ptr); -static void memoryBlockPrintStats(); static void* mem_prep_block(void* block, size_t size); static void memoryBlockValidate(void* block); @@ -176,10 +175,8 @@ static void memoryBlockFreeImpl(void* ptr) } } -// NOTE: Not used. -// // 0x4C5C5C -static void memoryBlockPrintStats() +void mem_check() { if (gMallocProc == memoryBlockMallocImpl) { debugPrint("Current memory allocated: %6d blocks, %9u bytes total\n", gMemoryBlocksCurrentCount, gMemoryBlocksCurrentSize); diff --git a/src/memory.h b/src/memory.h index facaa54..96b0364 100644 --- a/src/memory.h +++ b/src/memory.h @@ -9,6 +9,7 @@ char* internal_strdup(const char* string); void* internal_malloc(size_t size); void* internal_realloc(void* ptr, size_t size); void internal_free(void* ptr); +void mem_check(); } // namespace fallout