Compare commits
1 Commits
pGta-Menu-
...
skmp/compa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a0c737284 |
@@ -286,17 +286,7 @@ texconv: $(OBJS_TEXCONV) | pvrtex # You'll have to rebuild pvrtex manually if yo
|
||||
|
||||
TXD_OPTS_fonts = 256 256
|
||||
TXD_OPTS_hud = 128 128
|
||||
TXD_OPTS_menu = 512 512 \
|
||||
--include-tex assets/mapBot01.png mapBot01 \
|
||||
--include-tex assets/mapBot02.png mapBot02 \
|
||||
--include-tex assets/mapBot03.png mapBot03 \
|
||||
--include-tex assets/mapMid01.png mapMid01 \
|
||||
--include-tex assets/mapMid02.png mapMid02 \
|
||||
--include-tex assets/mapMid03.png mapMid03 \
|
||||
--include-tex assets/mapTop01.png mapTop01 \
|
||||
--include-tex assets/mapTop02.png mapTop02 \
|
||||
--include-tex assets/mapTop03.png mapTop03
|
||||
|
||||
TXD_OPTS_menu = 512 512
|
||||
TXD_OPTS_LOADSC0 = 512 512
|
||||
TXD_OPTS_LOADSC1 = 512 512
|
||||
TXD_OPTS_LOADSC10 = 512 512
|
||||
|
||||
@@ -1012,8 +1012,14 @@ void CGame::InitialiseWhenRestarting(void)
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
|
||||
namespace rw::dc {
|
||||
void relocate_objects();
|
||||
}
|
||||
|
||||
void CGame::Process(void)
|
||||
{
|
||||
rw::dc::relocate_objects();
|
||||
|
||||
CPad::UpdatePads();
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
ProcessTidyUpMemory();
|
||||
|
||||
@@ -379,7 +379,7 @@ enum Config {
|
||||
# define CUSTOM_FRONTEND_OPTIONS
|
||||
|
||||
# ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
# define MENU_MAP // Enabled on Dca3 now, but could use some controller mapping**
|
||||
# define MENU_MAP // VC-like menu map. Won't appear if you don't have our menu.txd
|
||||
# define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable
|
||||
# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
|
||||
# define CUTSCENE_BORDERS_SWITCH
|
||||
|
||||
24
vendor/librw/src/dc/rwdc.cpp
vendored
24
vendor/librw/src/dc/rwdc.cpp
vendored
@@ -5,6 +5,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern "C" size_t malloc_usable_size(void* m);
|
||||
|
||||
#include <list>
|
||||
|
||||
#if !defined(DC_TEXCONV) && !defined(MACOS64)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -4599,12 +4603,31 @@ writeNativeTexture(Texture *tex, Stream *stream)
|
||||
|
||||
#define DC_MODEL_VERSION 5
|
||||
|
||||
std::list<void**> allocations;
|
||||
|
||||
void relocate_objects() {
|
||||
for (auto allocation: allocations) {
|
||||
auto size = malloc_usable_size(*allocation);
|
||||
void* candidate = rwMalloc(size, MEMDUR_EVENT | ID_GEOMETRY);
|
||||
if (!candidate)
|
||||
continue;
|
||||
if ((uintptr_t&)candidate < (uintptr_t&)*allocation) {
|
||||
// fprintf(stderr, "Moving memory %p to %p\n", *allocation, candidate);
|
||||
memcpy(candidate, *allocation, size);
|
||||
free(*allocation);
|
||||
*allocation = candidate;
|
||||
} else {
|
||||
free(candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
void*
|
||||
destroyNativeData(void *object, int32, int32)
|
||||
{
|
||||
auto geo = (Geometry*)object;
|
||||
rwFree(geo->instData);
|
||||
geo->instData = nil;
|
||||
allocations.remove(&(void*&)geo->instData);
|
||||
|
||||
return object;
|
||||
}
|
||||
@@ -4622,6 +4645,7 @@ readNativeData(Stream *stream, int32 length, void *object, int32, int32)
|
||||
|
||||
DCModelDataHeader *header = (DCModelDataHeader *)rwNew(sizeof(DCModelDataHeader) + chunkLen - 8, MEMDUR_EVENT | ID_GEOMETRY);
|
||||
geo->instData = header;
|
||||
allocations.insert(allocations.begin(), &(void*&)geo->instData);
|
||||
stream->read32(&header->platform, 4);
|
||||
uint32_t version;
|
||||
stream->read32(&version, 4);
|
||||
|
||||
Reference in New Issue
Block a user