Add rayman2 source files
This commit is contained in:
6
Rayman_X/cpa/tempgrp/PTC/Misc/DefLib.h
Normal file
6
Rayman_X/cpa/tempgrp/PTC/Misc/DefLib.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#if !defined(__DEFLIB_H__)
|
||||
#define __DEFLIB_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#endif // __DEFLIB_H__
|
46
Rayman_X/cpa/tempgrp/PTC/Misc/MemLib.h
Normal file
46
Rayman_X/cpa/tempgrp/PTC/Misc/MemLib.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#if !defined(__MEMLIB_H__)
|
||||
#define __MEMLIB_H__
|
||||
|
||||
#if defined(USE_STDMEMLIB)
|
||||
|
||||
#include <stddef.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MemoryInit()
|
||||
#define MemoryDone()
|
||||
|
||||
#define MemoryAlloc malloc
|
||||
#define MemoryCalloc calloc
|
||||
#define MemoryFree(x) { if (*(x)) { free((void*) *(x)); *(x)=NULL; } }
|
||||
#define MemorySet memset
|
||||
#define MemoryMove memmove
|
||||
#define MemoryCopy memcpy
|
||||
#define MemoryCompare memcmp
|
||||
|
||||
#else
|
||||
|
||||
#include "deflib.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void MemoryInit();
|
||||
void MemoryDone();
|
||||
|
||||
void *MemoryAlloc(size_t size);
|
||||
void *MemoryCalloc(size_t num,size_t size);
|
||||
void MemoryFree(void** ptr);
|
||||
void *MemorySet(void *dest,int c,size_t count);
|
||||
void *MemoryMove(void *dest,const void *src,size_t count);
|
||||
void *MemoryCopy(void *dest,const void *src,size_t count);
|
||||
int MemoryCompare(const void *buf1,const void *buf2, size_t count);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // USE_STDMEMLIB
|
||||
|
||||
#endif // __MEMLIB_H__
|
135
Rayman_X/cpa/tempgrp/PTC/Misc/StrLib.h
Normal file
135
Rayman_X/cpa/tempgrp/PTC/Misc/StrLib.h
Normal file
@@ -0,0 +1,135 @@
|
||||
#if !defined(__STRLIB_H__)
|
||||
#define __STRLIB_H__
|
||||
|
||||
#include "acp_base.h"
|
||||
|
||||
#if defined(USE_STDSTRLIB)
|
||||
#include <string.h>
|
||||
|
||||
#define StringCopy strcpy
|
||||
#define StringLength strlen
|
||||
#define StringCat strcat
|
||||
#define StringNCopy strncpy
|
||||
#define StringRChar strrchr
|
||||
#define StringChar strchr
|
||||
#define StringCompare strcmp
|
||||
#define StringICompare stricmp
|
||||
#define StringNICompare strnicmp
|
||||
#define StringNCompare strncmp
|
||||
#define StringString strstr
|
||||
#define StringUpper strupr
|
||||
#define StringLower strlwr
|
||||
|
||||
#if defined(USE_CRYPTNAME)
|
||||
#define StringCompareToCryptKey strcmp
|
||||
#else
|
||||
#define StringCompareToCryptKey strcmp
|
||||
#endif
|
||||
|
||||
#elif defined(INLINE_STDSTRLIB)
|
||||
|
||||
INLINE
|
||||
const char * __cdecl StringCopy(const char * dst,const char * src)
|
||||
{
|
||||
const char *savedst=dst;
|
||||
while( (*(unsigned char *)dst++=*(unsigned char *)src++) );
|
||||
return(savedst);
|
||||
}
|
||||
|
||||
INLINE
|
||||
int __cdecl StringCompare(const char * src,const char * dst)
|
||||
{
|
||||
int ret = 0 ;
|
||||
|
||||
while( ! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst)
|
||||
++src, ++dst;
|
||||
|
||||
if ( ret < 0 ) ret = -1 ;
|
||||
else if ( ret > 0 ) ret = 1 ;
|
||||
return( ret );
|
||||
}
|
||||
|
||||
INLINE
|
||||
int __cdecl StringICompare(const char * dst, const char * src)
|
||||
{
|
||||
int f,l;
|
||||
|
||||
do
|
||||
{
|
||||
if ( ((f = (unsigned char)(*(dst++))) >= 'A') && (f <= 'Z') )
|
||||
f -= ('A' - 'a');
|
||||
|
||||
if ( ((l = (unsigned char)(*(src++))) >= 'A') && (l <= 'Z') )
|
||||
l -= ('A' - 'a');
|
||||
}
|
||||
while ( f && (f == l) );
|
||||
|
||||
return(f - l);
|
||||
}
|
||||
|
||||
#if defined(USE_CRYPTNAME)
|
||||
INLINE
|
||||
int __cdecl StringCompareToCryptKey(const char * src,const char * dst)
|
||||
{
|
||||
int ret = 0 ;
|
||||
long lKey = *(long*)(dst);
|
||||
unsigned char *p_ucCryptKey = (unsigned char*) &lKey;
|
||||
unsigned char ucSize = (unsigned char)dst [4];
|
||||
unsigned char ucIndex;
|
||||
unsigned char ucUncoded;
|
||||
|
||||
dst += 5;
|
||||
for (ucIndex = 0 ; ucIndex < ucSize ; ucIndex++)
|
||||
{
|
||||
// uncode dst char
|
||||
ucUncoded = (*(unsigned char *)dst++ - p_ucCryptKey[0]) ^ p_ucCryptKey[1];
|
||||
p_ucCryptKey[0] += p_ucCryptKey[2];
|
||||
p_ucCryptKey[1] += p_ucCryptKey[3];
|
||||
|
||||
// compare
|
||||
ret = *(unsigned char *)src++ - ucUncoded;
|
||||
if(ret) break;
|
||||
}
|
||||
|
||||
if ( ret < 0 ) ret = -1 ;
|
||||
else if ( ret > 0 ) ret = 1 ;
|
||||
return( ret );
|
||||
}
|
||||
#else
|
||||
#define StringCompareToCryptKey StringCompare
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include "deflib.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *StringCopy(char *StrDestination,const char *StrSource);
|
||||
size_t StringLength(const char *String);
|
||||
char *StringCat(char *StrDestination,const char *StrSource);
|
||||
char *StringNCopy(char *StrDestination,const char *StrSource,size_t count);
|
||||
char *StringRChar(const char *String,int c);
|
||||
char *StringChar(const char *String,int c);
|
||||
int StringNICompare(const char *String1,const char *String2,size_t count);
|
||||
int StringNCompare(const char *String1,const char *String2,size_t count);
|
||||
int StringICompare(const char *String1,const char *String2);
|
||||
int StringCompare(const char *String1,const char *String2);
|
||||
char *StringString(const char *string,const char *strCharSet);
|
||||
char *StringUpper(char *string);
|
||||
char *StringLower(char *string);
|
||||
|
||||
#if defined(USE_CRYPTNAME)
|
||||
int StringCompareToCryptKey(const char *String1,const char *String2);
|
||||
#else
|
||||
#define StringCompareToCryptKey strcmp
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // USE_STDSTRLIB
|
||||
|
||||
#endif // __STRLIB_H__
|
Reference in New Issue
Block a user