mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
parent
9f9b5fa76a
commit
4702d7e782
3 changed files with 27 additions and 38 deletions
|
@ -1,5 +1,6 @@
|
|||
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.9...develop) - ××××-××-××
|
||||
- fixed resolving paths (especially to music files) on case-sensitive filesystems (#1934, #2504)
|
||||
- fixed loading a game crashing on Linux (#2508, regression from 0.9)
|
||||
- improved memory usage by shedding ca. 100-110 MB on average
|
||||
|
||||
## [0.9](https://github.com/LostArtefacts/TRX/compare/tr2-0.8...tr2-0.9) - 2025-02-14
|
||||
|
|
|
@ -41,10 +41,11 @@
|
|||
|
||||
static int32_t m_BufPos = 0;
|
||||
static char *m_BufPtr = nullptr;
|
||||
static char *m_BufCopy = nullptr;
|
||||
static uint32_t m_ReqFlags1[MAX_REQUESTER_ITEMS];
|
||||
static uint32_t m_ReqFlags2[MAX_REQUESTER_ITEMS];
|
||||
|
||||
static void M_Reset(void);
|
||||
|
||||
static void M_Read(void *ptr, size_t size);
|
||||
#undef SPECIAL_READ_WRITE
|
||||
#define SPECIAL_READ_WRITE(name, type) static type M_Read##name(void);
|
||||
|
@ -72,9 +73,18 @@ static void M_WriteLaraArm(const LARA_ARM *arm);
|
|||
static void M_WriteAmmoInfo(const AMMO_INFO *ammo_info);
|
||||
static void M_WriteFlares(void);
|
||||
|
||||
static void M_Read(void *ptr, const size_t size)
|
||||
static void M_Reset(void)
|
||||
{
|
||||
ReadSG(ptr, size);
|
||||
m_BufPos = 0;
|
||||
m_BufPtr = g_SaveGame.buffer;
|
||||
}
|
||||
|
||||
static void M_Read(void *const ptr, const size_t size)
|
||||
{
|
||||
ASSERT(m_BufPos + size <= MAX_SG_BUFFER_SIZE);
|
||||
m_BufPos += size;
|
||||
memcpy(ptr, m_BufPtr, size);
|
||||
m_BufPtr += size;
|
||||
}
|
||||
|
||||
#undef SPECIAL_READ_WRITE
|
||||
|
@ -82,7 +92,7 @@ static void M_Read(void *ptr, const size_t size)
|
|||
static type M_Read##name(void) \
|
||||
{ \
|
||||
type result; \
|
||||
ReadSG(&result, sizeof(type)); \
|
||||
M_Read(&result, sizeof(type)); \
|
||||
return result; \
|
||||
}
|
||||
SPECIAL_READ_WRITES
|
||||
|
@ -425,7 +435,13 @@ static void M_ReadFlares(void)
|
|||
|
||||
static void M_Write(const void *ptr, const size_t size)
|
||||
{
|
||||
WriteSG(ptr, size);
|
||||
m_BufPos += size;
|
||||
if (m_BufPos >= MAX_SG_BUFFER_SIZE) {
|
||||
Shell_ExitSystem("Savegame is too big to fit in buffer");
|
||||
}
|
||||
|
||||
memcpy(m_BufPtr, ptr, size);
|
||||
m_BufPtr += size;
|
||||
}
|
||||
|
||||
static void M_WriteStartInfo(MYFILE *const fp, const START_INFO *const start)
|
||||
|
@ -916,7 +932,7 @@ void CreateSaveGameInfo(void)
|
|||
g_SaveGame.num_key[2] = Inv_RequestItem(O_KEY_ITEM_3);
|
||||
g_SaveGame.num_key[3] = Inv_RequestItem(O_KEY_ITEM_4);
|
||||
|
||||
ResetSG();
|
||||
M_Reset();
|
||||
memset(g_SaveGame.buffer, 0, MAX_SG_BUFFER_SIZE);
|
||||
|
||||
M_WriteS32(g_FlipStatus);
|
||||
|
@ -967,7 +983,7 @@ void ExtractSaveGameInfo(void)
|
|||
Inv_AddItemNTimes(O_KEY_ITEM_3, g_SaveGame.num_key[2]);
|
||||
Inv_AddItemNTimes(O_KEY_ITEM_4, g_SaveGame.num_key[3]);
|
||||
|
||||
ResetSG();
|
||||
M_Reset();
|
||||
|
||||
if (M_ReadS32()) {
|
||||
Room_FlipMap();
|
||||
|
@ -1007,37 +1023,13 @@ void ExtractSaveGameInfo(void)
|
|||
Lara_CatchFire();
|
||||
}
|
||||
|
||||
ReadSG(&g_FlipEffect, sizeof(int32_t));
|
||||
ReadSG(&g_FlipTimer, sizeof(int32_t));
|
||||
ReadSG(&g_IsMonkAngry, sizeof(int32_t));
|
||||
g_FlipEffect = M_ReadS32();
|
||||
g_FlipTimer = M_ReadS32();
|
||||
g_IsMonkAngry = M_ReadS32();
|
||||
|
||||
M_ReadFlares();
|
||||
}
|
||||
|
||||
void ResetSG(void)
|
||||
{
|
||||
m_BufPos = 0;
|
||||
m_BufPtr = g_SaveGame.buffer;
|
||||
}
|
||||
|
||||
void WriteSG(const void *const pointer, const size_t size)
|
||||
{
|
||||
m_BufPos += size;
|
||||
if (m_BufPos >= MAX_SG_BUFFER_SIZE) {
|
||||
Shell_ExitSystem("Savegame is too big to fit in buffer");
|
||||
}
|
||||
|
||||
memcpy(m_BufPtr, pointer, size);
|
||||
m_BufPtr += size;
|
||||
}
|
||||
|
||||
void ReadSG(void *const pointer, const size_t size)
|
||||
{
|
||||
m_BufPos += size;
|
||||
memcpy(pointer, m_BufPtr, size);
|
||||
m_BufPtr += size;
|
||||
}
|
||||
|
||||
void GetSavedGamesList(REQUEST_INFO *const req)
|
||||
{
|
||||
Requester_SetSize(req, 10, -32);
|
||||
|
|
|
@ -21,10 +21,6 @@ void Savegame_PersistGameToCurrentInfo(const GF_LEVEL *level);
|
|||
void CreateSaveGameInfo(void);
|
||||
void ExtractSaveGameInfo(void);
|
||||
|
||||
void ResetSG(void);
|
||||
void WriteSG(const void *pointer, size_t size);
|
||||
void ReadSG(void *pointer, size_t size);
|
||||
|
||||
void GetSavedGamesList(REQUEST_INFO *req);
|
||||
bool S_FrontEndCheck(void);
|
||||
int32_t S_SaveGame(int32_t slot_num);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue