libs compiles

This commit is contained in:
Ondřej Novák 2025-01-25 21:15:16 +01:00
parent 1b0f7fe0c2
commit a7278bac40
121 changed files with 1528 additions and 1731 deletions

View file

@ -36,15 +36,15 @@ bool DDLFile::ReadFile(void *data, size_t sz)
bool DDLFile::EnumFiles(IDDLFileEnumerator &enmClass)
{
unsigned long firstGroup;
unsigned long groupEndOffset;
unsigned long endGroups;
uint32_t firstGroup;
uint32_t groupEndOffset;
uint32_t endGroups;
int i;
int ngroups;
SetFilePointer(_hFile,0,0,FILE_BEGIN);
if (ReadFile(&firstGroup,sizeof(firstGroup))==false) return false;
if (ReadFile(&groupEndOffset,sizeof(firstGroup))==false) return false;
unsigned long *group=(unsigned long *)alloca(groupEndOffset);
uint32_t *group=(uint32_t *)alloca(groupEndOffset);
group[0]=firstGroup;
group[1]=groupEndOffset;
ngroups=groupEndOffset/8;
@ -56,13 +56,13 @@ bool DDLFile::EnumFiles(IDDLFileEnumerator &enmClass)
WString fname;
for (i=0;i<ngroups;i++)
{
unsigned long endGroup=(i+1)<ngroups?group[i*2+3]:endGroups;
uint32_t endGroup=(i+1)<ngroups?group[i*2+3]:endGroups;
SetFilePointer(_hFile,group[i*2+1],0,FILE_BEGIN);
unsigned long pos=group[i*2+1];
uint32_t pos=group[i*2+1];
while (pos<endGroup)
{
char buff[13];
unsigned long offset;
uint32_t offset;
if (ReadFile(buff,12)==false) return false;
if (ReadFile(&offset,4)==false) return false;
buff[12]=0;
@ -74,15 +74,15 @@ bool DDLFile::EnumFiles(IDDLFileEnumerator &enmClass)
return true;
}
unsigned long DDLFile::GetFileSize(unsigned long offset)
uint32_t DDLFile::GetFileSize(uint32_t offset)
{
unsigned long sz=0;
uint32_t sz=0;
SetFilePointer(_hFile,offset,0,FILE_BEGIN);
ReadFile(&sz,4);
return sz;
}
DDLData DDLFile::ExtractFile(unsigned long offset)
DDLData DDLFile::ExtractFile(uint32_t offset)
{
SetFilePointer(_hFile,offset,0,FILE_BEGIN);
DDLData data;

View file

@ -5,7 +5,7 @@
class IDDLFileEnumerator
{
public:
virtual bool File(WString name, int group, unsigned long offset)=0;
virtual bool File(WString name, int group, uint32_t offset)=0;
};
struct DDLData
@ -40,6 +40,6 @@ public:
bool OpenDDLFile(WString filename);
bool EnumFiles(IDDLFileEnumerator &enmClass);
DDLData ExtractFile(unsigned long offset);
unsigned long GetFileSize(unsigned long offset);
DDLData ExtractFile(uint32_t offset);
uint32_t GetFileSize(uint32_t offset);
};

View file

@ -281,7 +281,7 @@ static CString GetGroupName(int group)
return res;
}
bool CDDLReaderDlg::File(WString name, int group, unsigned long offset)
bool CDDLReaderDlg::File(WString name, int group, uint32_t offset)
{
LVITEM item;
CString grpname=GetGroupName(group);
@ -305,10 +305,10 @@ void CDDLReaderDlg::UpdateList(void)
_ddlfile.EnumFiles(*this);
for (int i=0,cnt=wFileList.GetItemCount();i<cnt;i++)
{
unsigned long offset;
uint32_t offset;
tmp=wFileList.GetItemText(i,3);
offset=_wtoi(tmp);
unsigned long size=_ddlfile.GetFileSize(offset);
uint32_t size=_ddlfile.GetFileSize(offset);
if (size<1024)
tmp.Format(_T("%d B"),size);
else
@ -364,8 +364,8 @@ static int CALLBACK SortItemsInFileList(LPARAM lParam1, LPARAM lParam2, LPARAM l
{
sinfo.left=sinfo.list->GetItemText(lParam1,3);
sinfo.right=sinfo.list->GetItemText(lParam2,3);
unsigned long l=_wtoi(sinfo.left);
unsigned long r=_wtoi(sinfo.right);
uint32_t l=_wtoi(sinfo.left);
uint32_t r=_wtoi(sinfo.right);
l=sinfo._ddlfile->GetFileSize(l);
r=sinfo._ddlfile->GetFileSize(r);
res=(l>r)-(l<r);
@ -463,9 +463,9 @@ void CDDLReaderDlg::OnBnClickedExport()
pb.wProgress.SetPos(++cur);
int i=wFileList.GetNextSelectedItem(pos);
CString fname;
unsigned long offset;
uint32_t offset;
fname=wFileList.GetItemText(i,1);
offset=(unsigned long)_wtoi64(wFileList.GetItemText(i,3));
offset=(uint32_t)_wtoi64(wFileList.GetItemText(i,3));
pb.wDesc.SetWindowText(fname);
if (PeekMessage(&msg,0,0,0,PM_NOREMOVE)==TRUE) AfxPumpMessage();
if (pb.stop) break;
@ -506,9 +506,9 @@ WPathname CDDLReaderDlg::CreateTemp(int index)
{
if (!_lastTemp.IsNull()) DeleteFile(_lastTemp);
CString fname;
unsigned long offset;
uint32_t offset;
fname=wFileList.GetItemText(index,1);
offset=(unsigned long)_wtoi64(wFileList.GetItemText(index,3));
offset=(uint32_t)_wtoi64(wFileList.GetItemText(index,3));
_lastTemp.SetTempDirectory();
_lastTemp.SetFileTitle(WSC("SkeldalDDLReader"));
_lastTemp.SetExtension(WSC(".")+WString(fname));

View file

@ -60,7 +60,7 @@ public:
DDLFile _ddlfile;
afx_msg void OnEnKillfocusDdlfile();
void UpdateList(void);
virtual bool File(WString name, int group, unsigned long offset);
virtual bool File(WString name, int group, uint32_t offset);
afx_msg void OnBnClickedDdlbrowse();
afx_msg void OnLvnColumnclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnBnClickedBrowse();

View file

@ -15,7 +15,7 @@ public:
@param curSize size of string that enters to the effect
@return count of extra characters needs to effects;
*/
virtual unsigned long GetEffectExtraSize(unsigned long curSize) {return 0;}
virtual uint32_t GetEffectExtraSize(uint32_t curSize) {return 0;}
///function renders begin of string.
/** Function returns number of characters rendered, and must be <= then size returned by GetEffectExtraSize()
@ -23,14 +23,14 @@ public:
@param curSize size of string that enters to the effect
@return number of characters rendered. Entered string will be rendered behind.
*/
virtual unsigned long PreRenderString(wchar_t *renderPtr,unsigned long curSize) {return 0;}
virtual uint32_t PreRenderString(wchar_t *renderPtr,uint32_t curSize) {return 0;}
///function renders effect.
/**
@param renderPtr pointer to begin of render buffer.
@param rendered number of characters rendered by previous effect. Value doesn't point to the end
of buffer, function must add result of PreRenderString */
virtual void RenderString(wchar_t *renderPtr, unsigned long rendered)=0;
virtual void RenderString(wchar_t *renderPtr, uint32_t rendered)=0;
};
#endif

View file

@ -60,7 +60,7 @@ int WString::Format(wchar_t *format, ...)
int WString::ScanStringV(const wchar_t *format, va_list lst) const
{
unsigned long *ptr=(unsigned long *)lst;
uint32_t *ptr=(uint32_t *)lst;
return swscanf(GetString(),format,ptr[0],ptr[1],ptr[2],ptr[3],ptr[4],ptr[5],ptr[6],ptr[7],ptr[8],ptr[9],
ptr[10],ptr[11],ptr[12],ptr[13],ptr[14],ptr[15],ptr[16],ptr[17],ptr[18],ptr[19]);

View file

@ -9,8 +9,8 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
/** Funkce vytvoří transitivní uzávěr.
to znamená, že zruší všechny zřetězené redirecty.
/** Funkce vytvo<EFBFBD><EFBFBD> transitivn<76> uz<75>v<EFBFBD>r.
to znamen<EFBFBD>, <EFBFBD>e zru<EFBFBD><EFBFBD> v<EFBFBD>echny z<EFBFBD>et<EFBFBD>zen<EFBFBD> redirecty.
*/
WStringProxy *WStringProxy::TransitivniUzaver()
{
@ -94,7 +94,7 @@ void WStringProxy::RenderStringToBuffer(wchar_t *renderPtr)
break;
case OpEffect:
{
unsigned long offset=0;
uint32_t offset=0;
renderPtr[_stringSize]=0; //we can append zero, because right side of string is not yet rendered
//if this is end of string, one extra character for zero is also allocated.
//efect functions can rely on it.

View file

@ -90,24 +90,24 @@ public:
};
public:
unsigned long _refCount; //reference count
unsigned long _stringSize:30; //string size in characters (maximum size 1073741823 characters ~ 2147483646 bytes)
uint32_t _refCount; //reference count
uint32_t _stringSize:30; //string size in characters (maximum size 1073741823 characters ~ 2147483646 bytes)
Operation _operation:2; //operation with string or proxy type
union
{
WStringProxy *_baseString; //pointer to next proxy referenced by this proxy
unsigned long _blockData; //user defined block data for OpMemBlock proxy type
uint32_t _blockData; //user defined block data for OpMemBlock proxy type
const wchar_t *_redirect; //used for OpMemBlock, when _blockData2 is zero.
};
union
{
WStringProxy *_secondString; //pointer to second string for OpConcat
unsigned long _offset; //offset of substring for OpSubstr
uint32_t _offset; //offset of substring for OpSubstr
Effect _effect; //effect selector for OpEffect
IWStringEffect *_userEffect; //user effect defined by IWStringEffect interface (valid when _effect is invalid)
unsigned long _blockData2; //user defined block data for OpMemBlock proxy type - exception: if this value is zero, member _redirect is valid
uint32_t _blockData2; //user defined block data for OpMemBlock proxy type - exception: if this value is zero, member _redirect is valid
};
@ -128,7 +128,7 @@ public:
_offset(0)
{_baseString->AddRef();}
WStringProxy(WStringProxy *other, unsigned long offset, unsigned long size):
WStringProxy(WStringProxy *other, uint32_t offset, uint32_t size):
_refCount(0),
_stringSize(size),
_baseString(other),
@ -160,7 +160,7 @@ public:
_userEffect(userEffect)
{_baseString->AddRef();}
WStringProxy(unsigned long size, unsigned long user1, unsigned long user2):
WStringProxy(uint32_t size, uint32_t user1, uint32_t user2):
_refCount(0),
_stringSize(size),
_operation(OpMemBlck),
@ -200,7 +200,7 @@ public:
}
unsigned long GetLength() {return _stringSize;}
uint32_t GetLength() {return _stringSize;}
void AddRef() {if (this) WStringMemory::AddRefProxy(this);}
void Release() {if (this) if (WStringMemory::ReleaseRefProxy(this)) WStringMemory::FreeProxy(this);}