enhance something
This commit is contained in:
parent
af516ff3bf
commit
820e87f2bc
|
@ -58,7 +58,7 @@ void database::open(const char* file) {
|
||||||
NULL, NULL, &errmsg);
|
NULL, NULL, &errmsg);
|
||||||
if (result != SQLITE_OK) goto fail;
|
if (result != SQLITE_OK) goto fail;
|
||||||
result = sqlite3_exec(db,
|
result = sqlite3_exec(db,
|
||||||
"CREATE TABLE behavior('thisobj' INTEGER, 'name' TEXT, 'type' INTEGER, 'proto_name' TEXT, 'proto_guid' TEXT, 'flags' INTEGER, 'priority' INTEGER, 'version' INTEGER, 'parent' INTEGER);",
|
"CREATE TABLE behavior('thisobj' INTEGER, 'name' TEXT, 'type' INTEGER, 'proto_name' TEXT, 'proto_guid' TEXT, 'flags' INTEGER, 'priority' INTEGER, 'version' INTEGER, 'pin_count' TEXT, 'parent' INTEGER);",
|
||||||
NULL, NULL, &errmsg);
|
NULL, NULL, &errmsg);
|
||||||
if (result != SQLITE_OK) goto fail;
|
if (result != SQLITE_OK) goto fail;
|
||||||
result = sqlite3_exec(db,
|
result = sqlite3_exec(db,
|
||||||
|
@ -133,7 +133,7 @@ void database::close() {
|
||||||
void database::write_CKBehavior(dbCKBehavior* data) {
|
void database::write_CKBehavior(dbCKBehavior* data) {
|
||||||
if (db == NULL) return;
|
if (db == NULL) return;
|
||||||
|
|
||||||
sprintf(commandStr, "INSERT INTO behavior VALUES (%d, '%s', %d, '%s', '%d, %d', %d, %d, %d, %d);",
|
sprintf(commandStr, "INSERT INTO behavior VALUES (%d, '%s', %d, '%s', '%d, %d', %d, %d, %d, '%s', %d);",
|
||||||
data->thisobj,
|
data->thisobj,
|
||||||
data->name,
|
data->name,
|
||||||
data->type,
|
data->type,
|
||||||
|
@ -143,6 +143,7 @@ void database::write_CKBehavior(dbCKBehavior* data) {
|
||||||
data->flags,
|
data->flags,
|
||||||
data->priority,
|
data->priority,
|
||||||
data->version,
|
data->version,
|
||||||
|
data->pin_count,
|
||||||
data->parent);
|
data->parent);
|
||||||
|
|
||||||
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg);
|
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg);
|
||||||
|
|
|
@ -17,6 +17,8 @@ typedef struct dbCKBehavior {
|
||||||
CK_BEHAVIOR_FLAGS flags;
|
CK_BEHAVIOR_FLAGS flags;
|
||||||
int priority;
|
int priority;
|
||||||
CKDWORD version;
|
CKDWORD version;
|
||||||
|
//pTarget, pIn, pOut, bIn, bOut
|
||||||
|
char pin_count[128];
|
||||||
EXPAND_CK_ID parent;
|
EXPAND_CK_ID parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,12 @@ void IterateBehavior(CKBehavior* bhv, database* db, dbDataStructHelper* helper,
|
||||||
helper->_dbCKBehavior->priority = bhv->GetPriority();
|
helper->_dbCKBehavior->priority = bhv->GetPriority();
|
||||||
helper->_dbCKBehavior->version = bhv->GetVersion();
|
helper->_dbCKBehavior->version = bhv->GetVersion();
|
||||||
helper->_dbCKBehavior->parent = parents;
|
helper->_dbCKBehavior->parent = parents;
|
||||||
|
sprintf(helper->_dbCKBehavior->pin_count, "%d, %d, %d, %d, %d",
|
||||||
|
(bhv->IsUsingTarget() ? 1 : 0),
|
||||||
|
bhv->GetInputParameterCount(),
|
||||||
|
bhv->GetOutputParameterCount(),
|
||||||
|
bhv->GetInputCount(),
|
||||||
|
bhv->GetOutputCount());
|
||||||
db->write_CKBehavior(helper->_dbCKBehavior);
|
db->write_CKBehavior(helper->_dbCKBehavior);
|
||||||
|
|
||||||
//write target
|
//write target
|
||||||
|
@ -222,7 +228,7 @@ void IterateBehavior(CKBehavior* bhv, database* db, dbDataStructHelper* helper,
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratepLocalData(CKParameterLocal* p, database* db, dbDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void IteratepLocalData(CKParameterLocal* p, database* db, dbDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
CKGUID t = p->GetGUID();
|
CKGUID t = p->GetGUID();
|
||||||
BOOL unknowType = FALSE;
|
BOOL unknowType = FALSE;
|
||||||
|
|
||||||
if (t.d1 & t.d2) unknowType = TRUE;
|
if (t.d1 & t.d2) unknowType = TRUE;
|
||||||
|
@ -324,20 +330,51 @@ void IteratepLocalData(CKParameterLocal* p, database* db, dbDataStructHelper* he
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (t == CKPGUID_STRING) {
|
||||||
|
char* cptr = (char*)p->GetReadDataPtr(false);
|
||||||
|
int cc = p->GetDataSize();
|
||||||
|
for (int i = 0; i < cc; i++)
|
||||||
|
helper->_db_pLocalData->data[i] = cptr[i];
|
||||||
|
helper->_db_pLocalData->data[cc] = '\0';
|
||||||
|
strcpy(helper->_db_pLocalData->field, "str");
|
||||||
|
helper->_db_pLocalData->belong_to = p->GetID();
|
||||||
|
db->write_pLocalData(helper->_db_pLocalData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unknowType = TRUE;
|
unknowType = TRUE;
|
||||||
//if it gets here, we have no idea what it really is. so simply dump it.
|
//if it gets here, we have no idea what it really is. so simply dump it.
|
||||||
//buffer-like
|
//buffer-like
|
||||||
if (unknowType || t == CKPGUID_VOIDBUF || t == CKPGUID_STRING || t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS) {
|
if (unknowType || t == CKPGUID_VOIDBUF || t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS) {
|
||||||
char* cptr = (char*)p->GetReadDataPtr(false);
|
//dump data
|
||||||
int cc = p->GetDataSize();
|
unsigned char* cptr = (unsigned char*)p->GetReadDataPtr(false);
|
||||||
for (int i = 0; i < cc; i++)
|
char temp[4];
|
||||||
helper->_db_pLocalData->data[i] = cptr[i];
|
int cc = 0, rcc = 0, pos = 0;
|
||||||
helper->_db_pLocalData->data[cc] = '\0';
|
rcc = cc = p->GetDataSize();
|
||||||
strcpy(helper->_db_pLocalData->field, "dump-data");
|
if (rcc > 200) rcc = 200;
|
||||||
|
|
||||||
|
for (int i = 0; i < rcc; i++) {
|
||||||
|
sprintf(temp, "%02X", cptr[i]);
|
||||||
|
helper->_db_pLocalData->data[pos++] = '0';
|
||||||
|
helper->_db_pLocalData->data[pos++] = 'x';
|
||||||
|
helper->_db_pLocalData->data[pos++] = temp[0];
|
||||||
|
helper->_db_pLocalData->data[pos++] = temp[1];
|
||||||
|
helper->_db_pLocalData->data[pos++] = ',';
|
||||||
|
}
|
||||||
|
if (pos)
|
||||||
|
helper->_db_pLocalData->data[--pos] = '\0';
|
||||||
|
else
|
||||||
|
helper->_db_pLocalData->data[0] = '\0';
|
||||||
|
|
||||||
|
if (rcc == cc)
|
||||||
|
strcpy(helper->_db_pLocalData->field, "dump.data");
|
||||||
|
else
|
||||||
|
strcpy(helper->_db_pLocalData->field, "dump.partial_data");
|
||||||
helper->_db_pLocalData->belong_to = p->GetID();
|
helper->_db_pLocalData->belong_to = p->GetID();
|
||||||
db->write_pLocalData(helper->_db_pLocalData);
|
db->write_pLocalData(helper->_db_pLocalData);
|
||||||
|
|
||||||
|
//dump data length
|
||||||
|
helper_pLocalDataExport("dump.length", (long)cc, db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user