From 4e41f79a50b18b4e9b9fa00bbfa68ecb15fcb63e Mon Sep 17 00:00:00 2001 From: fusion32 Date: Thu, 22 May 2025 19:03:45 -0300 Subject: implement TWriteStream, T(Dynamic)WriteBuffer, and TWriteBinaryFile --- reference/game.c | 807 ----------------------------------------------------- reference/types.hh | 24 -- 2 files changed, 831 deletions(-) (limited to 'reference') diff --git a/reference/game.c b/reference/game.c index 4692709..1ce2aba 100644 --- a/reference/game.c +++ b/reference/game.c @@ -2057,499 +2057,6 @@ void print(void) return; } -// DWARF original prototype: void writeFlag(TWriteStream * this, bool f) - -void __thiscall TWriteStream::writeFlag(TWriteStream *this,bool f) - -{ - // try { // try from 0804d47b to 0804d47d has its CatchHandler @ 0804d482 - (*this->_vptr_TWriteStream[1])(this,(uint)f); - return; -} - - - -// DWARF original prototype: void writeWord(TWriteStream * this, ushort w) - -void __thiscall TWriteStream::writeWord(TWriteStream *this,ushort w) - -{ - // try { // try from 0804d4c1 to 0804d4d7 has its CatchHandler @ 0804d4e2 - (*this->_vptr_TWriteStream[1])(this,w & 0xff); - (*this->_vptr_TWriteStream[1])(this,w >> 8); - return; -} - - - -// DWARF original prototype: void writeQuad(TWriteStream * this, ulong q) - -void __thiscall TWriteStream::writeQuad(TWriteStream *this,ulong q) - -{ - // try { // try from 0804d51e to 0804d553 has its CatchHandler @ 0804d560 - (*this->_vptr_TWriteStream[1])(this,q & 0xff); - (*this->_vptr_TWriteStream[1])(this,q >> 8 & 0xff); - (*this->_vptr_TWriteStream[1])(this,q >> 0x10 & 0xff); - (*this->_vptr_TWriteStream[1])(this,q >> 0x18); - return; -} - - - -// DWARF original prototype: void writeString(TWriteStream * this, char * s) - -void __thiscall TWriteStream::writeString(TWriteStream *this,char *s) - -{ - size_t sVar1; - - if (s == (char *)0x0) { - (*this->_vptr_TWriteStream[2])(this,0); - } - else { - sVar1 = strlen(s); - if ((int)sVar1 < 0xffff) { - (*this->_vptr_TWriteStream[2])(this,sVar1 & 0xffff); - } - else { - // try { // try from 0804d5b7 to 0804d610 has its CatchHandler @ 0804d613 - (*this->_vptr_TWriteStream[2])(this,0xffff); - (*this->_vptr_TWriteStream[3])(this,sVar1); - } - if (sVar1 != 0) { - (*this->_vptr_TWriteStream[5])(this,s,sVar1); - } - } - return; -} - - - -// DWARF original prototype: void writeBytes(TWriteStream * this, uchar * Buffer, int Count) - -void __thiscall TWriteStream::writeBytes(TWriteStream *this,uchar *Buffer,int Count) - -{ - undefined4 *puVar1; - int i; - int iVar2; - - if (Buffer == (uchar *)0x0) { - error(&DAT_080eec20); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = "internal error"; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,char_const*::typeinfo,0); - } - iVar2 = 0; - if (0 < Count) { - do { - // try { // try from 0804d673 to 0804d6b2 has its CatchHandler @ 0804d6b3 - (*this->_vptr_TWriteStream[1])(this,(uint)Buffer[iVar2]); - iVar2 = iVar2 + 1; - } while (iVar2 < Count); - } - return; -} - -// DWARF original prototype: void TWriteBuffer(TWriteBuffer * this, uchar * data, int size) - -void __thiscall TWriteBuffer::TWriteBuffer(TWriteBuffer *this,uchar *data,int size) - -{ - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_081267a8; - this->Data = data; - this->Size = size; - this->Position = 0; - if (data == (uchar *)0x0) { - error("TWriteBuffer::TWriteBuffer: data ist NULL.\n"); - this->Size = 0; - } - else if (size < 0) { - error(&DAT_080eed20); - return; - } - return; -} - - - -// DWARF original prototype: void TWriteBuffer(TWriteBuffer * this, uchar * data, int size) - -void __thiscall TWriteBuffer::TWriteBuffer(TWriteBuffer *this,uchar *data,int size) - -{ - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_081267a8; - this->Data = data; - this->Size = size; - this->Position = 0; - if (data == (uchar *)0x0) { - error("TWriteBuffer::TWriteBuffer: data ist NULL.\n"); - this->Size = 0; - } - else if (size < 0) { - error(&DAT_080eed20); - return; - } - return; -} - - - -// DWARF original prototype: void writeByte(TWriteBuffer * this, uchar b) - -void __thiscall TWriteBuffer::writeByte(TWriteBuffer *this,uchar b) - -{ - undefined4 *puVar1; - - if (this->Position <= this->Size + -1) { - this->Data[this->Position] = b; - this->Position = this->Position + 1; - return; - } - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = "buffer full"; - // WARNING: Subroutine does not return - // try { // try from 0804db5f to 0804db63 has its CatchHandler @ 0804db64 - __cxa_throw(puVar1,char_const*::typeinfo,0); -} - - - -// DWARF original prototype: void writeWord(TWriteBuffer * this, ushort w) - -void __thiscall TWriteBuffer::writeWord(TWriteBuffer *this,ushort w) - -{ - undefined4 *puVar1; - - if (this->Position <= this->Size + -2) { - this->Data[this->Position] = (uchar)w; - this->Data[this->Position + 1] = (uchar)(w >> 8); - this->Position = this->Position + 2; - return; - } - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = "buffer full"; - // WARNING: Subroutine does not return - // try { // try from 0804dbe0 to 0804dbe4 has its CatchHandler @ 0804dbe5 - __cxa_throw(puVar1,char_const*::typeinfo,0); -} - - - -// DWARF original prototype: void writeQuad(TWriteBuffer * this, ulong q) - -void __thiscall TWriteBuffer::writeQuad(TWriteBuffer *this,ulong q) - -{ - undefined4 *puVar1; - - if (this->Position <= this->Size + -4) { - this->Data[this->Position] = (uchar)q; - this->Data[this->Position + 1] = (uchar)(q >> 8); - this->Data[this->Position + 2] = (uchar)(q >> 0x10); - this->Data[this->Position + 3] = (uchar)(q >> 0x18); - this->Position = this->Position + 4; - return; - } - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = "buffer full"; - // WARNING: Subroutine does not return - // try { // try from 0804dc79 to 0804dc7d has its CatchHandler @ 0804dc7e - __cxa_throw(puVar1,char_const*::typeinfo,0); -} - - - -// DWARF original prototype: void writeBytes(TWriteBuffer * this, uchar * Buffer, int Count) - -void __thiscall TWriteBuffer::writeBytes(TWriteBuffer *this,uchar *Buffer,int Count) - -{ - undefined4 *puVar1; - - if (this->Position <= this->Size - Count) { - memcpy(this->Data + this->Position,Buffer,Count); - this->Position = this->Position + Count; - return; - } - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = "buffer full"; - // WARNING: Subroutine does not return - // try { // try from 0804dd08 to 0804dd0c has its CatchHandler @ 0804dd0d - __cxa_throw(puVar1,char_const*::typeinfo,0); -} - - - -// DWARF original prototype: void TDynamicWriteBuffer(TDynamicWriteBuffer * this, int InitialSize) - -void __thiscall TDynamicWriteBuffer::TDynamicWriteBuffer(TDynamicWriteBuffer *this,int InitialSize) - -{ - uchar *data; - - data = (uchar *)operator_new__(InitialSize); - TWriteBuffer::TWriteBuffer(&this->super_TWriteBuffer,data,InitialSize); - (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = - (_func_int_varargs **)&PTR_writeFlag_08126768; - return; -} - - - -// DWARF original prototype: void TDynamicWriteBuffer(TDynamicWriteBuffer * this, int InitialSize) - -void __thiscall TDynamicWriteBuffer::TDynamicWriteBuffer(TDynamicWriteBuffer *this,int InitialSize) - -{ - uchar *data; - - data = (uchar *)operator_new__(InitialSize); - TWriteBuffer::TWriteBuffer(&this->super_TWriteBuffer,data,InitialSize); - (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = - (_func_int_varargs **)&PTR_writeFlag_08126768; - return; -} - - - -// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) - -void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) - -{ - uchar *puVar1; - - (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = - (_func_int_varargs **)&PTR_writeFlag_08126768; - puVar1 = (this->super_TWriteBuffer).Data; - if (puVar1 != (uchar *)0x0) { - operator_delete__(puVar1); - } - return; -} - - - -// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) - -void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) - -{ - uchar *puVar1; - - (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = - (_func_int_varargs **)&PTR_writeFlag_08126768; - puVar1 = (this->super_TWriteBuffer).Data; - if (puVar1 != (uchar *)0x0) { - operator_delete__(puVar1); - } - return; -} - - - -// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) - -void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) - -{ - uchar *puVar1; - - puVar1 = (this->super_TWriteBuffer).Data; - (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = - (_func_int_varargs **)&PTR_writeFlag_08126768; - if (puVar1 != (uchar *)0x0) { - operator_delete__(puVar1); - } - operator_delete(this); - return; -} - - - -// DWARF original prototype: void resizeBuffer(TDynamicWriteBuffer * this) - -void __thiscall TDynamicWriteBuffer::resizeBuffer(TDynamicWriteBuffer *this) - -{ - int *piVar1; - uchar *puVar2; - uchar *__dest; - uchar *Help; - - __dest = (uchar *)operator_new__((this->super_TWriteBuffer).Size * 2); - memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); - puVar2 = (this->super_TWriteBuffer).Data; - if (puVar2 != (uchar *)0x0) { - operator_delete__(puVar2); - } - piVar1 = &(this->super_TWriteBuffer).Size; - *piVar1 = *piVar1 << 1; - (this->super_TWriteBuffer).Data = __dest; - return; -} - - - -// WARNING: Variable defined which should be unmapped: b_local -// DWARF original prototype: void writeByte(TDynamicWriteBuffer * this, uchar b) - -void __thiscall TDynamicWriteBuffer::writeByte(TDynamicWriteBuffer *this,uchar b) - -{ - int *piVar1; - uchar *puVar2; - uchar *__dest; - int iVar3; - int iVar4; - uchar *Help; - uchar b_local; - - iVar3 = (this->super_TWriteBuffer).Size; - iVar4 = (this->super_TWriteBuffer).Position; - if (iVar3 + -1 < iVar4) { - do { - // try { // try from 0804dee6 to 0804deea has its CatchHandler @ 0804df30 - __dest = (uchar *)operator_new__(iVar3 * 2); - memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); - puVar2 = (this->super_TWriteBuffer).Data; - if (puVar2 != (uchar *)0x0) { - operator_delete__(puVar2); - } - (this->super_TWriteBuffer).Data = __dest; - iVar4 = (this->super_TWriteBuffer).Position; - iVar3 = (this->super_TWriteBuffer).Size * 2; - (this->super_TWriteBuffer).Size = iVar3; - } while (iVar3 + -1 < iVar4); - } - (this->super_TWriteBuffer).Data[iVar4] = b; - piVar1 = &(this->super_TWriteBuffer).Position; - *piVar1 = *piVar1 + 1; - return; -} - - - -// DWARF original prototype: void writeWord(TDynamicWriteBuffer * this, ushort w) - -void __thiscall TDynamicWriteBuffer::writeWord(TDynamicWriteBuffer *this,ushort w) - -{ - int *piVar1; - uchar *puVar2; - uchar *__dest; - int iVar3; - int iVar4; - uchar *Help; - - iVar3 = (this->super_TWriteBuffer).Size; - iVar4 = (this->super_TWriteBuffer).Position; - if (iVar3 + -2 < iVar4) { - do { - // try { // try from 0804dfa6 to 0804dfaa has its CatchHandler @ 0804dff0 - __dest = (uchar *)operator_new__(iVar3 * 2); - memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); - puVar2 = (this->super_TWriteBuffer).Data; - if (puVar2 != (uchar *)0x0) { - operator_delete__(puVar2); - } - (this->super_TWriteBuffer).Data = __dest; - iVar4 = (this->super_TWriteBuffer).Position; - iVar3 = (this->super_TWriteBuffer).Size * 2; - (this->super_TWriteBuffer).Size = iVar3; - } while (iVar3 + -2 < iVar4); - } - (this->super_TWriteBuffer).Data[iVar4] = (uchar)w; - (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 1] = (uchar)(w >> 8); - piVar1 = &(this->super_TWriteBuffer).Position; - *piVar1 = *piVar1 + 2; - return; -} - - - -// DWARF original prototype: void writeQuad(TDynamicWriteBuffer * this, ulong q) - -void __thiscall TDynamicWriteBuffer::writeQuad(TDynamicWriteBuffer *this,ulong q) - -{ - int *piVar1; - uchar *puVar2; - uchar *__dest; - int iVar3; - int iVar4; - uchar *Help; - - iVar3 = (this->super_TWriteBuffer).Size; - iVar4 = (this->super_TWriteBuffer).Position; - if (iVar3 + -4 < iVar4) { - do { - // try { // try from 0804e076 to 0804e07a has its CatchHandler @ 0804e0c0 - __dest = (uchar *)operator_new__(iVar3 * 2); - memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); - puVar2 = (this->super_TWriteBuffer).Data; - if (puVar2 != (uchar *)0x0) { - operator_delete__(puVar2); - } - (this->super_TWriteBuffer).Data = __dest; - iVar4 = (this->super_TWriteBuffer).Position; - iVar3 = (this->super_TWriteBuffer).Size * 2; - (this->super_TWriteBuffer).Size = iVar3; - } while (iVar3 + -4 < iVar4); - } - (this->super_TWriteBuffer).Data[iVar4] = (uchar)q; - (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 1] = (uchar)(q >> 8); - (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 2] = (uchar)(q >> 0x10); - (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 3] = (uchar)(q >> 0x18); - piVar1 = &(this->super_TWriteBuffer).Position; - *piVar1 = *piVar1 + 4; - return; -} - - - -// DWARF original prototype: void writeBytes(TDynamicWriteBuffer * this, uchar * Buffer, int Count) - -void __thiscall TDynamicWriteBuffer::writeBytes(TDynamicWriteBuffer *this,uchar *Buffer,int Count) - -{ - int *piVar1; - uchar *puVar2; - uchar *__dest; - int iVar3; - int iVar4; - uchar *Help; - - iVar3 = (this->super_TWriteBuffer).Size; - iVar4 = (this->super_TWriteBuffer).Position; - if (iVar3 - Count < iVar4) { - do { - // try { // try from 0804e136 to 0804e13a has its CatchHandler @ 0804e180 - __dest = (uchar *)operator_new__(iVar3 * 2); - memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); - puVar2 = (this->super_TWriteBuffer).Data; - if (puVar2 != (uchar *)0x0) { - operator_delete__(puVar2); - } - (this->super_TWriteBuffer).Data = __dest; - iVar4 = (this->super_TWriteBuffer).Position; - iVar3 = (this->super_TWriteBuffer).Size * 2; - (this->super_TWriteBuffer).Size = iVar3; - } while (iVar3 - Count < iVar4); - } - memcpy((this->super_TWriteBuffer).Data + iVar4,Buffer,Count); - piVar1 = &(this->super_TWriteBuffer).Position; - *piVar1 = *piVar1 + Count; - return; -} - - - int val(char c) { @@ -3146,8 +2653,6 @@ void UnpackRelativeCoordinate(void) return; } - - void SaveFile(char *Filename) { @@ -3272,318 +2777,6 @@ LAB_0804eb1e: return; } -// DWARF original prototype: void TWriteBinaryFile(TWriteBinaryFile * this) - -void __thiscall TWriteBinaryFile::TWriteBinaryFile(TWriteBinaryFile *this) - -{ - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; - this->File = (FILE *)0x0; - return; -} - - - -// DWARF original prototype: void TWriteBinaryFile(TWriteBinaryFile * this) - -void __thiscall TWriteBinaryFile::TWriteBinaryFile(TWriteBinaryFile *this) - -{ - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; - this->File = (FILE *)0x0; - return; -} - - - -// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) - -void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) - -{ - FILE *pFVar1; - char *pcVar2; - int iVar3; - int *piVar4; - - pFVar1 = this->File; - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; - if (pFVar1 != (FILE *)0x0) { - pcVar2 = ""; - if (this != (TWriteBinaryFile *)0xfffffff8) { - pcVar2 = this->Filename; - } - ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); - iVar3 = fclose((FILE *)this->File); - if (iVar3 != 0) { - piVar4 = __errno_location(); - ::error(&DAT_080eff80,*piVar4); - } - } - return; -} - - - -// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) - -void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) - -{ - FILE *pFVar1; - char *pcVar2; - int iVar3; - int *piVar4; - - pFVar1 = this->File; - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; - if (pFVar1 != (FILE *)0x0) { - pcVar2 = ""; - if (this != (TWriteBinaryFile *)0xfffffff8) { - pcVar2 = this->Filename; - } - ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); - iVar3 = fclose((FILE *)this->File); - if (iVar3 != 0) { - piVar4 = __errno_location(); - ::error(&DAT_080eff80,*piVar4); - } - } - return; -} - - - -// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) - -void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) - -{ - FILE *pFVar1; - char *pcVar2; - int iVar3; - int *piVar4; - - pFVar1 = this->File; - (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; - if (pFVar1 != (FILE *)0x0) { - pcVar2 = ""; - if (this != (TWriteBinaryFile *)0xfffffff8) { - pcVar2 = this->Filename; - } - ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); - iVar3 = fclose((FILE *)this->File); - if (iVar3 != 0) { - piVar4 = __errno_location(); - ::error(&DAT_080eff80,*piVar4); - } - } - operator_delete(this); - return; -} - - - -// DWARF original prototype: void open(TWriteBinaryFile * this, char * FileName) - -int __thiscall TWriteBinaryFile::open(TWriteBinaryFile *this,char *__file,int __oflag,...) - -{ - FILE *pFVar1; - char *pcVar2; - int *piVar3; - undefined4 *puVar4; - int iVar5; - - if ((FILE *)this->File != (FILE *)0x0) { - iVar5 = fclose((FILE *)this->File); - if (iVar5 != 0) { - piVar3 = __errno_location(); - // try { // try from 0805140e to 08051466 has its CatchHandler @ 08051467 - ::error(&DAT_080f0020,*piVar3); - } - this->File = (FILE *)0x0; - sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,"File still open"); - puVar4 = (undefined4 *)__cxa_allocate_exception(4); - *puVar4 = ErrorString; - // WARNING: Subroutine does not return - __cxa_throw(puVar4,char*::typeinfo,0); - } - pFVar1 = fopen(__file,"wb"); - this->File = (FILE *)pFVar1; - if (pFVar1 != (FILE *)0x0) { - pcVar2 = strcpy(this->Filename,__file); - return (int)pcVar2; - } - piVar3 = __errno_location(); - iVar5 = *piVar3; - // try { // try from 0805138d to 080513ef has its CatchHandler @ 0805147a - ::error("TWriteBinaryFile::open: Kann Datei %s nicht anlegen.\n",__file); - pcVar2 = strerror(iVar5); - ::error("Fehler %d: %s.\n",iVar5,pcVar2); - sprintf(ErrorString,"Cannot create file %s.",__file); - puVar4 = (undefined4 *)__cxa_allocate_exception(4); - *puVar4 = ErrorString; - // WARNING: Subroutine does not return - __cxa_throw(puVar4,char*::typeinfo,0); -} - - - -// DWARF original prototype: void close(TWriteBinaryFile * this) - -int __thiscall TWriteBinaryFile::close(TWriteBinaryFile *this,int __fd) - -{ - int __errnum; - char *pcVar1; - int *piVar2; - int ErrorCode; - - pcVar1 = (char *)fclose((FILE *)this->File); - if (pcVar1 != (char *)0x0) { - piVar2 = __errno_location(); - __errnum = *piVar2; - ::error(&DAT_080f0060); - pcVar1 = strerror(__errnum); - ::error("# Datei: %s, Fehlercode: %d (%s)\n",this->Filename,__errnum,pcVar1); - } - this->File = (FILE *)0x0; - return (int)pcVar1; -} - - - -// DWARF original prototype: void error(TWriteBinaryFile * this, char * Text) - -void __thiscall TWriteBinaryFile::error(TWriteBinaryFile *this,char *Text) - -{ - int iVar1; - int *piVar2; - undefined4 *puVar3; - - if ((FILE *)this->File != (FILE *)0x0) { - iVar1 = fclose((FILE *)this->File); - if (iVar1 != 0) { - piVar2 = __errno_location(); - // try { // try from 08051531 to 08051592 has its CatchHandler @ 08051593 - ::error(&DAT_080f0020,*piVar2); - } - } - this->File = (FILE *)0x0; - sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,Text); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = ErrorString; - // WARNING: Subroutine does not return - __cxa_throw(puVar3,char*::typeinfo,0); -} - - - -// WARNING: Variable defined which should be unmapped: Help -// DWARF original prototype: void writeByte(TWriteBinaryFile * this, uchar Number) - -void __thiscall TWriteBinaryFile::writeByte(TWriteBinaryFile *this,uchar Number) - -{ - char *Filename; - size_t sVar1; - int *piVar2; - char *pcVar3; - int iVar4; - int iVar5; - undefined4 *puVar6; - int Result; - int ErrorCode; - uchar local_11 [4]; - uchar Help; - - local_11[0] = Number; - sVar1 = fwrite(local_11,1,1,(FILE *)this->File); - if (sVar1 == 1) { - return; - } - piVar2 = __errno_location(); - iVar5 = *piVar2; - // try { // try from 0805160f to 0805166d has its CatchHandler @ 08051700 - ::error("TWriteBinaryFile::writeByte: Fehler beim Schreiben eines Bytes\n"); - pcVar3 = strerror(iVar5); - Filename = this->Filename; - ::error(&DAT_080f00e0,Filename,sVar1,iVar5,pcVar3); - iVar4 = fclose((FILE *)this->File); - if (iVar4 != 0) { - ::error(&DAT_080f0120,*piVar2,sVar1,iVar5,pcVar3); - } - this->File = (FILE *)0x0; - SaveFile(Filename); - if ((FILE *)this->File != (FILE *)0x0) { - iVar5 = fclose((FILE *)this->File); - if (iVar5 != 0) { - // try { // try from 08051691 to 080516e6 has its CatchHandler @ 080516e7 - ::error(&DAT_080f0020,*piVar2); - } - } - this->File = (FILE *)0x0; - sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while writing byte"); - puVar6 = (undefined4 *)__cxa_allocate_exception(4); - *puVar6 = ErrorString; - // WARNING: Subroutine does not return - __cxa_throw(puVar6,char*::typeinfo,0); -} - - - -// WARNING: Variable defined which should be unmapped: ErrorCode -// DWARF original prototype: void writeBytes(TWriteBinaryFile * this, uchar * Buffer, int Count) - -void __thiscall TWriteBinaryFile::writeBytes(TWriteBinaryFile *this,uchar *Buffer,int Count) - -{ - char *Filename; - size_t sVar1; - int *piVar2; - char *pcVar3; - int iVar4; - int iVar5; - undefined4 *puVar6; - int Result; - int ErrorCode; - - sVar1 = fwrite(Buffer,1,Count,(FILE *)this->File); - if (sVar1 == Count) { - return; - } - piVar2 = __errno_location(); - iVar5 = *piVar2; - // try { // try from 0805176e to 080517d2 has its CatchHandler @ 08051860 - ::error("TWriteBinaryFile::writeBytes: Fehler beim Schreiben von %d Bytes\n",Count); - Filename = this->Filename; - pcVar3 = strerror(iVar5); - ::error(&DAT_080f00e0,Filename,sVar1,iVar5,pcVar3); - iVar4 = fclose((FILE *)this->File); - if (iVar4 != 0) { - ::error(&DAT_080f01e0,*piVar2,sVar1,iVar5,pcVar3); - } - this->File = (FILE *)0x0; - SaveFile(Filename); - if ((FILE *)this->File != (FILE *)0x0) { - iVar5 = fclose((FILE *)this->File); - if (iVar5 != 0) { - // try { // try from 080517f6 to 0805184b has its CatchHandler @ 0805184c - ::error(&DAT_080f0020,*piVar2); - } - } - this->File = (FILE *)0x0; - sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while writing bytes"); - puVar6 = (undefined4 *)__cxa_allocate_exception(4); - *puVar6 = ErrorString; - // WARNING: Subroutine does not return - __cxa_throw(puVar6,char*::typeinfo,0); -} - - - void __static_initialization_and_destruction_0(int __initialize_p,int __priority) { diff --git a/reference/types.hh b/reference/types.hh index 8aecd75..6b59f4d 100644 --- a/reference/types.hh +++ b/reference/types.hh @@ -639,21 +639,6 @@ struct fifoIterator { int Position; }; -struct TWriteStream { - int (**_vptr.TWriteStream)(...); -}; - -struct TWriteBuffer { - struct TWriteStream super_TWriteStream; - uchar *Data; - int Size; - int Position; -}; - -struct TDynamicWriteBuffer { - struct TWriteBuffer super_TWriteBuffer; -}; - struct TDirectReplyData { ulong CharacterID; char Message[100]; @@ -786,15 +771,6 @@ struct TReaderThreadReply { int Size; }; -struct TWriteBinaryFile { - struct TWriteStream super_TWriteStream; - undefined field1_0x1; - undefined field2_0x2; - undefined field3_0x3; - FILE *File; - char Filename[4096]; -}; - struct TNPC { struct TNonplayer super_TNonplayer; ulong Interlocutor; -- cgit v1.2.3