<commit_before>#include "SAVEGAME.H"

#include "CONTROL.H"
#include "GAMEFLOW.H"
#include "SPECIFIC.H"

#include <string.h>

char FromTitle;
char JustLoaded;
char* MGSaveGamePtr;
static int SGcount;
static char* SGpoint;
struct savegame_info savegame;

void sgRestoreGame()//55B88, 55FEC (F)
{
	SGcount = 0;
	SGpoint = &MGSaveGamePtr[sizeof(savegame_info)];

	GameTimer = savegame.Game.Timer;
	gfCurrentLevel = savegame.CurrentLevel;

	RestoreLevelData(1);
	RestoreLaraData(1);
}

void sgSaveGame()//55AF8(<), 55F5C(<)
{

	SGpoint = &MGSaveGamePtr[sizeof(savegame_info)];
	SGcount = 0;
	savegame.CurrentLevel = gfCurrentLevel;
	SaveLevelData(1);
	savegame.Game.Timer = GameTimer;
	SaveLaraData();

	MGSaveGamePtr[7678] = GetRandomControl();
	memcpy(&MGSaveGamePtr, &savegame, sizeof(savegame_info));
	savegame.Checksum = GameTimer;

	return;
}

void RestoreLevelData(int FullSave)//54B08, 54F6C
{
	S_Warn("[RestoreLevelData] - Unimplemented!\n");
}

void SaveLevelData(int FullSave)//53AAC, 53F10
{
	S_Warn("[SaveLevelData] - Unimplemented!\n");
}

void RestoreLaraData(int FullSave)//538D0, 53D34
{
	S_Warn("[RestoreLaraData] - Unimplemented!\n");
}

void SaveLaraData()//53738, 53B9C
{
	S_Warn("[SaveLaraData] - Unimplemented!\n");
}

int CheckSumValid(char *buffer)//53720(<), 53B84(<) (F)
{
	return *(short*)buffer ^ *(short*)(buffer + 0x1DFE) < 1;
}

void ReadSG(char* pointer, int size)//536E0, 53B44 (F)
{
	SGcount += size;
	
	if (size > 0)
	{
		while (size-- > 0)
		{
			*pointer++ = *SGpoint++;
		}
	}

	return;
}

void WriteSG(char* pointer, int size)//536A0, 53B04
{
	SGcount += size;

	if (size > 0)
	{
		while (size-- > 0)
		{
			*SGpoint++ = *pointer++;
		}
	}
}

<commit_msg>SAVEGAME.C patch for PSX compiler.<commit_after>#include "SAVEGAME.H"

#include "CONTROL.H"
#include "GAMEFLOW.H"
#include "SPECIFIC.H"

#include <string.h>

char FromTitle;
char JustLoaded;
char* MGSaveGamePtr;
static int SGcount;
static char* SGpoint;
struct savegame_info savegame;

void sgRestoreGame()//55B88, 55FEC (F)
{
	SGcount = 0;
#ifndef PSX//PSX compiler hates sizeof, not possible in C
	SGpoint = &MGSaveGamePtr[sizeof(savegame_info)];
#else
	SGpoint = &MGSaveGamePtr[436];
#endif
	GameTimer = savegame.Game.Timer;
	gfCurrentLevel = savegame.CurrentLevel;

	RestoreLevelData(1);
	RestoreLaraData(1);
}

void sgSaveGame()//55AF8(<), 55F5C(<)
{
#ifndef PSX//PSX compiler hates sizeof, not possible in C
	SGpoint = &MGSaveGamePtr[sizeof(savegame_info)];
#else
	SGpoint = &MGSaveGamePtr[436];
#endif
	SGcount = 0;
	savegame.CurrentLevel = gfCurrentLevel;
	SaveLevelData(1);
	savegame.Game.Timer = GameTimer;
	SaveLaraData();

	MGSaveGamePtr[7678] = GetRandomControl();
#ifndef PSX//PSX compiler hates sizeof, not possible in C
	memcpy(&MGSaveGamePtr, &savegame, sizeof(savegame_info));
#else
	memcpy(&MGSaveGamePtr, &savegame, 436);
#endif
	savegame.Checksum = GameTimer;

	return;
}

void RestoreLevelData(int FullSave)//54B08, 54F6C
{
	S_Warn("[RestoreLevelData] - Unimplemented!\n");
}

void SaveLevelData(int FullSave)//53AAC, 53F10
{
	S_Warn("[SaveLevelData] - Unimplemented!\n");
}

void RestoreLaraData(int FullSave)//538D0, 53D34
{
	S_Warn("[RestoreLaraData] - Unimplemented!\n");
}

void SaveLaraData()//53738, 53B9C
{
	S_Warn("[SaveLaraData] - Unimplemented!\n");
}

int CheckSumValid(char *buffer)//53720(<), 53B84(<) (F)
{
	return *(short*)buffer ^ *(short*)(buffer + 0x1DFE) < 1;
}

void ReadSG(char* pointer, int size)//536E0, 53B44 (F)
{
	SGcount += size;
	
	if (size > 0)
	{
		while (size-- > 0)
		{
			*pointer++ = *SGpoint++;
		}
	}

	return;
}

void WriteSG(char* pointer, int size)//536A0, 53B04
{
	SGcount += size;

	if (size > 0)
	{
		while (size-- > 0)
		{
			*SGpoint++ = *pointer++;
		}
	}
}


{'fraction_non_alphanumeric': 0.161151466236212, 'fraction_numerical': 0.04654291094969061, 'mean_word_length': 4.845911949685535, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2919097', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1533, 'n_words': 298}