CPP RELEASE [HOW TO] "Optimize" m0d_sa Route save option.

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
We all know, well atleast some that the commit('ers?) left us some vehicle recording code but didn't enabled it right?

If you re-enable it, it works nice but if you want to save routes it takes ages to save yeye you remeber right?

So, heres a quick solution to that.

The Reason why it's saving soo slowly it that s0beit is using SQLite for saving don't understand me wrong, it is not bad in no way slow but on in the following function rec_sqlite_writeTable the table gets filled with all positions, speed vecs, turn vecs.

These are huuuuge amount of data since it saves like 10 times every sec (didn't measured).
But whats the problem then?
well, sqlite syncs and re-saves the table on EVERY new query that costs time as hdd's are not super fast even ssd's will take long since it does re-indexing.

The solution for this is: Disable that behaviour!
Now how? what todo?

I'll do it easy in the function rec_sqlite_writeTable you'll find a comment and i mean this one:
Code:
// add our data into the new table
You see under this comment it loops trough the data and saves it, now we just need to tell sqlite before that we don't want the described behaviour that's easy some c+p for you guys:
add under the given comment following:
Code:
sqlite3_exec( rec_db, "PRAGMA synchronous = OFF", NULL, NULL, &errmsgs);
sqlite3_exec( rec_db, "BEGIN TRANSACTI0N", NULL, NULL, &errmsgs );

so now, sqlite knows to NOT do what we wanted for it todo, but you'll see if you only have this the data will actually NEVER save and it'll stuck in a loop so why?
Well we tell sqlite that a TRANSACTION (BEGIN TRANSACTION) is incoming, but we never tell sqlite when it finished so after the for loop add following:
Code:
sqlite3_exec( rec_db, "END TRANSACTI0N", NULL, NULL, &errmsgs );
Now sqlite is happy and it knows when to save the data properly.

Problem solved, route saving is now fast enough to suit your LS - SF - LV Trips.

I (atleast) hope you've tried to understand it abit and not even try to only C+P (you'll see why P:)
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
We should consider looking for a method to activate the car driver system that is used by gta_sa PEDS :not_bad:
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
T3K link said:
We should consider looking for a method to activate the car driver system that is used by gta_sa PEDS :not_bad:
That would lead in crappy driving skills, and a fear inside of every lamp or post.
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
0x688 link said:
That would lead in crappy driving skills, and a fear inside of every lamp or post.
gtfo, y u hatin nob  :yesyes:, just bcuz CJ didnt follow the train dosnt mean all gta's driving skill sux  :yesyes:
u hurt my feels
 
Top