diff --git a/README.md b/README.md index 343793e017a0f45091f411bc418def325893873d..7ce79e5f595cd917a583829ce183ca761ca7b652 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It's as dirty as it can get and doesn't even include VU1 assembler for now 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 header reconstruction, UV mapping, fixing some unpack +tool in a day. It is still missing header reconstruction, fixing some unpack commands and all, just figured I would upload this before I lose it Good luck for understanding the code btw, should stop working diff --git a/obj2kh2v.c b/obj2kh2v.c index 769f10bbd903d23800dd8a8ff487b31919b073b8..8e276e781521c969286b6372bceac0bcfd2e29de 100644 --- a/obj2kh2v.c +++ b/obj2kh2v.c @@ -3,6 +3,7 @@ #include <string> #include <fstream> #include <sstream> +#include <math.h> int flag(int x, int y, int z) { int flagx = x; @@ -26,7 +27,20 @@ int main(int argc, char* argv[]){ vi++; } } -for(int i =0; i<vi+1;i++){dsm << ".short 0xffff, 0xffff\n";} +in.clear(); +in.seekg(0, std::ios::beg); + while (getline(in, line)) + { + if (line.substr(0,3) == "vt ") + { + std::istringstream s(line.substr(3)); + float u, v; + s >> u; s >> v; + dsm << ".short " << int(round(u*4095)) << ", " << int(round(v*4095)) << "\n"; + } + + } + dsm << ".EndUnpack\n\nstmask 0xf3f3f3f3; Sets mask register(3303, check EEUSER_E)\nstcycl 01, 01; We write code to memory without skips/overwrite\n\nunpack 4, 128, S_8, 0, *; Vertex indices\n"; for(int i =0; i<vi+1;i++){dsm << ".byte " << i << "\n";}