This commit is contained in:
Yosin-Lenheart 2022-02-15 00:51:34 +08:00
parent bca515b799
commit 6237ecd17f
3 changed files with 19 additions and 2 deletions

View File

@ -124,9 +124,15 @@ static SQfopenFunc* SQfopen = (SQfopenFunc*)0x1355DC0;
//SQfread
typedef int(SQfreadFunc)(void* buffer, int a, int b, void* file);
static SQfreadFunc* SQfread = (SQfreadFunc*)0x1355DD0;
//SQwrite
typedef int(SQwriteFunc)(void* buffer, int a, int b, void* file);
static SQwriteFunc* SQwrite = (SQwriteFunc*)0x1355DE0;
//SQfseek
typedef int(SQfseekFunc)(void* buffer, int a, int b);
static SQfseekFunc* SQfseek = (SQfseekFunc*)0x1355DF0;
//SQftell
typedef int(SQftellFunc)(void* file);
static SQftellFunc* SQftell = (SQftellFunc*)0x1355E50;
//SQ_File_read
typedef int(SQ_File_readFunc)(void* file, void* afile, int a);
static SQ_File_readFunc* SQ_File_read = (SQ_File_readFunc*)0x1356090;

View File

@ -112,7 +112,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

View File

@ -241,7 +241,6 @@ int GetEquAddr(int addr)
static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
{
void* file = SQfopen(filename, L"rb");
//void* file = (void*)"IIIAAA <- 66487";
int ret;
unsigned short us;
unsigned char uc;
@ -284,6 +283,18 @@ static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
default: SQfseek(file, 0, 2); break; // ascii
}
const char *add = "newstr";
int prevpos = SQftell(file);
SQfseek(file, 0, 1);
int length = SQftell(file);
SQfseek(file, prevpos, 2);
char temp[256];
SQwrite(&add, 1, sizeof(add), file);
SQfread(&temp, length + 10, sizeof(temp), file);
std::cout << temp << std::endl;
if (SQ_Compile(v, func, file, filename, printerror) >= 0)
{
SQ__Fclose(file);