MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / Patch_FlushCache

Function Patch_FlushCache

Source/OSHLE/patch.cpp:947–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947static void Patch_FlushCache()
948{
949 IO::Filename name;
950
951 Dump_GetSaveDirectory(name, g_ROM.mFileName, ".hle");
952 #ifdef DAEDALUS_DEBUG_CONSOLE
953 DBGConsole_Msg(0, "Write OSHLE cache: %s", name);
954#endif
955 FILE *fp = fopen(name, "wb");
956
957 if (fp != nullptr)
958 {
959 u32 data = MAGIC_HEADER;
960 fwrite(&data, 1, sizeof(data), fp);
961
962 for (u32 i = 0; i < nPatchSymbols; i++)
963 {
964 if (g_PatchSymbols[i]->Found )
965 {
966 data = g_PatchSymbols[i]->Location;
967 fwrite(&data, 1, sizeof(data), fp);
968 for(data = 0; ;data++)
969 {
970 if (g_PatchSymbols[i]->Signatures[data].Function ==
971 g_PatchSymbols[i]->Function)
972 break;
973 }
974 fwrite(&data, 1, sizeof(data), fp);
975 }
976 else
977 {
978 data = 0;
979 fwrite(&data, 1, sizeof(data), fp);
980 }
981
982
983 }
984
985 for (u32 i = 0; i < nPatchVariables; i++)
986 {
987 if (g_PatchVariables[i]->Found )
988 {
989 data = g_PatchVariables[i]->Location;
990 }
991 else
992 {
993 data = 0;
994 }
995
996 fwrite(&data, 1, sizeof(data), fp);
997 }
998
999 fclose(fp);
1000 }
1001}
1002
1003
1004static bool Patch_GetCache()

Callers 1

Patch_ApplyPatchesFunction · 0.85

Calls 1

Dump_GetSaveDirectoryFunction · 0.85

Tested by

no test coverage detected