這兩天Gravatar被墻,真是吐血,博客上所有的頭像都不能顯示了。BS抽風(fēng)的GFW。
經(jīng)測(cè)試,雖然%d.gravatar.com不能訪問,但是gravatar.com還是可以訪問的,因此解決方法也很簡(jiǎn)單:
將”wp-includes/pluggable.php”文件中的1649-1652行:
閱讀全文(338字)文章來源:
http://gccfeli.cn/2010/10/gravatar-gfw.html
C# 3.0及以后版本提供了擴(kuò)展方法這一強(qiáng)大工具,使得動(dòng)態(tài)擴(kuò)展類變得十分方便。具體使用方法是定義一個(gè)static class,然后定義static擴(kuò)展方法,注意擴(kuò)展方法的第一個(gè)參數(shù)必須用this關(guān)鍵字修飾。擴(kuò)展方法能像類本身定義的方法一樣被使用,而不需要修改類的代碼,這樣擴(kuò)展原有庫(kù)中的類就變得非常容易了。擴(kuò)展方法同樣對(duì)接口生效,更牛X的是,擴(kuò)展方法中同樣可以使用泛型。
下面是一個(gè)例子,展示了怎樣擴(kuò)展IEnumerable接口,增加一個(gè)RandomSelect的方法用于在表中隨機(jī)選取元素。
閱讀全文(865字)文章來源:
http://gccfeli.cn/2010/10/c-generic-extend-method.html
很久沒有做過逆向了,今天就玩了玩,并且玩了一整天。以下為研究成果。
Axp包其實(shí)是很簡(jiǎn)單的,結(jié)構(gòu)簡(jiǎn)單,明文保存。
Axp文件格式大致上如下:
1.文件頭;
2.索引表;
3.文件名表;
4.數(shù)據(jù)。
其中,文件名表以文件名為(list)的文件存在于數(shù)據(jù)當(dāng)中。我想,之所以要有這么一個(gè)東西,而不和索引表合二為一,恐怕是因?yàn)槲募亲冮L(zhǎng)之故吧。
Axp文件頭的格式大致為:
1. 文件標(biāo)示,一般為字符串“AXPK”,它占據(jù)了四個(gè)字節(jié),占據(jù)空間為0x00-0x04;
2.索引表偏移量,為unit,它占據(jù)了四個(gè)字節(jié),占據(jù)的空間為:0x10-0x13;
3.文件數(shù),為unit,它占據(jù)了四個(gè)字節(jié),占據(jù)的空間為:0x14-0x17。
文件頭占據(jù)40個(gè)字節(jié),既是在0x00-0x27的空間內(nèi)。
一般來說,索引表的偏移量為:0x60028,數(shù)據(jù)區(qū)的偏移量為:0x160028.
不過還是依照以下流程獲取偏移量為好:
1.獲取文件頭的索引表偏移量;
2.使用索引表偏移量定位到文件具體位置;
3.使用文件頭獲取到的文件數(shù)來讀取文件數(shù)條索引;
4.根據(jù)索引查找文件。
在
這里我是很納悶的:文件名表文件沒有特殊位置,也似乎沒有看到有文件頭保存的偏移量指向它,如何去獲取這個(gè)文件是個(gè)很令我困擾的事情。另外,表里面的文件
名順序和資源包里面的文件排列順序似乎是沒有一個(gè)順序?qū)?yīng)的關(guān)系的。如何將索引表和文件名表進(jìn)行關(guān)聯(lián),又是一個(gè)令人困擾的事情,或許能夠解釋通的大概就是
他們是讀取后需要排序的,或者說還有什么特別的相關(guān)數(shù)據(jù)我沒有獲取到。
索引表的索引:
1.偏移量,unit;
2.文件大小,unit;
3.標(biāo)志位,unit,現(xiàn)在似乎只有0x00000000和0x80000000兩個(gè)標(biāo)識(shí),用于標(biāo)示該文件是否可以被使用或者已經(jīng)被刪除。
到現(xiàn)在為止,最令我困惑的就是那兩張表該如何進(jìn)行關(guān)聯(lián)和綁定數(shù)據(jù)。還有就是如何去獲取文件名表。
說明:本文章純屬學(xué)習(xí)之用,如有商業(yè)之用,與本人無關(guān)。網(wǎng)絡(luò)游戲《天龍八部》采用的是Ogre3d作為其客戶端渲染引擎,他們對(duì)之做了許多自定義的修改,在這里作為學(xué)習(xí)只用,特別說明一下其自定義的Skeleton的格式,以及如何加載的辦法。
天龍八部加入了這樣一個(gè)區(qū)段:
SKELETON_ANIMATION_TRACK_MULTI_KEYFRAME 0x4120 (16672)
在加入了這個(gè)區(qū)段的內(nèi)容之后,其格式大概就是這樣一個(gè)樣子:
enum SkeletonChunkID {
SKELETON_HEADER = 0x1000,
// char* version : Version number check
SKELETON_BONE = 0x2000,
// Repeating section defining each bone in the system.
// Bones are assigned indexes automatically based on their order of declaration
// starting with 0.
// char* name : name of the bone
// unsigned short handle : handle of the bone, should be contiguous & start at 0
// Vector3 position : position of this bone relative to parent
// Quaternion orientation : orientation of this bone relative to parent
// Vector3 scale : scale of this bone relative to parent
SKELETON_BONE_PARENT = 0x3000,
// Record of the parent of a single bone, used to build the node tree
// Repeating section, listed in Bone Index order, one per Bone
// unsigned short handle : child bone
// unsigned short parentHandle : parent bone
SKELETON_ANIMATION = 0x4000,
// A single animation for this skeleton
// char* name : Name of the animation
// float length : Length of the animation in seconds
SKELETON_ANIMATION_TRACK = 0x4100,
// A single animation track (relates to a single bone)
// Repeating section (within SKELETON_ANIMATION)
// unsigned short boneIndex : Index of bone to apply to
SKELETON_ANIMATION_TRACK_KEYFRAME = 0x4110,
// A single keyframe within the track
// Repeating section
// float time : The time position (seconds)
// Quaternion rotate : Rotation to apply at this keyframe
// Vector3 translate : Translation to apply at this keyframe
// Vector3 scale : Scale to apply at this keyframe
SKELETON_ANIMATION_TRACK_MULTI_KEYFRAME = 0x4120,
// A multiple keyframe within the track
// Repeating section
// float length : Length of the animation in seconds
// float flags : Length of the animation in seconds
// float time : The time position (seconds)
// Quaternion rotate : Rotation to apply at this keyframe
// Vector3 translate : Translation to apply at this keyframe
SKELETON_ANIMATION_LINK = 0x5000
// Link to another skeleton, to re-use its animations
// char* skeletonName : name of skeleton to get animations from
// float scale : scale to apply to trans/scale keys
};
然后我們打開OgreSkeletonSerializer.cpp找到SkeletonSerializer::readAnimationTrack的實(shí)現(xiàn),然后替換為下面的代碼:
void SkeletonSerializer::readAnimationTrack(DataStreamPtr& stream, Animation* anim,
Skeleton* pSkel)
{
// unsigned short boneIndex : Index of bone to apply to
unsigned short boneHandle;
readShorts(stream, &boneHandle, 1);
// Find bone
Bone *targetBone = pSkel->getBone(boneHandle);
// Create track
NodeAnimationTrack* pTrack = anim->createNodeTrack(boneHandle, targetBone);
// Keep looking for nested keyframes
if (!stream->eof())
{
unsigned short streamID = readChunk(stream);
while( (streamID == SKELETON_ANIMATION_TRACK_KEYFRAME || streamID == SKELETON_ANIMATION_TRACK_MULTI_KEYFRAME)
&& !stream->eof())
{
if (streamID == SKELETON_ANIMATION_TRACK_MULTI_KEYFRAME)
{
// TLBB 新增了此部分
unsigned short len;
unsigned short flags;
readShorts(stream, &len, 1);
readShorts(stream, &flags, 1);
int count = (mCurrentstreamLen - 4 - 4) / 4;
if (len != count / 8)
{
len = len;
}
float time;
for (int i = 0; i < len; i += 1)
{
readFloats(stream, &time, 1);
TransformKeyFrame *kf = pTrack->createNodeKeyFrame(time);
Quaternion rot = Quaternion::IDENTITY;
if (flags & 1)
{
readObject(stream, rot);
}
kf->setRotation(rot);
Vector3 trans = Vector3::ZERO;
if (flags & 2)
{
readObject(stream, trans);
}
kf->setTranslate(trans);
}
}
else
{
readKeyFrame(stream, pTrack, pSkel);
}
if (!stream->eof())
{
// Get next stream
streamID = readChunk(stream);
}
}
if (!stream->eof())
{
// Backpedal back to start of this stream if we've found a non-keyframe
stream->skip(-STREAM_OVERHEAD_SIZE);
}
}
}
保存然后重新編譯Ogre就OK了,理論上就是可以加載其骨骼動(dòng)畫了。
另外,其骨骼文件名,模型文件名都是用的中文,而VS2005對(duì)中文路徑名的支持是有一個(gè)bug的,解決此問題參見下面這篇文章:
http://www.shnenglu.com/tx7do/archive/2008/12/09/68897.html
每次在telnet下退出珞珈山水,都會(huì)隨機(jī)出現(xiàn)一個(gè)離版畫面。
我最喜歡的是這首詩(shī)
就這樣走了嗎 親愛的 Felicia
你可知道 與你相遇在這十字路口 是我的最美回憶
我知道你會(huì)回來 在這熟悉路口 不要說是否曾經(jīng)相約 不去說諾言 我知道你的腳步 終會(huì)明白 這心的約定
讓我靜靜等你再次出現(xiàn)
|