Do binary writes instead.
This commit is contained in:
parent
eb25650e26
commit
f104438802
@ -38,6 +38,7 @@
|
|||||||
#define USTATE_FOLDERS 1
|
#define USTATE_FOLDERS 1
|
||||||
#define USTATE_CHANGED 2
|
#define USTATE_CHANGED 2
|
||||||
#define USTATE_CHANGE_FILE 3
|
#define USTATE_CHANGE_FILE 3
|
||||||
|
#define USTATE_ERRORS 4
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
@ -75,6 +76,10 @@ SMCResult UpdateReader::ReadSMC_NewSection(const SMCStates *states, const char *
|
|||||||
{
|
{
|
||||||
ustate = USTATE_CHANGED;
|
ustate = USTATE_CHANGED;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(name, "Errors") == 0)
|
||||||
|
{
|
||||||
|
ustate = USTATE_ERRORS;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ignoreLevel++;
|
ignoreLevel++;
|
||||||
@ -128,6 +133,14 @@ SMCResult UpdateReader::ReadSMC_KeyValue(const SMCStates *states,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case USTATE_ERRORS:
|
||||||
|
{
|
||||||
|
if (strcmp(key, "error") == 0)
|
||||||
|
{
|
||||||
|
AddUpdateError("%s", value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case USTATE_FOLDERS:
|
case USTATE_FOLDERS:
|
||||||
{
|
{
|
||||||
HandleFolder(value);
|
HandleFolder(value);
|
||||||
@ -150,6 +163,7 @@ SMCResult UpdateReader::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
{
|
{
|
||||||
case USTATE_FOLDERS:
|
case USTATE_FOLDERS:
|
||||||
case USTATE_CHANGED:
|
case USTATE_CHANGED:
|
||||||
|
case USTATE_ERRORS:
|
||||||
{
|
{
|
||||||
ustate = USTATE_NONE;
|
ustate = USTATE_NONE;
|
||||||
break;
|
break;
|
||||||
@ -220,6 +234,7 @@ void UpdateReader::HandleFile()
|
|||||||
|
|
||||||
UpdatePart *part = new UpdatePart;
|
UpdatePart *part = new UpdatePart;
|
||||||
part->data = (char*)malloc(mdl.GetSize());
|
part->data = (char*)malloc(mdl.GetSize());
|
||||||
|
memcpy(part->data, mdl.GetBuffer(), mdl.GetSize());
|
||||||
part->file = strdup(curfile.c_str());
|
part->file = strdup(curfile.c_str());
|
||||||
part->length = mdl.GetSize();
|
part->length = mdl.GetSize();
|
||||||
LinkPart(part);
|
LinkPart(part);
|
||||||
@ -241,7 +256,7 @@ static bool md5_file(const char *file, char checksum[33])
|
|||||||
long length;
|
long length;
|
||||||
void *fdata;
|
void *fdata;
|
||||||
|
|
||||||
if ((fp = fopen(file, "rt")) == NULL)
|
if ((fp = fopen(file, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ static void PumpUpdate(void *data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
smutils->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s", part->file);
|
smutils->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s", part->file);
|
||||||
FILE *fp = fopen(path, "wt");
|
FILE *fp = fopen(path, "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
{
|
{
|
||||||
AddUpdateError("Could not open %s for writing", path);
|
AddUpdateError("Could not open %s for writing", path);
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;_CRT_NONSTDC_NO_DEPRECATE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
|
Loading…
Reference in New Issue
Block a user