コード例 #1
0
void SavORAS::resign(void)
{
    const u8 blockCount = 58;
    u8* tmp = new u8[*std::max_element(chklen, chklen + blockCount)];
    const u32 csoff = 0x75E1A;

    for (u8 i = 0; i < blockCount; i++)
    {
        std::copy(data + chkofs[i], data + chkofs[i] + chklen[i], tmp);
        *(u16*)(data + csoff + i*8) =  ccitt16(tmp, chklen[i]);
    }

    delete[] tmp;
}
コード例 #2
0
void SavBW::resign(void)
{
    const u8 blockCount = 70;
    u8* tmp = new u8[*std::max_element(lengths, lengths + blockCount)];
    u16 cs;

    for (u8 i = 0; i < blockCount; i++)
    {
        std::copy(data + blockOfs[i], data + blockOfs[i] + lengths[i], tmp);
        cs = ccitt16(tmp, lengths[i]);
        *(u16*)(data + chkMirror[i]) = cs;
        *(u16*)(data + chkofs[i]) = cs;
    }

    delete[] tmp;
}
コード例 #3
0
ファイル: sav.c プロジェクト: gnmmarechal/PCHex
s32 	rewriteSaveCHK(u8 *save, u8 game)
{
    u8 	blockCount = (game) ? 58 : 55;
    u32 	csoff = (game ? 0x7B21A : 0x6A81A) - 0x5400;
    u8 	*tmp = malloc(0x35000);
    u16 	cs;

    if (!tmp)
        return -1;
    for (int i = 0; i < blockCount; i++)
    {
        memcpy(tmp, save + getCHKOffset(game, 0, i), getCHKOffset(game, 1, i));
        cs = ccitt16(tmp, getCHKOffset(game, 1, i));
        memcpy(save + csoff + i * 8, &cs, 2);
    }
    free(tmp);
    return (0);
}