diff options
author | Svxy <aidan61605@gmail.com> | 2023-05-31 23:31:32 +0200 |
---|---|---|
committer | Svxy <aidan61605@gmail.com> | 2023-05-31 23:31:32 +0200 |
commit | eb4b3404aa00220d659e532151dab13d642c17a3 (patch) | |
tree | 7e1107c4995489a26c4007e41b53ea8d00ab2134 /tools/ArtChecker | |
download | The-Simpsons-Hit-and-Run-TSH&R-PC.tar The-Simpsons-Hit-and-Run-TSH&R-PC.tar.gz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.bz2 The-Simpsons-Hit-and-Run-TSH&R-PC.tar.lz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.xz The-Simpsons-Hit-and-Run-TSH&R-PC.tar.zst The-Simpsons-Hit-and-Run-TSH&R-PC.zip |
Diffstat (limited to 'tools/ArtChecker')
-rw-r--r-- | tools/ArtChecker/DSGmaker.exe | bin | 0 -> 1310720 bytes | |||
-rw-r--r-- | tools/ArtChecker/artchecker.cpp | 1349 | ||||
-rw-r--r-- | tools/ArtChecker/artchecker.dsp | 128 | ||||
-rw-r--r-- | tools/ArtChecker/artchecker.exe | bin | 0 -> 1445888 bytes | |||
-rw-r--r-- | tools/ArtChecker/artlimits.h | 3 | ||||
-rw-r--r-- | tools/ArtChecker/artlimits.hpp | 2 | ||||
-rw-r--r-- | tools/ArtChecker/artobject.cpp | 46 | ||||
-rw-r--r-- | tools/ArtChecker/artobject.h | 59 | ||||
-rw-r--r-- | tools/ArtChecker/atcmaker.exe | bin | 0 -> 278528 bytes | |||
-rw-r--r-- | tools/ArtChecker/badlist.cpp | 90 | ||||
-rw-r--r-- | tools/ArtChecker/badlist.hpp | 33 | ||||
-rw-r--r-- | tools/ArtChecker/check.bat | 2 | ||||
-rw-r--r-- | tools/ArtChecker/libmySQL.dll | bin | 0 -> 217088 bytes | |||
-rw-r--r-- | tools/ArtChecker/summary.bat | 13 | ||||
-rw-r--r-- | tools/ArtChecker/summary.pl | 23 | ||||
-rw-r--r-- | tools/ArtChecker/summaryall.bat | 13 | ||||
-rw-r--r-- | tools/ArtChecker/summaryall.pl | 23 |
17 files changed, 1784 insertions, 0 deletions
diff --git a/tools/ArtChecker/DSGmaker.exe b/tools/ArtChecker/DSGmaker.exe Binary files differnew file mode 100644 index 0000000..7ae21c3 --- /dev/null +++ b/tools/ArtChecker/DSGmaker.exe diff --git a/tools/ArtChecker/artchecker.cpp b/tools/ArtChecker/artchecker.cpp new file mode 100644 index 0000000..e2a9f1c --- /dev/null +++ b/tools/ArtChecker/artchecker.cpp @@ -0,0 +1,1349 @@ +// artchecker.cpp : Defines the entry point for the console application. +// options -strict -add -all +#pragma warning(disable:4786) + + +#include <iostream> +#include <cstring> +#include <iomanip> +//#include <mysql++> +#include "artobject.h" +#include "artlimits.h" +#include "badlist.hpp" +#include "outputbuffer.hpp" +#include <toollib.hpp> +#include <tlCollisionObjectChunk.hpp> +#include <tlMeshChunk.hpp> +#include <tlImageChunk.hpp> +#include <tlAnimationChunk.hpp> +#include <tlStatepropChunk.hpp> +#include "..\..\..\..\game\code\constants\srrchunks.h" + +using namespace std; + +void debugstring(char * message); + +int texturelookup(const texture_data& texturedata, bool add, bool strict,bool showall,badlist& p_badtextures ,bool suppress); +int shaderlookup(shader_data* lp_shaderdata, bool add, bool strict,bool showall,badlist& badshaders,bool suppress); +//int artobjectlookup(art_object* lp_artobject, Query& query,bool add, bool strict,bool showall,bool suppress); +//int bvobjectlookup(bv_data* lp_bvobject,Query& query,bool add,bool strict,bool showall,bool suppress); + +int main(int argc, char* argv[]) +{ + + char* arguements [4]; + char* filename; + bool strict =false; + bool add =false; + bool badart=false; + bool showall =false; + bool suppress =false; + bool shin=false; + char screenoutput [1000]; + int i; + + //lists to track bad textures and shaders. + badlist bad_textures; + badlist bad_shaders; + + //list to track meshes using bad shaders and meshes over 500 polys + outputbuffer* p_mesh_ref=new outputbuffer; + outputbuffer* p_polycount=new outputbuffer; + + + tlDataChunk::RegisterDefaultChunks(); + + //processes arguements + + //no options + if (argc ==1) + { + printf("usage:artchecker filename <strict> \n"); + exit (1); + } + + + filename= argv[1]; + debugstring(filename); + + + for (i=2;i<argc;i++) + { + arguements[i]=argv[i]; + + // user set strict + if (strcmp(arguements[i],"strict")== 0) + { + strict =true; + debugstring("strict option set"); + break; + } + + //user set add + + else if (strcmp (arguements[i],"add")==0) + { + add=true; + debugstring("add option set"); + break; + } + + else if (strcmp (arguements[i],"sum")==0) + { + suppress =true; + break; + } + + else if (strcmp (arguements[i],"all")==0) + { + showall =true; + break; + } + + else if (strcmp (arguements[i],"shin")==0) + { + shin =true; + break; + } + //illegal option + else + { + printf("%s is an illegal option \n",arguements[i]); + exit (1); + } + + + } //end for + + //have the pure3d file name + + tlFile input(new tlFileByteStream(filename,omREAD), tlFile::FROMFILE); + if(!input.IsOpen()) + { + printf("Could not open %s\n", filename); + exit(-6); + } + + printf("Processing Filename: %s\n",filename); + + //desend into the file and look at each object until no more objects left + + // make a tlDataChunk from the file + // this is the wrapper chunk for the input + tlDataChunk* inchunk = new tlDataChunk(&input); + // we don't need the tlFile anymore + // this cleans up the tlFile object including the + // tlFileByteStream + //printf("Fucking CLose! \n"); + input.Close(); + + //printf("Closing File proceeding.\n"); + + //lists to track memory stats for various components. + badlist texturestats(inchunk->SubChunkCount()); + badlist animationstats(inchunk->SubChunkCount()); + badlist meshstats(inchunk->SubChunkCount()); + + // build an output chunk + tlDataChunk* outchunk = new tlDataChunk; + int ch; + + static int counter =0; + + //connect to the DB + + + //setup artrb variables + bool dbconnect=false; +// char querybuffer [1000]; +// Row row; + + + + + //creat connection and query + //Connection con (use_exceptions); + //Query query=con.query( ); + //dbconnect=con.connect ("srr2test","radit","root","custom47"); +/* + if (dbconnect == true) + { + printf("Connection to Artdb established proceeding.\n"); + } + else + { + printf("Cant connection to art db \n"); + exit (1); + } +*/ + //printf("Counting chunks !\n"); + + // go through all the sub-chunks of the input and + // process the ones you care about + for(ch=0; ch < inchunk->SubChunkCount(); ch++) + { + //printf("Processing Chunks, #%d \n",ch); + // create the next sub-chunk + tlDataChunk* sub = inchunk->GetSubChunk(ch); + + // look at the id of the subchunk to decide if we + // want to do something with it or not + switch(sub->ID()) + { + + + case Pure3D::Texture::TEXTURE: + { + //temp variables + tlTexture* p_texture = new tlTexture (); + tlImage* p_image2d ; + texture_data mytexture; + unsigned int texturememsize =0; + + //printf("texuture name: %s \n",p_texture->GetName()); + + int chunkcount1,chunkcount2; + + for (chunkcount1 =0;chunkcount1<sub->SubChunkCount();chunkcount1++) + { + tlDataChunk* sub1=sub->GetSubChunk(chunkcount1); + + switch(sub1->ID()) + { + case Pure3D::Texture::IMAGE: + { + for (chunkcount2=0;chunkcount2<sub1->SubChunkCount();chunkcount2++) + { + tlDataChunk* sub2=sub1->GetSubChunk(chunkcount2); + switch (sub2->ID()) + { + case Pure3D::Texture::IMAGE_DATA: + { + tlImageDataChunk* p_imagedatachunk = (tlImageDataChunk*) sub2; + texturememsize += p_imagedatachunk->GetImageDataSize(); + //printf("%u bytes \n", p_imagedatachunk->GetImageDataSize()); + } + } + }//end for + + }//end case + }//end switch + + }//end outer for loop. + + + + + p_texture->LoadFromChunk(sub); + + //cout<<"Checking for "<<p_texture->GetName()<<" Texture "; + p_image2d = p_texture->GetImage(0); + + //fill in texture struct. + strcpy(mytexture.name,p_texture->GetName()); + mytexture.height=p_texture->GetHeight(); + mytexture.width=p_texture->GetWidth(); + mytexture.bpp=p_image2d->GetBpp(); + mytexture.alpha=p_texture->GetAlphaDepth(); + + texturestats.add(p_texture->GetName(),1,texturememsize); + + //texture check + if (texturelookup (mytexture,add,strict,showall,bad_textures,suppress) ) // + { + badart= true; + } + + /* + cout<<"Height: "<<p_image2d->GetHeight(); + cout<<"Width: "<<p_image2d->GetWidth(); + cout<<"Bpp: "<<mytexture.bpp; + cout<<"Alpha: "<<mytexture.alpha; + cout<<endl; + */ + + delete p_texture; + outchunk->AppendSubChunk(sub,FALSE); + break; + } + + case Pure3D::Shader::SHADER: + { + + shader_data myshader; + tlShader* p_shader =new tlShader (); + p_shader->LoadFromChunk(sub); + + //get data for myshader + + strcpy(myshader.name,p_shader->GetName()); + myshader.lit=p_shader->GetIntParam("LIT"); + myshader.twosid=p_shader->GetIntParam("2SID"); + + //cout<<"Checking for "<<myshader.name<<" Shader "; + + + if (p_shader->GetFloatParam("SHIN") > 0.0 ) + { + if (shin) + { + printf("Shader: %s has shinyness %f greater than 0.0!!!\n",p_shader->GetName(),p_shader->GetFloatParam("SHIN")); + //printf("Shader: %s has shinyness %f greater than 0.0!!!, Setting it to 0.0\n",p_shader->GetName(),p_shader->GetFloatParam("SHIN")); + //p_shader->SetFloatParam("SHIN",0.0); + } + } + + + if( strcmp ("lambert",p_shader->GetShaderType() )==0) + { + printf(" =====> ERROR: %s is of type Lambert, SOMEONE is GETTING the BEATS ! \n",myshader.name); + badart=true; + } + + if (p_shader->GetIntParam("2SID") == 0) + { + //printf("%-30s Shader: =====>Warning : Double Sided FLAG is 0!\n",p_shader->GetName()); + //p_shader->SetIntParam("2SID",1); + //error=true; + } + + if(shaderlookup(&myshader,add,strict,showall,bad_shaders,suppress)) + { + badart=true; + } + + tlDataChunk* p_chunk=p_shader->Chunk(); + delete p_shader; + outchunk->AppendSubChunk(p_chunk); + break; + } + case SRR2::ChunkID::ENTITY_DSG: + { + tlDataChunk* p_temp = sub->GetSubChunk(0); + + + tlMeshChunk* p_mesh = (tlMeshChunk* ) p_temp; + tlPrimGroup* p_primgroup = new tlPrimGroup (); + unsigned int vertexmemsize =0; + p_primgroup->LoadFromChunk(p_mesh->GetSubChunk(0)); + + if( p_primgroup->GetTriangleCount() >MAX_POLYCOUNT) + { + if(p_primgroup->GetType() == PDDI_PRIM_TRIANGLES) + { + sprintf(screenoutput,"%-30s mesh => Polycount : %6d \n",p_mesh->GetName(),p_primgroup->GetTriangleCount()); + } + + if(p_primgroup->GetType() == PDDI_PRIM_TRISTRIP) + { + sprintf(screenoutput,"%-30s mesh => Polycount Tristriped: %6d \n",p_mesh->GetName(),p_primgroup->GetTriangleCount()); + } + + //cout<< p_primgroup->GetTriangleCount()<<endl; + //printf("%-30s mesh => Polycount: %6d \n",p_mesh->GetName(),p_primgroup->GetTriangleCount()); + p_polycount->add(screenoutput); + } + + if(p_primgroup->GetVertexType()==8209) + { + //printf("ERROR: %s mesh HAS NO CVB lighting INFO!\n",p_mesh->GetName()); + sprintf(screenoutput,"%-30s =====>ERROR: Mesh has No CBV (Color by Vertex) Lighting INFO! ", p_mesh->GetName()); + p_mesh_ref->add(screenoutput); + badart=true; + } + + if (bad_shaders.inlist(p_primgroup->GetShader( ) )) + { + sprintf(screenoutput,"%-30s =====>ERROR: Referencing bad shader : %-30s", p_mesh->GetName(), p_primgroup->GetShader()); + p_mesh_ref->add(screenoutput); + badart =true; + } + + delete p_primgroup; + + + + // memory checkfunctionality + int chunkcount1,chunkcount2; + + for (chunkcount1 =0;chunkcount1<p_temp->SubChunkCount();chunkcount1++) + { + tlDataChunk* sub1=p_temp->GetSubChunk(chunkcount1); + + switch(sub1->ID()) + { + case Pure3D::Mesh::PRIMGROUP: + { + for (chunkcount2=0;chunkcount2<sub1->SubChunkCount();chunkcount2++) + { + tlDataChunk* sub2=sub1->GetSubChunk(chunkcount2); + switch (sub2->ID()) + { + case Pure3D::Mesh::MEMORYIMAGEVERTEXLIST: + { + tlPrimGroupMemoryImageVertexChunk* p_vertexmemorychunk = (tlPrimGroupMemoryImageVertexChunk*) sub2; + vertexmemsize = p_vertexmemorychunk->GetMemoryImageVertexSize(); + //printf("%u bytes \n", p_vertexmemorychunk->GetMemoryImageVertexSize()); + } + } + }//end for + + }//end case + }//end switch + + }//end outer for loop. + + + meshstats.add(p_mesh->GetName(),1,vertexmemsize); + outchunk->AppendSubChunk(sub,FALSE); + break; + + } + + + + case Pure3D::Mesh::MESH: + { + counter++; + + tlDataChunk* p_sub =NULL; + + unsigned int i = 0; + p_sub = sub->GetSubChunk(i); + + while (p_sub ->ID( ) == Pure3D::Mesh::PRIMGROUP ) + { + tlMeshChunk* p_mesh = (tlMeshChunk* ) sub; + tlPrimGroup* p_primgroup = new tlPrimGroup (); + unsigned int vertexmemsize =0; + p_primgroup->LoadFromChunk(p_mesh->GetSubChunk(i)); + + if( p_primgroup->GetTriangleCount() >MAX_POLYCOUNT) + { + + if(p_primgroup->GetType() == PDDI_PRIM_TRIANGLES) + { + sprintf(screenoutput,"%-30s mesh => Polycount : %6d \n",p_mesh->GetName(),p_primgroup->GetTriangleCount()); + p_polycount->add(screenoutput); + } + + if(p_primgroup->GetType() == PDDI_PRIM_TRISTRIP) + { + sprintf(screenoutput,"%-30s mesh => Polycount Tristriped: %6d \n",p_mesh->GetName(),p_primgroup->GetTriangleCount()); + p_polycount->add(screenoutput); + } + } + + if(p_primgroup->GetVertexType()==8209) + { + sprintf(screenoutput,"%-30s =====>ERROR: Mesh has No CBV (Color by Vertex) Lighting INFO! ", p_mesh->GetName()); + p_mesh_ref->add(screenoutput); + badart=true; + } + + //hack to make every 3rd shader be char swatch. + if (counter == 3) + { + counter =0; + p_primgroup->SetShader("char_swatch_m"); + } + + if (bad_shaders.inlist(p_primgroup->GetShader( ) )) + { + sprintf(screenoutput,"%-30s =====>ERROR: Referencing bad shader : %-30s", p_mesh->GetName(), p_primgroup->GetShader()); + p_mesh_ref->add(screenoutput); + badart=true; + } + + delete p_primgroup; + i++; + + + + // memory checkfunctionality + int chunkcount1,chunkcount2; + + for (chunkcount1 =0;chunkcount1<sub->SubChunkCount();chunkcount1++) + { + tlDataChunk* sub1=sub->GetSubChunk(chunkcount1); + + switch(sub1->ID()) + { + case Pure3D::Mesh::PRIMGROUP: + { + for (chunkcount2=0;chunkcount2<sub1->SubChunkCount();chunkcount2++) + { + tlDataChunk* sub2=sub1->GetSubChunk(chunkcount2); + switch (sub2->ID()) + { + case Pure3D::Mesh::MEMORYIMAGEVERTEXLIST: + { + tlPrimGroupMemoryImageVertexChunk* p_vertexmemorychunk = (tlPrimGroupMemoryImageVertexChunk*) sub2; + vertexmemsize = p_vertexmemorychunk->GetMemoryImageVertexSize(); + //printf("%u bytes \n", p_vertexmemorychunk->GetMemoryImageVertexSize()); + } + } + }//end for + + }//end case + }//end switch + + }//end outer for loop. + + + meshstats.add(p_mesh->GetName(),1,vertexmemsize); + outchunk->AppendSubChunk(sub,FALSE); + p_sub = sub->GetSubChunk(i); + }//end while loop + break; + } + case Pure3D::Animation::AnimationData::ANIMATION: + { + + unsigned int animationmemsize =0; + int chunkcount1; + + for (chunkcount1 =0;chunkcount1<sub->SubChunkCount();chunkcount1++) + { + tlDataChunk* sub1=sub->GetSubChunk(chunkcount1); + + switch(sub1->ID()) + { + case Pure3D::Animation::AnimationData::SIZE: + { + + tlAnimationSizeChunk* p_animationsizechunk = (tlAnimationSizeChunk*) sub1; + animationmemsize = p_animationsizechunk->GetPS2(); + //printf("%u bytes \n", p_animationsizechunk->GetPS2()); + + }//end case + }//end switch + }//end outer for loop. + + //printf("name: %s , %u bytes \n",sub->GetName(),animationmemsize); + animationstats.add(sub->GetName(),1,animationmemsize); + outchunk->AppendSubChunk(sub,FALSE); + break; + + } + + /* + case Simulation::Collision::OBJECT: + { + //temp local variables + + tlCollisionObjectChunk* p_collisionobject= (tlCollisionObjectChunk*)sub; + bv_data bv_object; + char source_name[max_length]; + char object_name1[max_length]; + char object_name2[max_length]; + + + //cout<<"Checking "<<p_collisionobject->GetName()<<" Collision Object "<< endl; + + //get the name of collision object + strcpy(source_name,p_collisionobject->GetName()); + //cout<<"Source name: "<<source_name<<endl; + + //smash up string to remove the number appended by Maya + strcpy(object_name1,strtok(source_name,"_")); + strcpy(object_name2,strtok(NULL,"_")); + + //reform string + strcat(object_name1,"_"); + strcat(object_name1,object_name2); + + + //set default vaules + strcpy(bv_object.name,object_name1); + bv_object.classtype=0; + bv_object.physpropid=0; + + //cout<<"New concated string: " <<object_name1<<endl; + + + if(bvobjectlookup(&bv_object,query,add,strict,showall)) + { + badart=true; + } + + //creating object attribute chunk + + tlObjectAttributeChunk* p_otc =new tlObjectAttributeChunk (); + p_otc->SetClassType(bv_object.classtype); + p_otc->SetPhyPropID(bv_object.physpropid); + + tlPhysWrapperChunk* p_physwrapper = new tlPhysWrapperChunk (); + p_physwrapper->SetName(p_collisionobject->GetName()); + + //append the chunks + //p_physwrapper->AppendSubChunk(p_otc); + //p_physwrapper->AppendSubChunk(sub, FALSE); + outchunk->AppendSubChunk(sub,FALSE); + break; + } + + + */ + case StateProp::STATEPROP: + { + printf("This File:%s contains a stateprop \n",filename); + break; + } + default: + { + // this is not a chunk that we care about + // so simply copy it to the output wrapper chunk + // the optional parameter to AppendSubChunk + // indicates that we have merely copied a pointer + // so the destructor of outchunk should not + // destroy this sub-chunk as that duty will be + // taken care of by the destructor of inchunk + outchunk->AppendSubChunk(sub,FALSE); + break; + + } + }//end switch + }//end for + + //record objects stats faking art object + art_object target_object; + strcpy(target_object.name,"devil car"); + + target_object.art_properties.vertex_count= 453; + target_object.art_properties.poly_count=2345; + target_object.art_properties.animation_frames=25; + target_object.art_properties.bone_count=35; + target_object.art_properties.shader_count=14; + +/* + if( artobjectlookup(&target_object,query,add,strict) ) + { + cout<<"Art object:" <<target_object.name<< " has failed art check\n "; + //exit (1); + } + +*/ + //check for shaders and textures are + + + //all is good add physic proporties + + shader_data hmm; + + strcpy(hmm.name,"trunk"); + hmm.lit=false; +/* + if (shaderlookup(&hmm,query,add,strict)) + { + cout<<hmm.name<<"not in art db \n"; + //exit (1); + } +*/ + + +//} + //end of try + +// catch (BadQuery er) + { + // cout<<"Error: " <<er.error<< endl; + // return 1; + } + + if (badart) + { + printf("\n"); + printf("\n"); + + printf("***** SUMMARY ******* \n"); + fprintf(stdout,"ERROR: %-15s contains BAD ART and has FAILED Artchecker! \n",filename); + + // cleanup the no-longer-needed wrapper chunks + + printf("Total Memory size of Textures: %20u bytes in %9u textures \n",texturestats.getsize(),texturestats.getindexcount()); + printf("Total Memory size of Animations: %20u bytes in %9u animations \n",animationstats.getsize(),animationstats.getindexcount()); + printf("Total Memory size of Meshes: %20u bytes in %9u meshes \n",meshstats.getsize(),meshstats.getindexcount()); + + printf("***** END OF SUMMARY ******* \n"); + printf("\n"); + + + if(!suppress) + { + printf("\n"); + printf("\n"); + printf("***** Bad Meshes *******\n"); + p_mesh_ref->print(); + printf("\n"); + printf("***** HIGH POLY Meshes *******\n"); + p_polycount->print(); + printf("\n"); + } + if(showall) + { + printf("\n"); + printf("***** Texture Breakdown *******\n"); + texturestats.printverbose(); + printf("\n"); + printf("***** Animation Breakdown *******\n"); + animationstats.printverbose(); + printf("\n"); + printf("***** Meshes Breakdown *******\n"); + meshstats.printverbose(); + printf("\n"); + + } + delete p_mesh_ref ; + delete p_polycount; + + /* + // create the new output file + tlFile output(new tlFileByteStream(filename, omWRITE), tlFile::CHUNK32); + + if(!output.IsOpen()) + { + printf("Could not open %s for writing,unable to Save\n", filename); + exit(-1); + } + + // get the output wrapper chunk to write its data out + // to the file + outchunk->Write(&output); +*/ + + delete inchunk; + delete outchunk; + return 1; + } + else + { + +/* + // create the new output file + tlFile output(new tlFileByteStream(filename, omWRITE), tlFile::CHUNK32); + + if(!output.IsOpen()) + { + printf("Could not open %s for writing\n", filename); + exit(-1); + } +*/ + // get the output wrapper chunk to write its data out + // to the file + // outchunk->Write(&output); + + + // cleanup the no-longer-needed wrapper chunks + delete inchunk; + delete outchunk; + delete p_mesh_ref; + delete p_polycount; + printf("\n"); + printf("\n"); + printf("\n"); + + printf("***** SUMMARY ******* \n"); + printf("\n"); + fprintf(stdout,"Filename:%-15s PASSED Artchecker. \n",filename); + printf("\n"); + + // cleanup the no-longer-needed wrapper chunks + + printf("Total Memory size of Textures: %20u bytes in %9u textures \n",texturestats.getsize(),texturestats.getindexcount()); + printf("Total Memory size of Animations: %20u bytes in %9u animations \n",animationstats.getsize(),animationstats.getindexcount()); + printf("Total Memory size of Meshes: %20u bytes in %9u meshes \n",meshstats.getsize(),meshstats.getindexcount()); + + printf("***** END OF SUMMARY ******* \n"); + + if(showall) + { + printf("\n"); + printf("***** Texture Breakdown *******\n"); + texturestats.printverbose(); + printf("\n"); + printf("***** Animation Breakdown *******\n"); + animationstats.printverbose(); + printf("\n"); + printf("***** Meshes Breakdown *******\n"); + meshstats.printverbose(); + printf("\n"); + + } + return 0; + } +} //end of main + + +//******************************************** +// Function Bodies +//******************************************** + +//helper function to print error messages +void debugstring (char * message) +{ +#ifdef DEBUG + cout<<message<<endl; +#endif +} + + +//helper funtion to check texutre return 0 if texture matches db ,1 if their is a mismatch or error +int texturelookup(const texture_data& texturedata, bool add, bool strict,bool showall,badlist& badtextures,bool suppress) //badlist* p_badtextures +{ + bool error=false ; + //char querybuffer [1000]; + char output [1000]; +// Result::iterator sql_iterator; +// Row row; + outputbuffer texture_errors; + + //sprintf(querybuffer, "SELECT * FROM textures WHERE name = '%s' ",texturedata.name); + //query<< querybuffer; + //Result myresult= query.store ( ); + + + + //cant find texture in the database + //if (myresult.size ( ) ==0 ) + if (1) + { + + if ( add == true) + { + //add object to the DB + cout<< "Adding:" << texturedata.name << " texture to the ArtDB \n"; + + //todo add stuff here + } + //texture not found in the the DB + + if (strict) + { + //cout<<",Not Found !" <<endl; + sprintf(output," ERROR :%s texture not found in the ArtDB",texturedata.name); + texture_errors.add(output); + //cout<<"ERROR :"<<texturedata.name<< " texture not found in the ArtDB \n"; + error = true; + } + + //check texture attributes against the default limits + + //check against art limits + if(texturedata.height>MAX_TEXTURE_SIZE) + { + error=true; + sprintf(output," ERROR : %u Height exceeds Max Texture SIZE OF %u",texturedata.height,MAX_TEXTURE_SIZE); + texture_errors.add(output); + // cout<<" =====>Warning "<<texturedata.name<<" : "<< texturedata.height << " Height exceeds Max Texture SIZE OF "<<MAX_TEXTURE_SIZE<<endl; + } + + if(texturedata.width>MAX_TEXTURE_SIZE) + { + error=true; + sprintf(output," ERROR : %u Width exceeds Max Texture SIZE OF %u",texturedata.width,MAX_TEXTURE_SIZE); + texture_errors.add(output); + // cout<<" =====>Warning "<<texturedata.name<<": "<< texturedata.width << " Width exceeds Max Texture SIZE OF "<<MAX_TEXTURE_SIZE<<endl; + } + + if(texturedata.bpp>MAX_BPP) + { + error=true; + sprintf(output," ERROR : %u BPP exceeds Max BPP SIZE OF %u",texturedata.bpp,MAX_BPP); + texture_errors.add(output); + //cout<<" =====>Warning "<<texturedata.name<<": "<< texturedata.bpp << " BPP exceeds Max BPP SIZE OF "<<MAX_BPP<<endl; + } + // cout<<" Warning :"<<texturedata.name<< " texture not found in the ArtDB \n"; + + }//end if in artdb block + + //if(myresult.size()!=0) + if(0) + { + //cout <<",Found . " << endl; + + /* + for (sql_iterator=myresult.begin ( ); sql_iterator!= myresult.end ( ); sql_iterator++) + { + + row =*sql_iterator; + int height= row["height"]; + int width=row["width"]; + int bpp=row["bpp"]; + int alpha=row["alphabits"]; + + + //check texture height + if( texturedata.height > height) + { + if (strict) + { + error=true; + sprintf(output," ERROR :Texture height %u exceeds expected %u",texturedata.height,height); + texture_errors.add(output); + } + else + { + sprintf(output," Warning :Texture height %u exceeds expected %u",texturedata.height,height); + texture_errors.add(output); + } + }//end if + + //check width + if( texturedata.width > width) + { + if (strict) + { + error=true; + sprintf(output," ERROR :Texture width %u exceeds expected %u",texturedata.width,width); + texture_errors.add(output); + } + else + { + sprintf(output," Warning :Texture width %u exceeds expected %u",texturedata.width,width); + texture_errors.add(output); + } + }//end if + + //check bpp + if( texturedata.bpp > bpp) + { + if (strict) + { + error=true; + sprintf(output," ERROR :Texture BPP %u exceeds expected %u",texturedata.bpp,bpp); + texture_errors.add(output); + } + else + { + sprintf(output," Warning :Texture BPP %u exceeds expected %u",texturedata.bpp,bpp); + texture_errors.add(output); + } + }//end if + + + + + //just printing out the rows + //for (int j=0;j<row.size ( ); j++) + //{ + // cout<< "[" << row[j] << "]" ; + //} + //cout<<endl; + + }//end for iterator loop + + */ + + }//end if found in the Artdb block + + + + + if (error) + { + if(!suppress) + { + printf("\n"); + printf("%s Texture:\n",texturedata.name); + texture_errors.print(); + printf("\n"); + } + badtextures.add(texturedata.name,1,0); + return 1; + } + else + { + return 0; + } + +}// end texture lookup + + +//helper funtion to check shader, returns 0 if shader matches db ,1 if their is a mismatch +int shaderlookup(shader_data* lp_shaderdata, bool add, bool strict,bool showall,badlist& badshaders,bool suppress) +{ + + bool error=false; + char querybuffer [1000]; + char output [1000]; + //Result::iterator sql_iterator; + //Row row; + outputbuffer shader_errors; + sprintf(querybuffer, "SELECT * FROM shaders WHERE name = '%s' ",lp_shaderdata->name); + //query<< querybuffer; + //Result myresult= query.store ( ); + + +// if (myresult.size ( ) ==0 ) + if (1) + { + + if ( add == true) + { + //add object to the DB + printf("Adding: %s shader to the ArtDB \n",lp_shaderdata->name); + //todo add stuff here + } + + if (strict) + { + sprintf(output," ERROR: %s Shader not found in the ArtDB",lp_shaderdata->name); + shader_errors.add(output); + } + + //check for lit + if ( lp_shaderdata->lit) + { + shader_errors.add(" =====>ERROR : LIT shader FOUND!"); + error = true; + + if(badshaders.inlist(lp_shaderdata->name) ==0) + { + badshaders.add(lp_shaderdata->name,1,0); + } + } +/* + if ((lp_shaderdata->twosid) == 0) + { + shader_errors.add(" =====>Warning : Double Sided FLAG is 0!"); + error=true; + } + + */ + + }//end if shader in artdb check + + //cout << "Records Found: " << myresult.size() << endl ; +/* + + for (sql_iterator=myresult.begin ( ); sql_iterator!= myresult.end ( ); sql_iterator++) + { + row =*sql_iterator; + + //just printing out the rows + for (int j=0;j<row.size ( ); j++) + { + cout<< "[" << row[j] << "]" ; + } + cout<<endl; + }//end for iterator loop +*/ + + if (error) + { + if(!suppress) + { + + printf("\n"); + printf("%s shader : \n",lp_shaderdata->name); + shader_errors.print(); + } + if(strict) + { + return 1; + } + else + { + return 0; + } + } + else + { + return 0; + } + +}// end shader lookup + +/* + + +//helper funtion to check object, returns 0 if shader matches db ,1 if their is a mismatch +int artobjectlookup(art_object* lp_artobject, Query& query,bool add, bool strict,bool showall,bool suppress) +{ + + char querybuffer [1000]; + Result::iterator sql_iterator; + Row row; + unsigned int artpropid,shaderid; + bool error= false; + + //setup a query to artdb ask if object is in Artdb + + sprintf(querybuffer, "SELECT * FROM objects WHERE name = '%s' ",lp_artobject->name); + query<< querybuffer; + Result myresult= query.store ( ); + //cout << "Records Found: " << myresult.size() << endl ; + + //if result size is zero, object not found + //if ( myresult.size ( ) ==0 ) + if(1) + { + if ( add == true) + { + //add object to the DB + cout<< "Adding:" << lp_artobject->name << " to the ArtDB \n"; + //todo add stuff here + + return 0; + } + //object not found in the the DB halt + else + { + if (strict) + { + printf("ERROR: %s object not found in the ArtDB, \n",lp_artobject->name); + error =true; + } + else + { + printf("Warning:%s object not found in the ArtDB \n",lp_artobject->name); + } + } + }//end if object in artdb check + + + for (sql_iterator=myresult.begin ( ); sql_iterator!= myresult.end ( ); sql_iterator++) + { + row =*sql_iterator; + artpropid = row["artpropid"]; + shaderid = row["shaderid"]; + //just printing out the rows + for (int j=0;j<row.size ( ); j++) + { + cout<< "[" << row[j] << "]" ; + } + cout<<endl; + }//end for iterator loop + + + //check check the art proporties if less than max vertices,etc then we ok + sprintf(querybuffer, "SELECT * FROM artprops WHERE id = '%i' ",artpropid); + query<< querybuffer; + myresult= query.store ( ); + + cout << "Records Found: " << myresult.size() << endl ; + //check if artprops in the ArtDB + //if ( myresult.size ( ) ==0 ) + if(1) + { + if ( add == true) + { + //add object to the DB + cout<< "Adding:" <<lp_artobject->name << " art props to the ArtDB \n"; + cout<< "Adding: Artprops to artdb \n"; + return 0; + + //todo add stuff here + } + + //object not found in the the DB halt + else + { + if (strict) + { + cout<<"ERROR: "<<lp_artobject->name<< " Art properties not found in the ArtDB, Halting \n"; + error=true; + } + else + { + cout<<"Warning: "<<lp_artobject->name<< " Art properties not found in the ArtDB, using default physic properties\n"; + }//end else + }//end else + }//end if + + for (sql_iterator=myresult.begin ( ); sql_iterator!= myresult.end ( ); sql_iterator++) + { + row =*sql_iterator; + + unsigned int vertexcount,polycount,shadercount,bonecount,animationframes; + vertexcount=row["VertexCount"]; + polycount=row["PolyCount"]; + shadercount=row["ShaderCount"]; + bonecount=row["BoneCount"]; + animationframes=row["Animframes"]; + + if (strict) + { + if( lp_artobject->art_properties.vertex_count > vertexcount) + { + cout<<"ERROR:"<< lp_artobject->name<<" has exceeded " << row["VertexCount"]<<" Vertexcount, HALTING \n"; + error =true; + } + + if( lp_artobject->art_properties.poly_count > polycount) + { + cout<<"ERROR:"<< lp_artobject->name<<" has exceeded " << row["PolyCount"]<<" Polycount, HALTING \n"; + error =true; + } + + if( lp_artobject->art_properties.animation_frames > animationframes) + { + cout<<"ERROR:"<< lp_artobject->name<<" has exceeded " << row["AnimFrames"]<< " Animation frames, HALTING \n"; + error =true; + } + + if( lp_artobject->art_properties.bone_count > bonecount) + { + cout<<"ERROR:"<< lp_artobject->name<<" has exceeded " << row["BoneCount"]<<" Bonecount, HALTING \n"; + error =true; + } + + if( lp_artobject->art_properties.shader_count > shadercount) + { + cout<<"ERROR:"<< lp_artobject->name<<" has exceeded " << row["ShaderCount"]<<" Shadercount, HALTING\n"; + error =true; + } + }//end if artprops check + else + { + if( lp_artobject->art_properties.vertex_count > vertexcount) + { + cout<<"Warning:"<< lp_artobject->name<<" has exceeded " << row["VertexCount"]<<" Vertexcount \n"; + } + + if( lp_artobject->art_properties.poly_count > polycount) + { + cout<<"Warning:"<< lp_artobject->name<<" has exceeded " << row["PolyCount"]<<" Polycount \n"; + } + + if( lp_artobject->art_properties.animation_frames > animationframes) + { + cout<<"Warning:"<< lp_artobject->name<<" has exceeded " << row["AnimFrames"]<< " Animation frames \n"; + } + + if( lp_artobject->art_properties.bone_count > bonecount) + { + cout<<"Warning:"<< lp_artobject->name<<" has exceeded " << row["BoneCount"]<<" Bonecount \n"; + } + + if( lp_artobject->art_properties.shader_count > shadercount) + { + cout<<"Warning:"<< lp_artobject->name<<" has exceeded " << row["ShaderCount"]<<" Shadercount \n"; + } + }// end else artprops check + + + + }//for loop end artobjectlookup + + + //printing art props + + for (int j=0;j<row.size ( ); j++) + { + cout<< "[" << row[j] << "]" ; + } + + + printf("\n"); + + if (error) + { + return 1; + } + else + { + return 0; + } + +}//end artobject lookup + + +//************************************************************************* +// Check's if root of Bound Volume exists, if not then treats it as a strict object + +int bvobjectlookup(bv_data* lp_bvobject,Query& query,bool add,bool strict,bool showall,bool suppress) +{ + bool errors =false; + char querybuffer [1000]; + char output[1000]; + outputbuffer bv_errors; + Result::iterator sql_iterator; + Row row; + + + sprintf(querybuffer, "SELECT * FROM objects WHERE name = '%s' ",lp_bvobject->name); + query<< querybuffer; + Result myresult= query.store ( ); + + + if (myresult.size ( ) ==0 ) + { + if ( add == true) + { + //add object to the DB + //cout<< "Adding:" << lp_shaderdata->name << " shader to the ArtDB \n"; + + //todo add stuff here + } + //object not found in the the DB halt + else + { + if (strict) + { + sprintf(output,"ERROR: %s object not found in the ArtDB \n",lp_bvobject->name); + bv_errors.add(output); + //cout<<" ERROR:"<<lp_bvobject->name<< " object not found in the ArtDB \n"; + //return 1; + errors =true; + } + else + { + errors =true; + sprintf(output,"Warning: %s object not found in the ArtDB , using defaults vaules for ObjectAttributeChunk \n",lp_bvobject->name); + bv_errors.add(output); + //cout<<" Warning:"<<lp_bvobject->name<< " bv object not found in the ArtDB, using defaults vaules for ObjectAttributeChunk \n"; + lp_bvobject->physpropid=0; + lp_bvobject->classtype=2; // set to dsg_static_phys + } + + } + + }//end if object check in artdb check + + // cout << "Records Found: " << myresult.size() << endl ; + + for (sql_iterator=myresult.begin ( ); sql_iterator!= myresult.end ( ); sql_iterator++) + { + + row =*sql_iterator; + lp_bvobject->classtype =2; + lp_bvobject->physpropid=row["physpropid"]; + + + //just printing out the rows + for (int j=0;j<row.size ( ); j++) + { + cout<< "[" << row[j] << "]" ; + } + + cout<<endl; + + + }//end for iterator loop + + if (errors) + { + if(strict) + { + bv_errors.print(); + return 1; + } + else + { + if(!suppress) + { + bv_errors.print (); + } + return 0; + } + } + else + { + return 0; + } +}// end of Bv object check + + +*/
\ No newline at end of file diff --git a/tools/ArtChecker/artchecker.dsp b/tools/ArtChecker/artchecker.dsp new file mode 100644 index 0000000..ebb8f83 --- /dev/null +++ b/tools/ArtChecker/artchecker.dsp @@ -0,0 +1,128 @@ +# Microsoft Developer Studio Project File - Name="artchecker" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 60000 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=artchecker - Win32 Tools Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "artchecker.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "artchecker.mak" CFG="artchecker - Win32 Tools Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "artchecker - Win32 Tools Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "artchecker - Win32 Tools Release" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "artchecker" +# PROP Scc_LocalPath "." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "artchecker - Win32 Tools Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "artchecker___Win32_Tools_Debug" +# PROP BASE Intermediate_Dir "artchecker___Win32_Tools_Debug" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GR /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DEBUG" /YX /FD /GZ /c +# ADD CPP /nologo /MD /W3 /GR /GX /ZI /Od /I "..\..\game\libs\pure3d\toollib\inc" /I "..\..\game\libs\pure3d\constants" /I "..\..\game\code\constants" /I "..\..\game\libs\radmath" /I "..\..\game\libs\pure3d\toollib\chunks16\inc" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "RAD_WIN32" /D "RAD_PC" /D "RAD_DEBUG" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x1009 /d "_DEBUG" +# ADD RSC /l 0x1009 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 mysql++.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"C:\mysql++\lib\\" +# SUBTRACT BASE LINK32 /incremental:no +# ADD LINK32 mysql++.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"C:\mysql++\lib\\" +# SUBTRACT LINK32 /incremental:no + +!ELSEIF "$(CFG)" == "artchecker - Win32 Tools Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "artchecker___Win32_Tools_Release" +# PROP BASE Intermediate_Dir "artchecker___Win32_Tools_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\game\libs\pure3d\toollib\inc" /I "..\..\game\libs\pure3d\constants" /I "..\..\game\code\constants" /I "..\..\game\libs\radmath" /I "..\..\game\libs\pure3d\toollib\chunks16\inc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "RAD_RELEASE" /D "RAD_PC" /D "RAD_WIN32" /FR /YX /FD /c +# ADD BASE RSC /l 0x1009 /d "NDEBUG" +# ADD RSC /l 0x1009 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ENDIF + +# Begin Target + +# Name "artchecker - Win32 Tools Debug" +# Name "artchecker - Win32 Tools Release" +# Begin Group "sourcefile" + +# PROP Default_Filter ".cpp" +# Begin Source File + +SOURCE=.\artchecker.cpp +# End Source File +# Begin Source File + +SOURCE=.\artobject.cpp +# End Source File +# Begin Source File + +SOURCE=.\badlist.cpp +# End Source File +# Begin Source File + +SOURCE=.\outputbuffer.cpp +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter ".h" +# Begin Source File + +SOURCE=.\artlimits.h +# End Source File +# Begin Source File + +SOURCE=.\artobject.h +# End Source File +# Begin Source File + +SOURCE=.\badlist.hpp +# End Source File +# Begin Source File + +SOURCE=.\outputbuffer.hpp +# End Source File +# End Group +# End Target +# End Project diff --git a/tools/ArtChecker/artchecker.exe b/tools/ArtChecker/artchecker.exe Binary files differnew file mode 100644 index 0000000..d258eb8 --- /dev/null +++ b/tools/ArtChecker/artchecker.exe diff --git a/tools/ArtChecker/artlimits.h b/tools/ArtChecker/artlimits.h new file mode 100644 index 0000000..a2fb3b5 --- /dev/null +++ b/tools/ArtChecker/artlimits.h @@ -0,0 +1,3 @@ +#define MAX_TEXTURE_SIZE 64 +#define MAX_BPP 8 +#define MAX_POLYCOUNT 500
\ No newline at end of file diff --git a/tools/ArtChecker/artlimits.hpp b/tools/ArtChecker/artlimits.hpp new file mode 100644 index 0000000..f1d00a3 --- /dev/null +++ b/tools/ArtChecker/artlimits.hpp @@ -0,0 +1,2 @@ +#define MAX_TEXTURE_SIZE 256 +#define MAX_BPP 8 diff --git a/tools/ArtChecker/artobject.cpp b/tools/ArtChecker/artobject.cpp new file mode 100644 index 0000000..fcd120d --- /dev/null +++ b/tools/ArtChecker/artobject.cpp @@ -0,0 +1,46 @@ +#include <cstring> +#include "artobject.h" + + +art_object::art_object ( ) +{ + int i,j; + + for (i=0;i<max_shaders;i++) + { + for (j=0;j<max_textures;j++) + { + strcpy(shader_list[i].texture_list[j].name, "no name"); + shader_list[i].texture_list[j].width =0; + shader_list[i].texture_list[j].height =0; + shader_list[i].texture_list[j].bpp =0; + shader_list[i].texture_list[j].alpha =0; + }//end for + + strcpy (shader_list[i].name, "no name"); + shader_list[i].lit =false; + }//end for + + //setting default art vaules + art_properties.vertex_count =0; + art_properties.poly_count =0; + art_properties.animation_frames =0; + art_properties.shader_count =0; + art_properties.bone_count =0; + + //set default art_object vaules + + strcpy(name,"no name"); + +} + +art_object::~art_object( ) +{ + +} + + + + + + diff --git a/tools/ArtChecker/artobject.h b/tools/ArtChecker/artobject.h new file mode 100644 index 0000000..eff09ab --- /dev/null +++ b/tools/ArtChecker/artobject.h @@ -0,0 +1,59 @@ +#define max_length 64 +#define max_textures 3 +#define max_shaders 14 + +struct texture_data +{ + char name[max_length] ; + unsigned int width; + unsigned int height; + unsigned int bpp; + unsigned int alpha; +}; + + +struct shader_data +{ + char name[max_length]; + unsigned int lit; + unsigned int twosid; + + texture_data texture_list[max_textures]; +}; + +struct art_data +{ + unsigned int vertex_count; + unsigned int poly_count; + unsigned int animation_frames; + unsigned int shader_count; + unsigned int bone_count; +}; + + +struct bv_data +{ + char name[max_length]; + unsigned int physpropid; + unsigned int classtype; +}; + + + +class art_object +{ + +public: +//data + shader_data shader_list[max_shaders]; + art_data art_properties; + char name[max_length]; + +//methods + art_object ( ); + ~art_object( ); + +}; + + + diff --git a/tools/ArtChecker/atcmaker.exe b/tools/ArtChecker/atcmaker.exe Binary files differnew file mode 100644 index 0000000..e0390c7 --- /dev/null +++ b/tools/ArtChecker/atcmaker.exe diff --git a/tools/ArtChecker/badlist.cpp b/tools/ArtChecker/badlist.cpp new file mode 100644 index 0000000..bcce4ca --- /dev/null +++ b/tools/ArtChecker/badlist.cpp @@ -0,0 +1,90 @@ +#include "badlist.hpp" +#include <cstring> +#include<stdio.h> + +badlist::badlist () +{ + max_items=200; + data_array=new entity_data[max_items]; + index = 0; + totalmemoryusage =0; + for(unsigned int i=0;i<max_items;i++) + { + strcpy(data_array[i].name," "); + data_array[i].occurances=0; + data_array[i].size=0; + } +} +badlist::badlist (const unsigned int arraysize) +{ + max_items=arraysize; + data_array=new entity_data[max_items]; + index = 0; + totalmemoryusage =0; + for(unsigned int i=0;i<max_items;i++) + { + strcpy(data_array[i].name," "); + data_array[i].occurances=0; + data_array[i].size=0; + } +} + + + + +badlist::~badlist () +{ +} + +int badlist::add(const char* name,const unsigned int occurances,const unsigned int size) +{ + if (index<max_items-1) + { + strcpy( data_array[index].name,name); + data_array[index].occurances=occurances; + data_array[index].size=size; + totalmemoryusage+=size; + index++; + return 0; + } + else + { + return 1; + } +} + +int badlist::inlist(const char* name) +{ + unsigned int i=0; + do + { + if(strcmp(name,data_array[i].name) ==0) + { + //printf("%s found in list \n",name); + return 1; + } + i++; + } while (i<index); + + return 0; +} + +int badlist::getsize() +{ + return totalmemoryusage; +} + +int badlist::getindexcount() +{ + return index; +} + + +int badlist::printverbose() +{ + for (unsigned int i=0;i<index;i++) + { + printf("%-30s: size in bytes: %6i \n",data_array[i].name,data_array[i].size); + } + return 0; +}
\ No newline at end of file diff --git a/tools/ArtChecker/badlist.hpp b/tools/ArtChecker/badlist.hpp new file mode 100644 index 0000000..727ca47 --- /dev/null +++ b/tools/ArtChecker/badlist.hpp @@ -0,0 +1,33 @@ +//#define max_items 200 +struct entity_data +{ + + char name [40]; + unsigned int occurances; + unsigned int size; +}; + + +class badlist +{ + public: + + + int add (const char * name,const unsigned int occurances,const unsigned int size); + int inlist (const char * name); + int getsize(); + int getindexcount(); + int printverbose(); + + badlist (); + badlist (const unsigned int arraysize); + ~badlist(); + + private: + unsigned int max_items; + entity_data* data_array ; + unsigned int index; + unsigned int totalmemoryusage; + +}; + diff --git a/tools/ArtChecker/check.bat b/tools/ArtChecker/check.bat new file mode 100644 index 0000000..6b932aa --- /dev/null +++ b/tools/ArtChecker/check.bat @@ -0,0 +1,2 @@ +@artchecker %1 +@pause
\ No newline at end of file diff --git a/tools/ArtChecker/libmySQL.dll b/tools/ArtChecker/libmySQL.dll Binary files differnew file mode 100644 index 0000000..53c753d --- /dev/null +++ b/tools/ArtChecker/libmySQL.dll diff --git a/tools/ArtChecker/summary.bat b/tools/ArtChecker/summary.bat new file mode 100644 index 0000000..88ca88e --- /dev/null +++ b/tools/ArtChecker/summary.bat @@ -0,0 +1,13 @@ +:// Usage summary <destination filename> +:// example summary myfile.txt + + +dir *.p3d /b> dir.txt + +@perl d:\artchecker\summary.pl dir.txt + +:// ..\..\..\build\ps2\LevelMemoryNumbers.txt + +del dir.txt + + diff --git a/tools/ArtChecker/summary.pl b/tools/ArtChecker/summary.pl new file mode 100644 index 0000000..83ed95d --- /dev/null +++ b/tools/ArtChecker/summary.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +$filename=@ARGV[0]; + +############################################################################## +# MAIN +############################################################################## + +#open file +open(FILE_HANDLE,$filename) || die "Could not open file ERROR: $filename!"; + + +#while not EOF and read in string +while (<FILE_HANDLE>) +{ + $string = $_; + chop($string); + #print $string; + @todo =("artchecker ",$string," sum"); + system (@todo) # == 0 or die "Failed to Execute Artchecker Command !\n"; +} + +close(FILE_HANDLE);
\ No newline at end of file diff --git a/tools/ArtChecker/summaryall.bat b/tools/ArtChecker/summaryall.bat new file mode 100644 index 0000000..648eea5 --- /dev/null +++ b/tools/ArtChecker/summaryall.bat @@ -0,0 +1,13 @@ +:// Usage summary <destination filename> +:// example summary myfile.txt + + +dir *.p3d /b> dir.txt + +@perl d:\artchecker\summaryall.pl dir.txt + +:// ..\..\..\build\ps2\LevelMemoryNumbers.txt + +del dir.txt + + diff --git a/tools/ArtChecker/summaryall.pl b/tools/ArtChecker/summaryall.pl new file mode 100644 index 0000000..e69e131 --- /dev/null +++ b/tools/ArtChecker/summaryall.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +$filename=@ARGV[0]; + +############################################################################## +# MAIN +############################################################################## + +#open file +open(FILE_HANDLE,$filename) || die "Could not open file ERROR: $filename!"; + + +#while not EOF and read in string +while (<FILE_HANDLE>) +{ + $string = $_; + chop($string); + #print $string; + @todo =("artchecker ",$string); + system (@todo) # == 0 or die "Failed to Execute Artchecker Command !\n"; +} + +close(FILE_HANDLE);
\ No newline at end of file |