Unverified Commit 22871f49 authored by GovanifY's avatar GovanifY
Browse files

People will MAYBE stop bitching now

parent 3cd42bc5
# obj2kh2v
Model importer for Kingdom Hearts 2
It's as dirty as it can get and doesn't even include VU1 assembler
for now but eh, it kinda works.
It's as dirty as it can get but eh, it kinda works.
Oh btw when I mean it kinda works datas are roughly placed, I just made the
tool in a day. It is still missing memory checks and additional shading
......@@ -14,10 +14,13 @@ int flag(int x, int y, int z) {
int main(int argc, char* argv[]){
long ap, vp, hp;
int junk=0;
printf("obj2kh2v\nPlease input only unwelded sorted models containing only triangles!\n\n");
if(argc<3){printf("Usage: obj2kh2v model.obj output.dsm"); return -1;}
if(argc<2){printf("Usage: obj2kh2v model.obj"); return -1;}
std::ifstream in(argv[1], std::ios::in);
std::ofstream dsm (argv[2]);
std::string dsmname = std::string(argv[1]).substr(0,std::string(argv[1]).find_last_of('.'))+".dsm";
std::string kh2vname = std::string(argv[1]).substr(0,std::string(argv[1]).find_last_of('.'))+".kh2v";
std::ofstream dsm (dsmname);
dsm << ".align 0\n;" << argv[1] << "\n;Automatically generated by obj2kh2v\n;DO NOT EDIT IF YOU DON'T KNOW WHAT YOU ARE DOING\n\nstcycl 01, 01; We write code to memory without skips/overwrite\n\nunpack[r] V4_32, 0, *; Model Part Header\n.int 1, 0, 0, 0;type 1 Model\n";
hp = dsm.tellp();
//Can't insert if not at eof using ofstream so I put 10 spaces to fill up, size of INT_MAX and no \n to avoid linefeed not beeing rewritten
......@@ -121,5 +124,10 @@ printf("h1: %i, h2: 4, h3: %i, h4: %i\nj1: %i, j2: %i, j3: 0, j4: 1\n",ti, 4+ti+
dsm << 4+ti;
dsm << 4+ti+vi;
return 1;
if(system(("dvp-as "+dsmname+" -o junk.o > /dev/null").c_str()) != 0){printf("Could not proceed, please install homebrew ps2 sdk!\n"); return -1;}
if(system(("dvp-objcopy -O binary junk.o "+kh2vname+" > /dev/null").c_str()) != 0){printf("Your homebrew ps2 sdk installation seems to be broken, please reinstall\n"); return -1;}
return 1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment