Ejemplo n.º 1
0
CSettingsSA::CSettingsSA ( void )
{
    m_pInterface = (CSettingsSAInterface *)CLASS_CMenuManager;
    m_pInterface->bFrameLimiter = false;
    m_bVolumetricShadowsEnabled = false;
    m_bVolumetricShadowsSuspended = false;
    SetAspectRatio ( ASPECT_RATIO_4_3 );
    HookInstall ( HOOKPOS_GetFxQuality, (DWORD)HOOK_GetFxQuality, 5 );
    HookInstall ( HOOKPOS_StoreShadowForVehicle, (DWORD)HOOK_StoreShadowForVehicle, 9 );
    m_iDesktopWidth = 0;
    m_iDesktopHeight = 0;
    MemPut < BYTE > ( 0x6FF420, 0xC3 );     // Truncate CalculateAspectRatio

    MemPut ( 0x732926, &ms_fVehicleLODDistance );
    MemPut ( 0x732940, &ms_fTrainPlaneLODDistance );

    // Set "radar map and radar" as default radar mode
    SetRadarMode ( RADAR_MODE_ALL );
}
Ejemplo n.º 2
0
t_Error MEM_Put(t_Handle h_Mem, void *p_Block)
{
    t_MemorySegment *p_Mem = (t_MemorySegment *)h_Mem;
    t_Error         rc;
    uint32_t        intFlags;

    ASSERT_COND(h_Mem);

    intFlags = XX_LockIntrSpinlock(p_Mem->h_Spinlock);
    /* check if blocks stack is full */
    if ((rc = MemPut(p_Mem, p_Block)) != E_OK)
    {
        XX_UnlockIntrSpinlock(p_Mem->h_Spinlock, intFlags);
        RETURN_ERROR(MAJOR, rc, NO_MSG);
    }

#ifdef DEBUG_MEM_LEAKS
    DebugMemPut(p_Mem, p_Block);
#endif /* DEBUG_MEM_LEAKS */
    XX_UnlockIntrSpinlock(p_Mem->h_Spinlock, intFlags);

    return E_OK;
}
Ejemplo n.º 3
0
static bool __qifainit(QIFA_SYS *qifasys, TCHAR *path) {
    static wchar __qifaname[20000];
    static QIFA __QiFa_Reg[160];
    for (int i = 0; i < lenthof(__QiFa_Reg); i++) {
        __QiFa_Reg[i].flag = 0;
    }
    MEM_ERR mem_err;
    if (!(qifasys->flag & 0x01)) {
        MemCreate(&qifamem, "qifa mem pool", __QiFa_Reg,
                  lenthof(__QiFa_Reg), sizeof(QIFA), &mem_err);
        ASSERT(mem_err == MEM_ERR_NONE);
        qifasys->flag |= 0x01;
    } else {
        for (int i = 0; i < lenthof(qifasys->QiFa_Reg); i++) {
            if (qifasys->QiFa_Reg[i] != NULL) {
                uint32 iboard = qifasys->QiFa_Reg[i]->board_id;
                uint32 iqf = qifasys->QiFa_Reg[i]->xuhao;
                qifasys->QiFa_Reg_Table[iboard][iqf] = NULL;
                memset(qifasys->QiFa_Reg[i], 0, sizeof(QIFA));
                MemPut(&qifamem, qifasys->QiFa_Reg[i], &mem_err);
                ASSERT(mem_err == MEM_ERR_NONE);
                qifasys->QiFa_Reg[i] = NULL;
            }
        }
    }

    FIL file;
    uint32 rb;
    //int nameoffset;
    MD5_CTX md5;
    MACHI_CFG_FILE_HEAD *filehead;
    QIFA_INFO *info;
    QF_PACKED *qifapack;
    unsigned char *p, *data = NULL;
    unsigned char md5hash[16];
    if (f_open(&file, path, FA_READ) != FR_OK) {
        return false;
    }
    unsigned int filesize = f_size(&file);
    data = (unsigned char *)malloc(filesize);
    if (data == NULL) {
        goto ERROR;
    }
    if (f_read(&file, data, filesize, &rb) != FR_OK || rb != filesize) {
        goto ERROR;
    }
    filehead = (MACHI_CFG_FILE_HEAD *)data;
    if (strcmp(filehead->cfghead, "swjcfg") != 0) goto ERROR;

    MD5Init(&md5);
    MD5Update(&md5, data + 24, filesize - 24);
    MD5Final(&md5, md5hash);
    if (memcmp(&md5hash, filehead->md5, 16) != 0) goto ERROR;

    p = data + filehead->sec[0].offset;

    info = (QIFA_INFO *)p;
    if (sizeof *qifapack != info->sizeofQifa) {
        goto ERROR;
    }
    qifasys->numofboard = info->numofQfBoard;
    qifasys->numperboard = info->numperQfBoard;
    qifasys->numofqifa = info->numofQifa;
    ASSERT(qifasys->numofboard <= lenthof(qifasys->QiFa_Reg_Table));
    ASSERT(qifasys->numperboard <= lenthof(qifasys->QiFa_Reg_Table[0]));

    p += info->qifanameOffset;
    memcpy(__qifaname, p, info->qifanamesize);
    p = data + filehead->sec[0].offset + info->qifaOffset;

    for (int i = 0; i < qifasys->numofqifa; i++) {
        qifapack = (QF_PACKED *)p;
        p += sizeof(QF_PACKED);
        if (qifapack->flag != QIFA_FLAG_EN && qifapack->flag != QIFA_FLAG_DIS) {
            goto ERROR;
        }
        if (qifapack->flag == QIFA_FLAG_DIS) {
            continue;
        }
        QIFA *qifa = MemGet(&qifamem, &mem_err);
        ASSERT(mem_err == MEM_ERR_NONE);
        uint16 qfid = qifapack->qfId;
        qifa->board_id = qifapack->board_id;
        qifa->xuhao = qifapack->xuhao;
        qifa->nc_no = qifapack->default_nc_no;
        qifa->default_nc_no = qifapack->default_nc_no;
        qifa->nc_no_changeable = qifapack->nc_no_changeable;
        qifa->nc_no_display = qifapack->nc_no_dis;
        qifa->cam_en = qifapack->iscam;
        qifa->flag = QIFA_FLAG;
        qifa->qfid = qfid;
        for (int j = 0; j < 13; j++) {
            if (qifapack->qifa_name_offset[j] != -1UL) {
                qifa->name[j] = &__qifaname[qifapack->qifa_name_offset[j] / 2];
            } else {
                qifa->name[j] = &__qifaname[qifapack->qifa_name_offset[0] / 2];
            }
        }
        char nicknamebuf[100];
        wtrToStr(nicknamebuf, qifa->name[0]);
        strtok(nicknamebuf, "[");
        char *p = strtok(nicknamebuf, "]");
        strcpy(qifa->nickname, p + 1);
        qifasys->QiFa_Reg[qfid] = qifa;
    }
    f_close(&file);
    if (data != NULL) {
        free(data);
    }
    return true;
    ERROR:
    f_close(&file);
    if (data != NULL) {
        free(data);
    }
    return false;
}