… | |
… | |
93 | mkdir "$Crossfire::VARDIR/pclient", 0777; |
93 | mkdir "$Crossfire::VARDIR/pclient", 0777; |
94 | |
94 | |
95 | our $DB_ENV = new BerkeleyDB::Env |
95 | our $DB_ENV = new BerkeleyDB::Env |
96 | -Home => "$Crossfire::VARDIR/pclient", |
96 | -Home => "$Crossfire::VARDIR/pclient", |
97 | -Cachesize => 1_000_000, |
97 | -Cachesize => 1_000_000, |
98 | -ErrFile => "/proc/self/fd/2", |
98 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
99 | -ErrPrefix => "DATABASE", |
99 | # -ErrPrefix => "DATABASE", |
100 | -Verbose => 1, |
100 | -Verbose => 1, |
101 | -Flags => DB_CREATE | DB_JOINENV | DB_RECOVER_FATAL | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
101 | -Flags => DB_CREATE | DB_RECOVER_FATAL | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
102 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
102 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
103 | |
103 | |
104 | sub db_table($) { |
104 | sub db_table($) { |
|
|
105 | my ($table) = @_; |
|
|
106 | |
|
|
107 | $table =~ s/([^a-zA-Z0-9_\-])/sprintf "=%x=", ord $1/ge; |
|
|
108 | |
105 | new CFClient::Database |
109 | new CFClient::Database |
106 | -Env => $DB_ENV, |
110 | -Env => $DB_ENV, |
|
|
111 | -Filename => $table, |
107 | -Filename => "database", |
112 | # -Filename => "database", |
108 | -Subname => $_[0], |
113 | # -Subname => $table, |
109 | -Flags => DB_CREATE | DB_UPGRADE, |
114 | -Flags => DB_CREATE | DB_UPGRADE, |
110 | or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"; |
115 | or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"; |
111 | } |
116 | } |
112 | |
117 | |
113 | package CFClient::Database; |
118 | package CFClient::Database; |
… | |
… | |
277 | $tw, $th, # need to pad texture first |
282 | $tw, $th, # need to pad texture first |
278 | 0, |
283 | 0, |
279 | $self->{format}, |
284 | $self->{format}, |
280 | $self->{type}, |
285 | $self->{type}, |
281 | $data; |
286 | $data; |
282 | glGetError and die; |
287 | if (my $error = glGetError) { |
|
|
288 | warn sprintf "texture upload error: %x %dx%d i=%x f=%x t=%x\n", |
|
|
289 | $error, $tw, $th, $self->{internalformat}, $self->{format}, $self->{type}; |
|
|
290 | } |
283 | } else { |
291 | } else { |
284 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
292 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
285 | $self->{internalformat}, |
293 | $self->{internalformat}, |
286 | 0, 0, |
294 | 0, 0, |
287 | $tw, $th, |
295 | $tw, $th, |