got it working up until the demos, still need to check and redo all the tools

This commit is contained in:
Jip 2024-05-13 20:59:48 +02:00
parent 948bd8474c
commit 52b0e0671f
31 changed files with 297 additions and 271 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
# Build system # Build system
build/
_build/ _build/
_deps/ _deps/
_dist/ _dist/

View file

@ -7,12 +7,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_ROOT_DIR})
enable_language(ASM) enable_language(ASM)
include(ConfigureTarget)
######################################### #########################################
#### Options #### Options
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) # default cmake option(BUILD_SHARED_LIBS "Build using shared libraries" ON) # default cmake
option(NIOTSO_BUILD_EXAMPLES "Build the render demos" OFF) option(NIOTSO_BUILD_EXAMPLES "Build the render demos" ON)
option(NIOTSO_BUILD_TOOLS "Build niotso tools" ON) option(NIOTSO_BUILD_TOOLS "Build niotso tools" ON)
if(WIN32) if(WIN32)

View file

@ -1,4 +1,5 @@
add_subdirectory(far-extract) add_subdirectory(far-extract)
add_subdirectory(vitaboy-parse)
#add_subdirectory(FARDive) #add_subdirectory(FARDive)
#add_subdirectory(hitutils) #add_subdirectory(hitutils)

View file

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.6...3.29)
project(vitaboy-parse)
include_directories(${vitaboy_SOURCE_DIR} ${filehandler_SOURCE_DIR})
add_executable(vbparse vbparse.cpp)
target_link_libraries(vbparse libvitaboy FileHandler)
set_target_properties(vbparse PROPERTIES FOLDER tools)

View file

@ -17,7 +17,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <string.h>
#include <FileHandler.hpp> #include <FileHandler.hpp>
#include "libvitaboy.hpp" #include "libvitaboy.hpp"

5
examples/CMakeLists.txt Normal file
View file

@ -0,0 +1,5 @@
add_subdirectory(gldemo)
add_subdirectory(rlgldemo)
#TODO:
# Set Properties -> Debugging -> Working Directory from $(ProjectDir) to $(Outdir)

View file

@ -2,21 +2,16 @@ cmake_minimum_required(VERSION 2.6...3.29)
project(libgldemo) project(libgldemo)
if(WIN32) if(WIN32)
set(GLDEMO_EXE WIN32) set(LIBGLDEMO_SOURCES WIN32 wgl.c)
set(GLDEMO_LINK mingw32 libgldemo_static opengl32 glu32) set(GLDEMO_LINK libvitaboy FileHandler opengl32 glu32)
else()
set(GLDEMO_EXE "")
set(GLDEMO_LINK libgldemo_static Xxf86vm rt Xext X11 GL GLU)
endif()
if(WIN32)
set(LIBGLDEMO_SOURCES wgl.c)
else() else()
set(LIBGLDEMO_SOURCES glx.c) set(LIBGLDEMO_SOURCES glx.c)
set(GLDEMO_LINK libvitaboy FileHandler Xxf86vm rt Xext X11 GL GLU)
add_definitions(-D_POSIX_C_SOURCE=200112) add_definitions(-D_POSIX_C_SOURCE=200112)
endif() endif()
add_library(libgldemo_static STATIC ${LIBGLDEMO_SOURCES}) include_directories(${libvitaboy_SOURCE_DIR} ${filehandler_SOURCE_DIR})
set_target_properties(libgldemo_static PROPERTIES add_executable(libgldemo ${LIBGLDEMO_SOURCES} Renderer.cpp)
OUTPUT_NAME "gldemo" target_link_libraries(libgldemo ${GLDEMO_LINK})
CLEAN_DIRECT_OUTPUT 1)
set_target_properties(libgldemo PROPERTIES FOLDER examples)

View file

@ -46,11 +46,20 @@
n: Animate the character n: Animate the character
F11: Enter/leave fullscreen F11: Enter/leave fullscreen
*/ */
#ifdef _WIN32
#include <windows.h>
#include <gl/GL.h>
#include <gl/GLU.h>
#else
#define APIENTRY
#include <GL/gl.h>
#include <GL/glext.h>
#endif
#include <math.h> #include <math.h>
#include <FileHandler.hpp> #include <FileHandler.hpp>
#include <libgldemo.h> #include "libgldemo.h"
#include "libvitaboy.hpp" #include <libvitaboy.hpp>
static float zoom = -10; static float zoom = -10;
struct BasicVertex_t { struct BasicVertex_t {
@ -60,21 +69,21 @@ struct CharacterPlacement_t {
BasicVertex_t Translation; BasicVertex_t Translation;
BasicVertex_t Rotation; BasicVertex_t Rotation;
}; };
static CharacterPlacement_t Character = {{0,-3,0}, {0,0,0}}; static CharacterPlacement_t Character = { {0,-3,0}, {0,0,0} };
static Skeleton_t Skeleton; static Skeleton_t Skeleton;
static const unsigned TextureCount = 3; static const unsigned TextureCount = 3;
static unsigned texture[3]; static unsigned texture[3];
enum { Texture_Body, Texture_Head, Texture_Hand }; enum { Texture_Body, Texture_Head, Texture_Hand };
static const char* const TexturePaths[] = {"body.jpg", "head.jpg", "hand.jpg"}; static const char* const TexturePaths[] = { "body.jpg", "head.jpg", "hand.jpg" };
static const unsigned MeshCount = 4; static const unsigned MeshCount = 4;
static Mesh_t Meshes[4]; static Mesh_t Meshes[4];
enum { Mesh_Body, Mesh_Head, Mesh_LHand, Mesh_RHand }; enum { Mesh_Body, Mesh_Head, Mesh_LHand, Mesh_RHand };
static const char* const MeshPaths[] = {"body.mesh", "head.mesh", "lhand.mesh", "rhand.mesh" }; static const char* const MeshPaths[] = { "body.mesh", "head.mesh", "lhand.mesh", "rhand.mesh" };
static const unsigned Mesh_UseTexture[] = { Texture_Body, Texture_Head, Texture_Hand, Texture_Hand }; static const unsigned Mesh_UseTexture[] = { Texture_Body, Texture_Head, Texture_Hand, Texture_Hand };
static const char* const MeshActivate[] = {NULL, "HEAD", "L_HAND", "R_HAND"}; static const char* const MeshActivate[] = { NULL, "HEAD", "L_HAND", "R_HAND" };
static Animation_t Animation; static Animation_t Animation;
static float AnimationTime = 0; static float AnimationTime = 0;
@ -84,9 +93,9 @@ static bool ShowSkeleton = true;
static bool PressedQ = false; static bool PressedQ = false;
static void DisplayFileError(const char * Filename){ static void DisplayFileError(const char* Filename) {
const char * Message; const char* Message;
switch(File::Error){ switch (File::Error) {
case FERR_NOT_FOUND: case FERR_NOT_FOUND:
Message = "%s does not exist."; Message = "%s does not exist.";
break; break;
@ -114,15 +123,15 @@ static void DisplayFileError(const char * Filename){
static int LoadTextures() static int LoadTextures()
{ {
glGenTextures(3, texture); glGenTextures(3, texture);
for(int i=0; i<3; i++){ for (int i = 0; i < 3; i++) {
Image_t * Image = File::ReadImageFile(TexturePaths[i]); Image_t* Image = File::ReadImageFile(TexturePaths[i]);
if(!Image){ if (!Image) {
DisplayFileError(TexturePaths[i]); DisplayFileError(TexturePaths[i]);
return false; return false;
} }
glBindTexture(GL_TEXTURE_2D, texture[i]); glBindTexture(GL_TEXTURE_2D, texture[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, Image->Width, Image->Height, 0, GL_BGR, GL_UNSIGNED_BYTE, Image->Data); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, Image->Width, Image->Height, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, Image->Data);
free(Image->Data); free(Image->Data);
free(Image); free(Image);
@ -136,7 +145,7 @@ static int LoadTextures()
static int InitGL() static int InitGL()
{ {
if(!LoadTextures()) if (!LoadTextures())
return false; return false;
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);
@ -144,7 +153,7 @@ static int InitGL()
glClearDepth(1.0f); glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glEnable(GL_RESCALE_NORMAL); glEnable(GL_NORMALIZE);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
@ -160,7 +169,7 @@ static int ResizeScene(uint16_t width, uint16_t height)
glLoadIdentity(); glLoadIdentity();
// Calculate The Aspect Ratio Of The Window // Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 0.1f, 100.0f); gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f);
// glScalef(-1.0f, 1.0f, 1.0f); // glScalef(-1.0f, 1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
@ -178,20 +187,20 @@ static void TransformVertices(Bone_t& Bone)
unsigned MeshIndex = 0; unsigned MeshIndex = 0;
unsigned BoneIndex; unsigned BoneIndex;
for(unsigned i=1; i<MeshCount; i++){ for (unsigned i = 1; i < MeshCount; i++) {
if(!strcmp(Bone.Name, MeshActivate[i])){ if (!strcmp(Bone.Name, MeshActivate[i])) {
MeshIndex = i; MeshIndex = i;
break; break;
} }
} }
Mesh_t& Mesh = Meshes[MeshIndex]; Mesh_t& Mesh = Meshes[MeshIndex];
for(BoneIndex=0; BoneIndex<Mesh.BindingCount; BoneIndex++){ for (BoneIndex = 0; BoneIndex < Mesh.BindingCount; BoneIndex++) {
if(!strcmp(Bone.Name, Mesh.BoneNames[Mesh.BoneBindings[BoneIndex].BoneIndex])) if (!strcmp(Bone.Name, Mesh.BoneNames[Mesh.BoneBindings[BoneIndex].BoneIndex]))
break; break;
} }
if(BoneIndex < Mesh.BindingCount){ if (BoneIndex < Mesh.BindingCount) {
for(unsigned i=0; i<Mesh.BoneBindings[BoneIndex].RealVertexCount; i++){ for (unsigned i = 0; i < Mesh.BoneBindings[BoneIndex].RealVertexCount; i++) {
unsigned VertexIndex = Mesh.BoneBindings[BoneIndex].FirstRealVertex + i; unsigned VertexIndex = Mesh.BoneBindings[BoneIndex].FirstRealVertex + i;
Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex]; Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex];
Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex]; Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex];
@ -203,7 +212,7 @@ static void TransformVertices(Bone_t& Bone)
AbsoluteVertex.Coord.z = Matrix[14]; AbsoluteVertex.Coord.z = Matrix[14];
glTranslatef(-RelativeVertex.Coord.x, -RelativeVertex.Coord.y, -RelativeVertex.Coord.z); glTranslatef(-RelativeVertex.Coord.x, -RelativeVertex.Coord.y, -RelativeVertex.Coord.z);
} }
for(unsigned i=0; i<Mesh.BoneBindings[BoneIndex].BlendVertexCount; i++){ for (unsigned i = 0; i < Mesh.BoneBindings[BoneIndex].BlendVertexCount; i++) {
unsigned VertexIndex = Mesh.RealVertexCount + Mesh.BoneBindings[BoneIndex].FirstBlendVertex + i; unsigned VertexIndex = Mesh.RealVertexCount + Mesh.BoneBindings[BoneIndex].FirstBlendVertex + i;
Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex]; Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex];
Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex]; Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex];
@ -217,10 +226,11 @@ static void TransformVertices(Bone_t& Bone)
} }
} }
if(Bone.ChildrenCount == 1){ if (Bone.ChildrenCount == 1) {
TransformVertices(*Bone.Children[0]); TransformVertices(*Bone.Children[0]);
}else if(Bone.ChildrenCount > 1){ }
for(unsigned i=0; i<Bone.ChildrenCount; i++){ else if (Bone.ChildrenCount > 1) {
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
glPushMatrix(); glPushMatrix();
TransformVertices(*Bone.Children[i]); TransformVertices(*Bone.Children[i]);
glPopMatrix(); glPopMatrix();
@ -230,28 +240,27 @@ static void TransformVertices(Bone_t& Bone)
static void BlendVertices() static void BlendVertices()
{ {
for(unsigned i=0; i<MeshCount; i++){ for (unsigned i = 0; i < MeshCount; i++) {
Mesh_t& Mesh = Meshes[i]; Mesh_t& Mesh = Meshes[i];
for(unsigned i=0; i<Mesh.BlendVertexCount; i++){ for (unsigned i = 0; i < Mesh.BlendVertexCount; i++) {
Vertex_t& BlendVertex = Mesh.TransformedVertexData[Mesh.RealVertexCount + i]; Vertex_t& BlendVertex = Mesh.TransformedVertexData[Mesh.RealVertexCount + i];
float Weight = BlendVertex.BlendData.Weight; float Weight = BlendVertex.BlendData.Weight;
Vertex_t& RealVertex = Mesh.TransformedVertexData[BlendVertex.BlendData.OtherVertex]; Vertex_t& RealVertex = Mesh.TransformedVertexData[BlendVertex.BlendData.OtherVertex];
RealVertex.Coord.x = RealVertex.Coord.x =
Weight * BlendVertex.Coord.x + Weight * BlendVertex.Coord.x +
(1-Weight) * RealVertex.Coord.x; (1 - Weight) * RealVertex.Coord.x;
RealVertex.Coord.y = RealVertex.Coord.y =
Weight * BlendVertex.Coord.y + Weight * BlendVertex.Coord.y +
(1-Weight) * RealVertex.Coord.y; (1 - Weight) * RealVertex.Coord.y;
RealVertex.Coord.z = RealVertex.Coord.z =
Weight * BlendVertex.Coord.z + Weight * BlendVertex.Coord.z +
(1-Weight) * RealVertex.Coord.z; (1 - Weight) * RealVertex.Coord.z;
} }
} }
} }
static void DrawMeshes() static void DrawMeshes()
{ {
glPointSize(2.0);
glColor3f(1.0, 1.0, 1.0); glColor3f(1.0, 1.0, 1.0);
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -263,11 +272,11 @@ static void DrawMeshes()
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for(unsigned i=0; i<MeshCount; i++){ for (unsigned i = 0; i < MeshCount; i++) {
glBindTexture(GL_TEXTURE_2D, texture[Mesh_UseTexture[i]]); glBindTexture(GL_TEXTURE_2D, texture[Mesh_UseTexture[i]]);
glVertexPointer(3, GL_FLOAT, sizeof(Vertex_t), &Meshes[i].TransformedVertexData[0].Coord); glVertexPointer(3, GL_FLOAT, sizeof(Vertex_t), &Meshes[i].TransformedVertexData[0].Coord);
glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex_t), &Meshes[i].TransformedVertexData[0].TextureCoord); glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex_t), &Meshes[i].TransformedVertexData[0].TextureCoord);
glDrawElements(GL_TRIANGLES, Meshes[i].FaceCount*3, GL_UNSIGNED_INT, Meshes[i].FaceData); glDrawElements(GL_TRIANGLES, Meshes[i].FaceCount * 3, GL_UNSIGNED_INT, Meshes[i].FaceData);
} }
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
@ -277,40 +286,40 @@ static void DrawMeshes()
static void AdvanceFrame(Skeleton_t& Skeleton, Animation_t& Animation, float TimeDelta) static void AdvanceFrame(Skeleton_t& Skeleton, Animation_t& Animation, float TimeDelta)
{ {
float Duration = (float)Animation.Motions[0].FrameCount/30; float Duration = (float)Animation.Motions[0].FrameCount / 30;
AnimationTime += TimeDelta; AnimationTime += TimeDelta;
AnimationTime = fmodf(AnimationTime, Duration); //Loop the animation AnimationTime = fmodf(AnimationTime, Duration); //Loop the animation
for(unsigned i=0; i<Animation.MotionsCount; i++){ for (unsigned i = 0; i < Animation.MotionsCount; i++) {
unsigned BoneIndex = FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount); unsigned BoneIndex = FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount);
if(BoneIndex == (unsigned)-1) continue; if (BoneIndex == (unsigned)-1) continue;
Bone_t& Bone = Skeleton.Bones[BoneIndex]; Bone_t& Bone = Skeleton.Bones[BoneIndex];
unsigned Frame = AnimationTime*30; unsigned Frame = AnimationTime * 30;
float FractionShown = AnimationTime*30 - Frame; float FractionShown = AnimationTime * 30 - Frame;
unsigned NextFrame = (Frame+1 != Animation.Motions[0].FrameCount) ? Frame+1 : 0; unsigned NextFrame = (Frame + 1 != Animation.Motions[0].FrameCount) ? Frame + 1 : 0;
if(Animation.Motions[i].HasTranslation){ if (Animation.Motions[i].HasTranslation) {
Translation_t& Translation = Animation.Motions[i].Translations[Frame]; Translation_t& Translation = Animation.Motions[i].Translations[Frame];
Translation_t& NextTranslation = Animation.Motions[i].Translations[NextFrame]; Translation_t& NextTranslation = Animation.Motions[i].Translations[NextFrame];
Bone.Translation.x = (1-FractionShown)*Translation.x + FractionShown*NextTranslation.x; Bone.Translation.x = (1 - FractionShown) * Translation.x + FractionShown * NextTranslation.x;
Bone.Translation.y = (1-FractionShown)*Translation.y + FractionShown*NextTranslation.y; Bone.Translation.y = (1 - FractionShown) * Translation.y + FractionShown * NextTranslation.y;
Bone.Translation.z = (1-FractionShown)*Translation.z + FractionShown*NextTranslation.z; Bone.Translation.z = (1 - FractionShown) * Translation.z + FractionShown * NextTranslation.z;
} }
if(Animation.Motions[i].HasRotation){ if (Animation.Motions[i].HasRotation) {
Rotation_t& Rotation = Animation.Motions[i].Rotations[Frame]; Rotation_t& Rotation = Animation.Motions[i].Rotations[Frame];
Rotation_t& NextRotation = Animation.Motions[i].Rotations[NextFrame]; Rotation_t& NextRotation = Animation.Motions[i].Rotations[NextFrame];
//Use nlerp to interpolate //Use nlerp to interpolate
float w1 = 1.0f - FractionShown, w2 = FractionShown; float w1 = 1.0f - FractionShown, w2 = FractionShown;
if(DotProduct(&Rotation, &NextRotation) < 0) if (DotProduct(&Rotation, &NextRotation) < 0)
w1 *= -1; w1 *= -1;
Bone.Rotation.x = w1*Rotation.x + w2*NextRotation.x; Bone.Rotation.x = w1 * Rotation.x + w2 * NextRotation.x;
Bone.Rotation.y = w1*Rotation.y + w2*NextRotation.y; Bone.Rotation.y = w1 * Rotation.y + w2 * NextRotation.y;
Bone.Rotation.z = w1*Rotation.z + w2*NextRotation.z; Bone.Rotation.z = w1 * Rotation.z + w2 * NextRotation.z;
Bone.Rotation.w = w1*Rotation.w + w2*NextRotation.w; Bone.Rotation.w = w1 * Rotation.w + w2 * NextRotation.w;
Normalize(&Bone.Rotation); Normalize(&Bone.Rotation);
} }
@ -325,18 +334,19 @@ static void DrawBonesSkeleton(Bone_t& Bone)
FindQuaternionMatrix(RotationMatrix, &Bone.Rotation); FindQuaternionMatrix(RotationMatrix, &Bone.Rotation);
glMultMatrixf(RotationMatrix); glMultMatrixf(RotationMatrix);
if(!strcmp(Bone.Name, "ROOT")) if (!strcmp(Bone.Name, "ROOT"))
glColor3f(1.0, 0.0, 0.0); glColor3f(1.0, 0.0, 0.0);
else if(!strcmp(Bone.Name, "HEAD")) else if (!strcmp(Bone.Name, "HEAD"))
glColor3f(1.0, 1.0, 0.0); glColor3f(1.0, 1.0, 0.0);
else else
glColor3f(0.0, 1.0, 0.0); glColor3f(0.0, 1.0, 0.0);
glBegin(GL_POINTS); glVertex3f(0, 0, 0); glEnd(); glBegin(GL_POINTS); glVertex3f(0, 0, 0); glEnd();
if(Bone.ChildrenCount == 1){ if (Bone.ChildrenCount == 1) {
DrawBonesSkeleton(*Bone.Children[0]); DrawBonesSkeleton(*Bone.Children[0]);
}else if(Bone.ChildrenCount > 1){ }
for(unsigned i=0; i<Bone.ChildrenCount; i++){ else if (Bone.ChildrenCount > 1) {
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
glPushMatrix(); glPushMatrix();
DrawBonesSkeleton(*Bone.Children[i]); DrawBonesSkeleton(*Bone.Children[i]);
glPopMatrix(); glPopMatrix();
@ -354,37 +364,38 @@ static void DrawSkeleton()
static int DrawScene(float TimeDelta, uint8_t keys[256]) static int DrawScene(float TimeDelta, uint8_t keys[256])
{ {
//Handle user interaction //Handle user interaction
if(keys['A']) /*{if(zoom <=-1.0f) zoom+=0.05f; }*/ zoom+=3*TimeDelta; if (keys['A']) /*{if(zoom <=-1.0f) zoom+=0.05f; }*/ zoom += 3 * TimeDelta;
if(keys['S']) /*{if(zoom >=-10.0f) zoom-=0.05f; }*/ zoom-=3*TimeDelta; if (keys['S']) /*{if(zoom >=-10.0f) zoom-=0.05f; }*/ zoom -= 3 * TimeDelta;
if(keys[KEY_UP]){ if((Character.Rotation.x-=60*TimeDelta) <=-360) Character.Rotation.x+=360; } if (keys[KEY_UP]) { if ((Character.Rotation.x -= 60 * TimeDelta) <= -360) Character.Rotation.x += 360; }
if(keys[KEY_DOWN]){ if((Character.Rotation.x+=60*TimeDelta) >=360) Character.Rotation.x-=360; } if (keys[KEY_DOWN]) { if ((Character.Rotation.x += 60 * TimeDelta) >= 360) Character.Rotation.x -= 360; }
if(keys[KEY_LEFT]){ if((Character.Rotation.y-=60*TimeDelta) <=-360) Character.Rotation.y+=360; } if (keys[KEY_LEFT]) { if ((Character.Rotation.y -= 60 * TimeDelta) <= -360) Character.Rotation.y += 360; }
if(keys[KEY_RIGHT]){ if((Character.Rotation.y+=60*TimeDelta) >=360) Character.Rotation.y-=360; } if (keys[KEY_RIGHT]) { if ((Character.Rotation.y += 60 * TimeDelta) >= 360) Character.Rotation.y -= 360; }
if(keys['X']){ if((Character.Rotation.z-=60*TimeDelta) <=-360) Character.Rotation.z+=360; } if (keys['X']) { if ((Character.Rotation.z -= 60 * TimeDelta) <= -360) Character.Rotation.z += 360; }
if(keys['Z']){ if((Character.Rotation.z+=60*TimeDelta) >=360) Character.Rotation.z-=360; } if (keys['Z']) { if ((Character.Rotation.z += 60 * TimeDelta) >= 360) Character.Rotation.z -= 360; }
if(keys['K']){ Character.Translation.y-=3*TimeDelta; } if (keys['K']) { Character.Translation.y -= 3 * TimeDelta; }
if(keys['I']){ Character.Translation.y+=3*TimeDelta; } if (keys['I']) { Character.Translation.y += 3 * TimeDelta; }
if(keys['J']){ Character.Translation.x-=3*TimeDelta; } if (keys['J']) { Character.Translation.x -= 3 * TimeDelta; }
if(keys['L']){ Character.Translation.x+=3*TimeDelta; } if (keys['L']) { Character.Translation.x += 3 * TimeDelta; }
if(keys['Q']){ if(!PressedQ){ PressedQ = 1; ShowSkeleton = !ShowSkeleton; }} else PressedQ = 0; if (keys['Q']) { if (!PressedQ) { PressedQ = 1; ShowSkeleton = !ShowSkeleton; } }
if(keys['N']){ AdvanceFrame(Skeleton, Animation, TimeDelta); } else PressedQ = 0;
if (keys['N']) { AdvanceFrame(Skeleton, Animation, TimeDelta); }
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen and the depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen and the depth buffer
glLoadIdentity(); glLoadIdentity();
glTranslatef(Character.Translation.x, Character.Translation.y, zoom + Character.Translation.z); glTranslatef(Character.Translation.x, Character.Translation.y, zoom + Character.Translation.z);
glRotatef(Character.Rotation.x,1.0f,0.0f,0.0f); glRotatef(Character.Rotation.x, 1.0f, 0.0f, 0.0f);
glRotatef(Character.Rotation.y,0.0f,1.0f,0.0f); glRotatef(Character.Rotation.y, 0.0f, 1.0f, 0.0f);
glRotatef(Character.Rotation.z,0.0f,0.0f,1.0f); glRotatef(Character.Rotation.z, 0.0f, 0.0f, 1.0f);
if(ShowMesh){ if (ShowMesh) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glColor3f(1.0, 1.0, 1.0); glColor3f(1.0, 1.0, 1.0);
DrawMeshes(); DrawMeshes();
} }
if(ShowSkeleton){ if (ShowSkeleton) {
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
DrawSkeleton(); DrawSkeleton();
} }
@ -392,9 +403,9 @@ static int DrawScene(float TimeDelta, uint8_t keys[256])
return true; return true;
} }
static bool Read(const char * Filename, uint8_t ** InData){ static bool Read(const char* Filename, uint8_t** InData) {
*InData = File::ReadFile(Filename); *InData = File::ReadFile(Filename);
if(*InData != NULL){ if (*InData != NULL) {
VBFile.set(*InData, File::FileSize); VBFile.set(*InData, File::FileSize);
return true; return true;
} }
@ -405,21 +416,21 @@ static bool Read(const char * Filename, uint8_t ** InData){
static int Startup() static int Startup()
{ {
uint8_t * InData; uint8_t* InData;
if(!Read("skeleton.skel", &InData)) if (!Read("skeleton.skel", &InData))
return 0; return 0;
ReadSkeleton(Skeleton); ReadSkeleton(Skeleton);
free(InData); free(InData);
for(unsigned i=0; i<MeshCount; i++){ for (unsigned i = 0; i < MeshCount; i++) {
if(!Read(MeshPaths[i], &InData)) if (!Read(MeshPaths[i], &InData))
return 0; return 0;
ReadMesh(Meshes[i]); ReadMesh(Meshes[i]);
free(InData); free(InData);
} }
if(!Read("animation.anim", &InData)) if (!Read("animation.anim", &InData))
return 0; return 0;
ReadAnimation(Animation); ReadAnimation(Animation);
free(InData); free(InData);
@ -429,13 +440,13 @@ static int Startup()
} }
extern "C" { extern "C" {
const DemoConfig Demo = { const DemoConfig Demo = {
"libvitaboy - Renderer", //Title "libvitaboy - Renderer", //Title
640,480, //Width, Height 640,480, //Width, Height
Startup, //Startup Startup, //Startup
NULL, //Shutdown NULL, //Shutdown
InitGL, //InitGL InitGL, //InitGL
ResizeScene, //ResizeScene ResizeScene, //ResizeScene
DrawScene //DrawScene DrawScene //DrawScene
}; };
} }

View file

@ -15,10 +15,14 @@
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#include <GL/glext.h> #ifdef _WIN32
#include <windows.h>
#else
#define APIENTRY
#include <GL/glext.h>
#endif
typedef struct { typedef struct {
const char *__restrict Title; const char *__restrict Title;

View file

@ -15,7 +15,8 @@
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <Windows.h>
#include <stdint.h>
#include "libgldemo.h" #include "libgldemo.h"
static HWND hWnd = NULL; static HWND hWnd = NULL;

View file

@ -4,9 +4,6 @@ project(rlgldemo)
# Adding Raylib # Adding Raylib
include(FetchContent) include(FetchContent)
set(FETCHCONTENT_QUIET FALSE) set(FETCHCONTENT_QUIET FALSE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games
#set raylib settings #set raylib settings
add_compile_definitions(SUPPORT_FILEFORMAT_JPG) add_compile_definitions(SUPPORT_FILEFORMAT_JPG)
@ -17,20 +14,18 @@ FetchContent_Declare(
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
) )
FetchContent_MakeAvailable(raylib) FetchContent_MakeAvailable(raylib)
set_target_properties(raylib PROPERTIES FOLDER examples/deps)
set_target_properties(glfw PROPERTIES FOLDER examples/deps)
set_target_properties(update_mappings PROPERTIES FOLDER examples/deps)
include_directories(${FILEHANDLER_INCLUDE}) include_directories(${filehandler_SOURCE_DIR})
include_directories(${VITABOY_INCLUDE}) include_directories(${libvitaboy_SOURCE_DIR})
# Adding our source files # Adding our source files
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/*.cpp") # Define PROJECT_SOURCES as a list of all source files set(RLGL_DEMO_SOURCES main.cpp)
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/*.h") # Define PROJECT_INCLUDE to be the path to the include directory of the project
# Declaring our executable # Declaring our executable
add_executable(${PROJECT_NAME}) add_executable(rlgldemo ${RLGL_DEMO_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES}) target_link_libraries(rlgldemo PRIVATE raylib libvitaboy FileHandler)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
target_link_libraries(${PROJECT_NAME} PRIVATE raylib libvitaboy_static FileHandler_static)
# Setting ASSETS_PATH set_target_properties(rlgldemo PROPERTIES FOLDER examples)
target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/") # Set the asset path macro to the absolute path on the dev machine
#target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="./assets") # Set the asset path macro in release mode to a relative path that assumes the assets folder is in the same directory as the game executable

View file

@ -37,8 +37,8 @@
#include "rlgl.h" #include "rlgl.h"
#include <cassert> #include <cassert>
#include <FileHandler.h> #include <FileHandler.hpp>
#include "../libvitaboy/libvitaboy.hpp" #include <libvitaboy.hpp>
#define SCREEN_WIDTH (800) #define SCREEN_WIDTH (800)
#define SCREEN_HEIGHT (600) #define SCREEN_HEIGHT (600)

View file

@ -1,3 +1,4 @@
add_subdirectory(archive) add_subdirectory(archive)
add_subdirectory(format) add_subdirectory(format)
add_subdirectory(filehandler) add_subdirectory(filehandler)
add_subdirectory(libvitaboy)

View file

@ -17,6 +17,6 @@ if(WIN32)
endif() endif()
include_directories(${format_SOURCE_DIR} ${zlib_SOURCE_DIR} ${libpng_SOURCE_DIR} ${jpeg_SOURCE_DIR}) include_directories(${format_SOURCE_DIR} ${zlib_SOURCE_DIR} ${libpng_SOURCE_DIR} ${jpeg_SOURCE_DIR})
add_library(FileHandler SHARED ${FILEHANDLER_SOURCES} ${FILEHANDLER_HEADERS}) # remove shared, cmake should handle this add_library(FileHandler STATIC ${FILEHANDLER_SOURCES} ${FILEHANDLER_HEADERS}) # remove shared, cmake should handle this
target_link_libraries(FileHandler format far iff zlib libpng jpegturbo) target_link_libraries(FileHandler format far iff zlib libpng jpegturbo)

View file

@ -66,22 +66,21 @@ struct Sound_t {
uint8_t * Data; uint8_t * Data;
}; };
namespace File { namespace File
{
inline size_t GetFileSize(FILE * hFile){
fseek(hFile, 0, SEEK_END);
size_t FileSize = ftell(hFile);
fseek(hFile, 0, SEEK_SET);
return FileSize;
}
inline size_t GetFileSize(FILE * hFile){ extern int Error;
fseek(hFile, 0, SEEK_END); extern size_t FileSize;
size_t FileSize = ftell(hFile);
fseek(hFile, 0, SEEK_SET);
return FileSize;
}
fhexport extern int Error;
fhexport extern size_t FileSize;
fhexport uint8_t * ReadFile(const char * Filename);
fhexport Image_t * ReadImageFile(const char * Filename);
fhexport Sound_t * ReadSoundFile(const char * Filename);
uint8_t * ReadFile(const char * Filename);
Image_t * ReadImageFile(const char * Filename);
Sound_t * ReadSoundFile(const char * Filename);
} }
#endif #endif

View file

@ -21,4 +21,3 @@ set(FORMAT_SOURCES
add_library(format SHARED ${FORMAT_SOURCES} ${FORMAT_HEADERS}) # don't specify shared, cmake settings should take care of that add_library(format SHARED ${FORMAT_SOURCES} ${FORMAT_HEADERS}) # don't specify shared, cmake settings should take care of that
target_include_directories(format PUBLIC ${FORMAT_HEADERS}) target_include_directories(format PUBLIC ${FORMAT_HEADERS})
set_target_properties(format PROPERTIES FOLDER format)

View file

@ -1,3 +1,9 @@
libvitaboy 1.0.2 (2024-05-13) jip boesenkool
* Reorganized the file structure, split tools into seperate tools folder and added
* Rewrote cmake
* pulled GL1 renderer into the demo that uses it
libvitaboy 1.0.1 (2012-03-10) Fatbag libvitaboy 1.0.1 (2012-03-10) Fatbag
* Corrected the BlendVertices function; blend vertices tug real vertices, not the other way around * Corrected the BlendVertices function; blend vertices tug real vertices, not the other way around

View file

@ -1,10 +1,6 @@
cmake_minimum_required(VERSION 2.6...3.29) cmake_minimum_required(VERSION 2.6...3.29)
project(libvitaboy) project(libvitaboy)
set(LIBVITABOY_SERIES 0)
set(LIBVITABOY_MAJOR 0)
set(LIBVITABOY_MINOR 1)
set(LIBVITABOY_SOURCES set(LIBVITABOY_SOURCES
anim.cpp anim.cpp
apr.cpp apr.cpp
@ -16,36 +12,20 @@ set(LIBVITABOY_SOURCES
oft.cpp oft.cpp
po.cpp po.cpp
skel.cpp skel.cpp
Log.hpp
config.h
) )
set(LIBVITABOY_HEADERS
libvitaboy.hpp
)
if(WIN32) if(WIN32)
set(LIBVITABOY_SOURCES ${LIBVITABOY_SOURCES} resource.rc) set(LIBVITABOY_SOURCES ${LIBVITABOY_SOURCES} resource.rc)
else() else()
add_definitions(-Dstricmp=strcasecmp) add_definitions(-Dstricmp=strcasecmp)
endif() endif()
include_directories(${LIBGLDEMO_INCLUDE} ${FILEHANDLER_INCLUDE}) include_directories(${vitaboy_SOURCE_DIR} ${filehandler_SOURCE_DIR})
add_library(libvitaboy STATIC ${LIBVITABOY_SOURCES} ${LIBVITABOY_HEADERS}) # don't specify shared, cmake settings should take care of that
#### Static library (uncomment to build) target_include_directories(libvitaboy PUBLIC ${LIBVITABOY_HEADERS})
#add_library(libvitaboy_static STATIC ${LIBVITABOY_SOURCES})
#set_target_properties(libvitaboy_static PROPERTIES
# OUTPUT_NAME "vitaboy"
# CLEAN_DIRECT_OUTPUT 1)
add_library(libvitaboy_shared SHARED ${LIBVITABOY_SOURCES})
if(WIN32)
set_target_properties(libvitaboy_shared PROPERTIES OUTPUT_NAME "vitaboy${LIBVITABOY_SERIES}")
else()
set_target_properties(libvitaboy_shared PROPERTIES OUTPUT_NAME "vitaboy")
endif()
set_target_properties(libvitaboy_shared PROPERTIES
COMPILE_FLAGS "-fvisibility=default"
VERSION ${LIBVITABOY_SERIES}.${LIBVITABOY_MAJOR}.${LIBVITABOY_MINOR}
PREFIX "lib"
IMPORT_PREFIX "lib"
CLEAN_DIRECT_OUTPUT 1)
add_executable(vbparse vbparse.cpp)
target_link_libraries(vbparse libvitaboy_shared FileHandler_shared)
add_executable(Renderer ${GLDEMO_EXE} Renderer.cpp)
target_link_libraries(Renderer libvitaboy_shared ${GLDEMO_LINK} FileHandler_shared m)

10
niotso/libvitaboy/Log.hpp Normal file
View file

@ -0,0 +1,10 @@
#ifndef LIBVITABOY_LOG_HPP
#define LIBVITABOY_LOG_HPP
#ifdef NDEBUG
#define vita_printf(...)
#else
#define vita_printf(...) printf(__VA_ARGS__)
#endif
#endif

View file

@ -17,34 +17,35 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
static unsigned motionnumber = 0; static unsigned motionnumber = 0;
void ReadAnimation(Animation_t& Animation){ void ReadAnimation(Animation_t& Animation){
printf("===== Animation =====\n"); vita_printf("===== Animation =====\n");
Animation.Version = VBFile.readint32(); Animation.Version = VBFile.readint32();
printf("Version: %u\n", Animation.Version); vita_printf("Version: %u\n", Animation.Version);
Animation.Name = VBFile.readstring2(); Animation.Name = VBFile.readstring2();
printf("Name: %s\n", Animation.Name); vita_printf("Name: %s\n", Animation.Name);
Animation.Duration = VBFile.readfloat(); Animation.Duration = VBFile.readfloat();
printf("Duration: %g\n", Animation.Duration/1000); vita_printf("Duration: %g\n", Animation.Duration/1000);
Animation.Distance = VBFile.readfloat(); Animation.Distance = VBFile.readfloat();
printf("Distance: %g\n", Animation.Distance); vita_printf("Distance: %g\n", Animation.Distance);
Animation.IsMoving = VBFile.readint8(); Animation.IsMoving = VBFile.readint8();
printf("IsMoving: %u\n", Animation.IsMoving); vita_printf("IsMoving: %u\n", Animation.IsMoving);
Animation.TranslationsCount = VBFile.readint32(); Animation.TranslationsCount = VBFile.readint32();
printf("TranslationsCount: %u\n", Animation.TranslationsCount); vita_printf("TranslationsCount: %u\n", Animation.TranslationsCount);
Animation.TranslationsOffset = VBFile.getpos(); Animation.TranslationsOffset = VBFile.getpos();
VBFile.seekto(Animation.TranslationsOffset + 12*Animation.TranslationsCount); VBFile.seekto(Animation.TranslationsOffset + 12*Animation.TranslationsCount);
Animation.RotationsCount = VBFile.readint32(); Animation.RotationsCount = VBFile.readint32();
printf("RotationsCount: %u\n", Animation.RotationsCount); vita_printf("RotationsCount: %u\n", Animation.RotationsCount);
Animation.RotationsOffset = VBFile.getpos(); Animation.RotationsOffset = VBFile.getpos();
VBFile.seekto(Animation.RotationsOffset + 16*Animation.RotationsCount); VBFile.seekto(Animation.RotationsOffset + 16*Animation.RotationsCount);
Animation.MotionsCount = VBFile.readint32(); Animation.MotionsCount = VBFile.readint32();
printf("MotionsCount: %u\n", Animation.MotionsCount); vita_printf("MotionsCount: %u\n", Animation.MotionsCount);
Animation.Motions = (Motion_t*) malloc(Animation.MotionsCount * sizeof(Motion_t)); Animation.Motions = (Motion_t*) malloc(Animation.MotionsCount * sizeof(Motion_t));
for(unsigned i=0; i<Animation.MotionsCount; i++){ for(unsigned i=0; i<Animation.MotionsCount; i++){
ReadMotion(Animation, Animation.Motions[i]); ReadMotion(Animation, Animation.Motions[i]);
@ -53,26 +54,26 @@ void ReadAnimation(Animation_t& Animation){
void ReadMotion(Animation_t& Animation, Motion_t& Motion){ void ReadMotion(Animation_t& Animation, Motion_t& Motion){
motionnumber++; motionnumber++;
printf("\n\n [Motion %u]\n", motionnumber); vita_printf("\n\n [Motion %u]\n", motionnumber);
Motion.Unknown = VBFile.readint32(); Motion.Unknown = VBFile.readint32();
printf(" | Unknown: %u\n", Motion.Unknown); vita_printf(" | Unknown: %u\n", Motion.Unknown);
Motion.BoneName = VBFile.readstring(); Motion.BoneName = VBFile.readstring();
printf(" | BoneName: %s\n", Motion.BoneName); vita_printf(" | BoneName: %s\n", Motion.BoneName);
Motion.FrameCount = VBFile.readint32(); Motion.FrameCount = VBFile.readint32();
printf(" | FrameCount: %u\n", Motion.FrameCount); vita_printf(" | FrameCount: %u\n", Motion.FrameCount);
Motion.Duration = VBFile.readfloat(); Motion.Duration = VBFile.readfloat();
printf(" | Duration: %g\n", Motion.Duration/1000); vita_printf(" | Duration: %g\n", Motion.Duration/1000);
Motion.HasTranslation = VBFile.readint8(); Motion.HasTranslation = VBFile.readint8();
printf(" | HasTranslation: %u\n", Motion.HasTranslation); vita_printf(" | HasTranslation: %u\n", Motion.HasTranslation);
Motion.HasRotation = VBFile.readint8(); Motion.HasRotation = VBFile.readint8();
printf(" | HasRotation: %u\n", Motion.HasRotation); vita_printf(" | HasRotation: %u\n", Motion.HasRotation);
Motion.FirstTranslation = VBFile.readint32(); Motion.FirstTranslation = VBFile.readint32();
if(Motion.HasTranslation) if(Motion.HasTranslation)
printf(" | FirstTranslation: %u\n", Motion.FirstTranslation); vita_printf(" | FirstTranslation: %u\n", Motion.FirstTranslation);
Motion.FirstRotation = VBFile.readint32(); Motion.FirstRotation = VBFile.readint32();
if(Motion.HasRotation) if(Motion.HasRotation)
printf(" | FirstRotation: %u\n", Motion.FirstRotation); vita_printf(" | FirstRotation: %u\n", Motion.FirstRotation);
if(Motion.HasTranslation){ if(Motion.HasTranslation){
Motion.Translations = (Translation_t*) malloc(Motion.FrameCount * sizeof(Translation_t)); Motion.Translations = (Translation_t*) malloc(Motion.FrameCount * sizeof(Translation_t));
@ -102,13 +103,13 @@ void ReadMotion(Animation_t& Animation, Motion_t& Motion){
} }
Motion.HasPropsLists = VBFile.readint8(); Motion.HasPropsLists = VBFile.readint8();
printf(" | HasPropsLists: %u\n", Motion.HasPropsLists); vita_printf(" | HasPropsLists: %u\n", Motion.HasPropsLists);
if(Motion.HasPropsLists){ if(Motion.HasPropsLists){
ReadPropsLists(Motion); ReadPropsLists(Motion);
} }
Motion.HasTimePropsLists = VBFile.readint8(); Motion.HasTimePropsLists = VBFile.readint8();
printf(" | HasTimePropsLists: %u\n", Motion.HasTimePropsLists); vita_printf(" | HasTimePropsLists: %u\n", Motion.HasTimePropsLists);
if(Motion.HasTimePropsLists){ if(Motion.HasTimePropsLists){
ReadTimePropsLists(Motion); ReadTimePropsLists(Motion);
} }
@ -116,11 +117,11 @@ void ReadMotion(Animation_t& Animation, Motion_t& Motion){
void ReadPropsList(PropsList_t& PropsList){ void ReadPropsList(PropsList_t& PropsList){
unsigned count = PropsList.PropsCount = VBFile.readint32(); unsigned count = PropsList.PropsCount = VBFile.readint32();
printf(" | | | PropsCount: %u\n", count); vita_printf(" | | | PropsCount: %u\n", count);
PropsList.Props = (Prop_t*) malloc(count * sizeof(Prop_t)); PropsList.Props = (Prop_t*) malloc(count * sizeof(Prop_t));
for(unsigned i=0; i<count; i++){ for(unsigned i=0; i<count; i++){
printf(" | | | [Prop %u]\n", i+1); vita_printf(" | | | [Prop %u]\n", i+1);
ReadPropEntries(PropsList.Props[i]); ReadPropEntries(PropsList.Props[i]);
} }
} }
@ -136,24 +137,24 @@ void ReadPropsLists(Motion_t& Motion){
void ReadTimePropsList(TimePropsList_t& TimePropsList){ void ReadTimePropsList(TimePropsList_t& TimePropsList){
unsigned count = TimePropsList.TimePropsCount = VBFile.readint32(); unsigned count = TimePropsList.TimePropsCount = VBFile.readint32();
printf(" | | TimePropsCount: %u\n", count); vita_printf(" | | TimePropsCount: %u\n", count);
TimePropsList.TimeProps = (TimeProp_t*) malloc(count * sizeof(TimeProp_t)); TimePropsList.TimeProps = (TimeProp_t*) malloc(count * sizeof(TimeProp_t));
for(unsigned i=0; i<count; i++){ for(unsigned i=0; i<count; i++){
printf(" | | [TimeProp %u]\n", i+1); vita_printf(" | | [TimeProp %u]\n", i+1);
TimePropsList.TimeProps[i].ID = VBFile.readint32(); TimePropsList.TimeProps[i].ID = VBFile.readint32();
printf(" | | | ID: %u\n", TimePropsList.TimeProps[i].ID); vita_printf(" | | | ID: %u\n", TimePropsList.TimeProps[i].ID);
ReadPropsList(TimePropsList.TimeProps[i].PropsList); ReadPropsList(TimePropsList.TimeProps[i].PropsList);
} }
} }
void ReadTimePropsLists(Motion_t& Motion){ void ReadTimePropsLists(Motion_t& Motion){
unsigned count = Motion.TimePropsListsCount = VBFile.readint32(); unsigned count = Motion.TimePropsListsCount = VBFile.readint32();
printf(" | TimePropsListsCount: %u\n", count); vita_printf(" | TimePropsListsCount: %u\n", count);
Motion.TimePropsLists = (TimePropsList_t*) malloc(count * sizeof(TimePropsList_t)); Motion.TimePropsLists = (TimePropsList_t*) malloc(count * sizeof(TimePropsList_t));
for(unsigned i=0; i<count; i++){ for(unsigned i=0; i<count; i++){
printf(" | [TimePropsList %u]\n", i+1); vita_printf(" | [TimePropsList %u]\n", i+1);
ReadTimePropsList(Motion.TimePropsLists[i]); ReadTimePropsList(Motion.TimePropsLists[i]);
} }
} }

View file

@ -17,19 +17,20 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadAppearance(Appearance_t& Appearance){ void ReadAppearance(Appearance_t& Appearance){
printf("\n========== Appearance ==========\n"); vita_printf("\n========== Appearance ==========\n");
Appearance.Version = VBFile.readint32(); Appearance.Version = VBFile.readint32();
printf("Version: %u\n", Appearance.Version); vita_printf("Version: %u\n", Appearance.Version);
ReadAsset(Appearance.Thumbnail, NOGROUP); ReadAsset(Appearance.Thumbnail, NOGROUP);
Appearance.BindingCount = VBFile.readint32(); Appearance.BindingCount = VBFile.readint32();
printf("Binding count: %u\n", Appearance.BindingCount); vita_printf("Binding count: %u\n", Appearance.BindingCount);
Appearance.Bindings = (Asset_t*) malloc(Appearance.BindingCount * sizeof(Asset_t)); Appearance.Bindings = (Asset_t*) malloc(Appearance.BindingCount * sizeof(Asset_t));
for(unsigned i=0; i<Appearance.BindingCount; i++){ for(unsigned i=0; i<Appearance.BindingCount; i++){
printf("\n [Binding %u]\n", i); vita_printf("\n [Binding %u]\n", i);
ReadAsset(Appearance.Bindings[i], NOGROUP); ReadAsset(Appearance.Bindings[i], NOGROUP);
} }
} }

View file

@ -17,24 +17,25 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadBinding(Binding_t& Binding){ void ReadBinding(Binding_t& Binding){
printf("\n========== Binding ==========\n"); vita_printf("\n========== Binding ==========\n");
Binding.Version = VBFile.readint32(); Binding.Version = VBFile.readint32();
printf("Version: %u\n", Binding.Version); vita_printf("Version: %u\n", Binding.Version);
Binding.BoneName = VBFile.readstring(); Binding.BoneName = VBFile.readstring();
printf("Bone name: %s\n", Binding.BoneName); vita_printf("Bone name: %s\n", Binding.BoneName);
Binding.MeshDef = VBFile.readint32(); Binding.MeshDef = VBFile.readint32();
if(Binding.MeshDef){ if(Binding.MeshDef){
printf("\n Mesh:\n"); vita_printf("\n Mesh:\n");
ReadAsset(Binding.Mesh, READGROUP); ReadAsset(Binding.Mesh, READGROUP);
} }
Binding.AppearanceDef = VBFile.readint32(); Binding.AppearanceDef = VBFile.readint32();
if(Binding.AppearanceDef){ if(Binding.AppearanceDef){
printf("\n Appearance:\n"); vita_printf("\n Appearance:\n");
ReadAsset(Binding.Appearance, READGROUP); ReadAsset(Binding.Appearance, READGROUP);
} }
} }

View file

@ -17,17 +17,18 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadCollection(Collection_t& Collection){ void ReadCollection(Collection_t& Collection){
printf("\n========== Collection ==========\n"); vita_printf("\n========== Collection ==========\n");
Collection.POCount = VBFile.readint32(); Collection.POCount = VBFile.readint32();
printf("Purchasable Outfit count: %u\n", Collection.POCount); vita_printf("Purchasable Outfit count: %u\n", Collection.POCount);
Collection.PurchasableOutfits = (PODef_t*) malloc(Collection.POCount * sizeof(PODef_t)); Collection.PurchasableOutfits = (PODef_t*) malloc(Collection.POCount * sizeof(PODef_t));
for(unsigned i=0; i<Collection.POCount; i++){ for(unsigned i=0; i<Collection.POCount; i++){
printf("\n [Purchasable Outfit %u]\n", i); vita_printf("\n [Purchasable Outfit %u]\n", i);
Collection.PurchasableOutfits[i].Index = VBFile.readint32(); Collection.PurchasableOutfits[i].Index = VBFile.readint32();
printf(" | Index: %u\n", Collection.PurchasableOutfits[i].Index); vita_printf(" | Index: %u\n", Collection.PurchasableOutfits[i].Index);
ReadAsset(Collection.PurchasableOutfits[i].PO, NOGROUP); ReadAsset(Collection.PurchasableOutfits[i].PO, NOGROUP);
} }
} }

View file

@ -5,7 +5,7 @@
/* Version number of package */ /* Version number of package */
#define VERSION_A 1 #define VERSION_A 1
#define VERSION_B 0 #define VERSION_B 1
#define VERSION_C 1 #define VERSION_C 0
#define VERSION_STR "1.0.1" #define VERSION_STR "1.1.0"
#define REVISION 0 #define REVISION 0

View file

@ -15,14 +15,15 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadHandGroup(HandGroup_t& HandGroup){ void ReadHandGroup(HandGroup_t& HandGroup){
printf("\n========== Hand Group ==========\n"); vita_printf("\n========== Hand Group ==========\n");
HandGroup.Version = VBFile.readint32(); HandGroup.Version = VBFile.readint32();
printf("Version: %u\n", HandGroup.Version); vita_printf("Version: %u\n", HandGroup.Version);
for(unsigned i=0; i<18; i++){ for(unsigned i=0; i<18; i++){
printf("\n [Purchasable Outfit %u]\n", i); vita_printf("\n [Purchasable Outfit %u]\n", i);
ReadAsset(HandGroup.HandAppearances[i], NOGROUP); ReadAsset(HandGroup.HandAppearances[i], NOGROUP);
} }
} }

View file

@ -18,32 +18,33 @@
#include <math.h> #include <math.h>
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
VBFile_t VBFile; VBFile_t VBFile;
void ReadAsset(Asset_t& Asset, bool ReadGroup){ void ReadAsset(Asset_t& Asset, bool ReadGroup){
Asset.Group = (ReadGroup) ? VBFile.readint32() : 0xA96F6D42; Asset.Group = (ReadGroup) ? VBFile.readint32() : 0xA96F6D42;
printf(" | Group: %u\n", Asset.Group); vita_printf(" | Group: %u\n", Asset.Group);
Asset.File = VBFile.readint32(); Asset.File = VBFile.readint32();
printf(" | File: %u\n", Asset.File); vita_printf(" | File: %u\n", Asset.File);
Asset.Type = VBFile.readint32(); Asset.Type = VBFile.readint32();
printf(" | Type: %u\n", Asset.Type); vita_printf(" | Type: %u\n", Asset.Type);
} }
void ReadPropEntry(KeyValuePair_t& Entry){ void ReadPropEntry(KeyValuePair_t& Entry){
Entry.Key = VBFile.readstring(); Entry.Key = VBFile.readstring();
printf(" | | | | | Key: %s\n", Entry.Key); vita_printf(" | | | | | Key: %s\n", Entry.Key);
Entry.Value = VBFile.readstring(); Entry.Value = VBFile.readstring();
printf(" | | | | | Value: %s\n", Entry.Value); vita_printf(" | | | | | Value: %s\n", Entry.Value);
} }
void ReadPropEntries(Prop_t& Prop){ void ReadPropEntries(Prop_t& Prop){
unsigned count = Prop.EntriesCount = VBFile.readint32(); unsigned count = Prop.EntriesCount = VBFile.readint32();
printf(" | | | | EntriesCount: %u\n", Prop.EntriesCount); vita_printf(" | | | | EntriesCount: %u\n", Prop.EntriesCount);
Prop.Entries = (KeyValuePair_t*) malloc(count * sizeof(KeyValuePair_t)); Prop.Entries = (KeyValuePair_t*) malloc(count * sizeof(KeyValuePair_t));
for(unsigned i=0; i<count; i++){ for(unsigned i=0; i<count; i++){
printf(" | | | | [Entry %u]\n", i+1); vita_printf(" | | | | [Entry %u]\n", i+1);
ReadPropEntry(Prop.Entries[i]); ReadPropEntry(Prop.Entries[i]);
} }
} }

View file

@ -104,6 +104,7 @@ class VBFile_t {
} }
}; };
//TODO-jip: does not work when shared library on windows
extern VBFile_t VBFile; extern VBFile_t VBFile;
/**** /****

View file

@ -17,22 +17,23 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadMesh(Mesh_t& Mesh){ void ReadMesh(Mesh_t& Mesh){
printf("\n========== Mesh ==========\n"); vita_printf("\n========== Mesh ==========\n");
Mesh.Version = VBFile.readint32(); Mesh.Version = VBFile.readint32();
printf("Version: %u\n", Mesh.Version); vita_printf("Version: %u\n", Mesh.Version);
Mesh.BoneCount = VBFile.readint32(); Mesh.BoneCount = VBFile.readint32();
printf("BoneCount: %u\n", Mesh.BoneCount); vita_printf("BoneCount: %u\n", Mesh.BoneCount);
Mesh.BoneNames = (char**) malloc(Mesh.BoneCount * sizeof(char*)); Mesh.BoneNames = (char**) malloc(Mesh.BoneCount * sizeof(char*));
for(unsigned i=0; i<Mesh.BoneCount; i++){ for(unsigned i=0; i<Mesh.BoneCount; i++){
Mesh.BoneNames[i] = VBFile.readstring(); Mesh.BoneNames[i] = VBFile.readstring();
printf("| Bone %u: %s\n", i+1, Mesh.BoneNames[i]); vita_printf("| Bone %u: %s\n", i+1, Mesh.BoneNames[i]);
} }
Mesh.FaceCount = VBFile.readint32(); Mesh.FaceCount = VBFile.readint32();
printf("FaceCount: %u\n", Mesh.FaceCount); vita_printf("FaceCount: %u\n", Mesh.FaceCount);
Mesh.FaceData = (Face_t*) malloc(Mesh.FaceCount * sizeof(Face_t)); Mesh.FaceData = (Face_t*) malloc(Mesh.FaceCount * sizeof(Face_t));
for(unsigned i=0; i<Mesh.FaceCount; i++){ for(unsigned i=0; i<Mesh.FaceCount; i++){
Mesh.FaceData[i].VertexA = VBFile.readint32(); Mesh.FaceData[i].VertexA = VBFile.readint32();
@ -42,7 +43,7 @@ void ReadMesh(Mesh_t& Mesh){
Mesh.BindingCount = VBFile.readint32(); Mesh.BindingCount = VBFile.readint32();
Mesh.BoneBindings = (BoneBinding_t*) malloc(Mesh.BindingCount * sizeof(BoneBinding_t)); Mesh.BoneBindings = (BoneBinding_t*) malloc(Mesh.BindingCount * sizeof(BoneBinding_t));
printf("BindingCount: %u\n", Mesh.BindingCount); vita_printf("BindingCount: %u\n", Mesh.BindingCount);
for(unsigned i=0; i<Mesh.BindingCount; i++){ for(unsigned i=0; i<Mesh.BindingCount; i++){
Mesh.BoneBindings[i].BoneIndex = VBFile.readint32(); Mesh.BoneBindings[i].BoneIndex = VBFile.readint32();
Mesh.BoneBindings[i].FirstRealVertex = VBFile.readint32(); Mesh.BoneBindings[i].FirstRealVertex = VBFile.readint32();
@ -52,7 +53,7 @@ void ReadMesh(Mesh_t& Mesh){
} }
Mesh.RealVertexCount = VBFile.readint32(); Mesh.RealVertexCount = VBFile.readint32();
printf("RealVertexCount: %u\n", Mesh.RealVertexCount); vita_printf("RealVertexCount: %u\n", Mesh.RealVertexCount);
TextureVertex_t * TextureVertexData = (TextureVertex_t*) malloc(Mesh.RealVertexCount * sizeof(TextureVertex_t)); TextureVertex_t * TextureVertexData = (TextureVertex_t*) malloc(Mesh.RealVertexCount * sizeof(TextureVertex_t));
for(unsigned i=0; i<Mesh.RealVertexCount; i++){ for(unsigned i=0; i<Mesh.RealVertexCount; i++){
TextureVertexData[i].u = VBFile.readfloat(); TextureVertexData[i].u = VBFile.readfloat();
@ -60,7 +61,7 @@ void ReadMesh(Mesh_t& Mesh){
} }
Mesh.BlendVertexCount = VBFile.readint32(); Mesh.BlendVertexCount = VBFile.readint32();
printf("BlendVertexCount: %u\n", Mesh.BlendVertexCount); vita_printf("BlendVertexCount: %u\n", Mesh.BlendVertexCount);
BlendData_t * BlendData = (BlendData_t*) malloc(Mesh.BlendVertexCount * sizeof(BlendData_t)); BlendData_t * BlendData = (BlendData_t*) malloc(Mesh.BlendVertexCount * sizeof(BlendData_t));
for(unsigned i=0; i<Mesh.BlendVertexCount; i++){ for(unsigned i=0; i<Mesh.BlendVertexCount; i++){
BlendData[i].Weight = (float)VBFile.readint32()/0x8000; BlendData[i].Weight = (float)VBFile.readint32()/0x8000;
@ -68,7 +69,7 @@ void ReadMesh(Mesh_t& Mesh){
} }
Mesh.TotalVertexCount = VBFile.readint32(); Mesh.TotalVertexCount = VBFile.readint32();
printf("TotalVertexCount: %u\n", Mesh.TotalVertexCount); vita_printf("TotalVertexCount: %u\n", Mesh.TotalVertexCount);
Mesh.VertexData = (Vertex_t*) malloc(Mesh.TotalVertexCount * sizeof(Vertex_t)); Mesh.VertexData = (Vertex_t*) malloc(Mesh.TotalVertexCount * sizeof(Vertex_t));
Mesh.TransformedVertexData = (Vertex_t*) malloc(Mesh.TotalVertexCount * sizeof(Vertex_t)); Mesh.TransformedVertexData = (Vertex_t*) malloc(Mesh.TotalVertexCount * sizeof(Vertex_t));
for(unsigned i=0; i<Mesh.TotalVertexCount; i++){ for(unsigned i=0; i<Mesh.TotalVertexCount; i++){

View file

@ -17,23 +17,24 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadOutfit(Outfit_t& Outfit){ void ReadOutfit(Outfit_t& Outfit){
printf("\n========== Outfit ==========\n"); vita_printf("\n========== Outfit ==========\n");
Outfit.Version = VBFile.readint32(); Outfit.Version = VBFile.readint32();
printf("Version: %u\n", Outfit.Version); vita_printf("Version: %u\n", Outfit.Version);
Outfit.Unknown = VBFile.readint32(); Outfit.Unknown = VBFile.readint32();
printf("Unknown: %u\n", Outfit.Unknown); vita_printf("Unknown: %u\n", Outfit.Unknown);
const char* Colors[] = {"Light", "Medium", "Dark"}; const char* Colors[] = {"Light", "Medium", "Dark"};
for(unsigned i=0; i<3; i++){ for(unsigned i=0; i<3; i++){
printf("\n [%s Appearance]\n", Colors[i]); vita_printf("\n [%s Appearance]\n", Colors[i]);
ReadAsset(Outfit.Appearance[i], NOGROUP); ReadAsset(Outfit.Appearance[i], NOGROUP);
} }
Outfit.Group = VBFile.readint32(); Outfit.Group = VBFile.readint32();
printf("Group: %u\n", Outfit.Group); vita_printf("Group: %u\n", Outfit.Group);
Outfit.Region = VBFile.readint32(); Outfit.Region = VBFile.readint32();
printf("Region: %u\n", Outfit.Region); vita_printf("Region: %u\n", Outfit.Region);
} }

View file

@ -17,24 +17,25 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadPurchasableOutfit(PurchasableOutfit_t& PurchasableOutfit){ void ReadPurchasableOutfit(PurchasableOutfit_t& PurchasableOutfit){
printf("\n========== Purchasable Outfit ==========\n"); vita_printf("\n========== Purchasable Outfit ==========\n");
PurchasableOutfit.Version = VBFile.readint32(); PurchasableOutfit.Version = VBFile.readint32();
printf("Version: %u\n", PurchasableOutfit.Version); vita_printf("Version: %u\n", PurchasableOutfit.Version);
PurchasableOutfit.Unknown = VBFile.readint32(); PurchasableOutfit.Unknown = VBFile.readint32();
printf("Unknown: %u\n", PurchasableOutfit.Unknown); vita_printf("Unknown: %u\n", PurchasableOutfit.Unknown);
PurchasableOutfit.OutfitDef = VBFile.readint32(); PurchasableOutfit.OutfitDef = VBFile.readint32();
if(PurchasableOutfit.OutfitDef){ if(PurchasableOutfit.OutfitDef){
printf("\n Outfit:\n"); vita_printf("\n Outfit:\n");
ReadAsset(PurchasableOutfit.Outfit, READGROUP); ReadAsset(PurchasableOutfit.Outfit, READGROUP);
} }
PurchasableOutfit.CollectionDef = VBFile.readint32(); PurchasableOutfit.CollectionDef = VBFile.readint32();
if(PurchasableOutfit.CollectionDef){ if(PurchasableOutfit.CollectionDef){
printf("\n Collection:\n"); vita_printf("\n Collection:\n");
ReadAsset(PurchasableOutfit.Collection, READGROUP); ReadAsset(PurchasableOutfit.Collection, READGROUP);
} }
} }

View file

@ -17,65 +17,66 @@
*/ */
#include "libvitaboy.hpp" #include "libvitaboy.hpp"
#include "Log.hpp"
void ReadSkeleton(Skeleton_t& Skeleton){ void ReadSkeleton(Skeleton_t& Skeleton){
printf("\n========== Skeleton ==========\n"); vita_printf("\n========== Skeleton ==========\n");
Skeleton.Version = VBFile.readint32(); Skeleton.Version = VBFile.readint32();
printf("Version: %u\n", Skeleton.Version); vita_printf("Version: %u\n", Skeleton.Version);
Skeleton.Name = VBFile.readstring(); Skeleton.Name = VBFile.readstring();
printf("Name: %s\n", Skeleton.Name); vita_printf("Name: %s\n", Skeleton.Name);
Skeleton.BoneCount = VBFile.readint16(); Skeleton.BoneCount = VBFile.readint16();
printf("BoneCount: %u\n", Skeleton.BoneCount); vita_printf("BoneCount: %u\n", Skeleton.BoneCount);
Skeleton.Bones = (Bone_t*) malloc(Skeleton.BoneCount * sizeof(Bone_t)); Skeleton.Bones = (Bone_t*) malloc(Skeleton.BoneCount * sizeof(Bone_t));
for(unsigned i=0; i<Skeleton.BoneCount; i++){ for(unsigned i=0; i<Skeleton.BoneCount; i++){
printf("\n [Bone %u]\n", i); vita_printf("\n [Bone %u]\n", i);
ReadBone(Skeleton, Skeleton.Bones[i], i); ReadBone(Skeleton, Skeleton.Bones[i], i);
} }
} }
void ReadBone(Skeleton_t& Skeleton, Bone_t& Bone, unsigned Index){ void ReadBone(Skeleton_t& Skeleton, Bone_t& Bone, unsigned Index){
Bone.Unknown = VBFile.readint32(); Bone.Unknown = VBFile.readint32();
printf(" | Unknown: %u\n", Bone.Unknown); vita_printf(" | Unknown: %u\n", Bone.Unknown);
Bone.Name = VBFile.readstring(); Bone.Name = VBFile.readstring();
printf(" | Name: %s\n", Bone.Name); vita_printf(" | Name: %s\n", Bone.Name);
Bone.ParentsName = VBFile.readstring(); Bone.ParentsName = VBFile.readstring();
printf(" | Parent's name: %s\n", Bone.ParentsName); vita_printf(" | Parent's name: %s\n", Bone.ParentsName);
Bone.HasProps = VBFile.readint8(); Bone.HasProps = VBFile.readint8();
printf(" | HasProps: %u\n", Bone.HasProps); vita_printf(" | HasProps: %u\n", Bone.HasProps);
if(Bone.HasProps){ if(Bone.HasProps){
ReadPropsList(Bone.PropsList); ReadPropsList(Bone.PropsList);
} }
printf(" | Translation:\n"); vita_printf(" | Translation:\n");
Bone.Translation.x = -VBFile.readfloat(); Bone.Translation.x = -VBFile.readfloat();
printf(" | | x: %g\n", Bone.Translation.x); vita_printf(" | | x: %g\n", Bone.Translation.x);
Bone.Translation.y = VBFile.readfloat(); Bone.Translation.y = VBFile.readfloat();
printf(" | | y: %g\n", Bone.Translation.y); vita_printf(" | | y: %g\n", Bone.Translation.y);
Bone.Translation.z = VBFile.readfloat(); Bone.Translation.z = VBFile.readfloat();
printf(" | | z: %g\n", Bone.Translation.z); vita_printf(" | | z: %g\n", Bone.Translation.z);
printf(" | Rotation:\n"); vita_printf(" | Rotation:\n");
Bone.Rotation.x = VBFile.readfloat(); Bone.Rotation.x = VBFile.readfloat();
printf(" | | x: %g\n", Bone.Rotation.x); vita_printf(" | | x: %g\n", Bone.Rotation.x);
Bone.Rotation.y = -VBFile.readfloat(); Bone.Rotation.y = -VBFile.readfloat();
printf(" | | y: %g\n", Bone.Rotation.y); vita_printf(" | | y: %g\n", Bone.Rotation.y);
Bone.Rotation.z = -VBFile.readfloat(); Bone.Rotation.z = -VBFile.readfloat();
printf(" | | z: %g\n", Bone.Rotation.z); vita_printf(" | | z: %g\n", Bone.Rotation.z);
Bone.Rotation.w = VBFile.readfloat(); Bone.Rotation.w = VBFile.readfloat();
printf(" | | w: %g\n", Bone.Rotation.w); vita_printf(" | | w: %g\n", Bone.Rotation.w);
Bone.CanTranslate = VBFile.readint32(); Bone.CanTranslate = VBFile.readint32();
printf(" | CanTranslate: %u\n", Bone.CanTranslate); vita_printf(" | CanTranslate: %u\n", Bone.CanTranslate);
Bone.CanRotate = VBFile.readint32(); Bone.CanRotate = VBFile.readint32();
printf(" | CanRotate: %u\n", Bone.CanRotate); vita_printf(" | CanRotate: %u\n", Bone.CanRotate);
Bone.CanBlend = VBFile.readint32(); Bone.CanBlend = VBFile.readint32();
printf(" | CanBlend: %u\n", Bone.CanBlend); vita_printf(" | CanBlend: %u\n", Bone.CanBlend);
Bone.WiggleValue = VBFile.readfloat(); Bone.WiggleValue = VBFile.readfloat();
printf(" | WiggleValue: %g\n", Bone.WiggleValue); vita_printf(" | WiggleValue: %g\n", Bone.WiggleValue);
Bone.WigglePower = VBFile.readfloat(); Bone.WigglePower = VBFile.readfloat();
printf(" | WigglePower: %g\n", Bone.WigglePower); vita_printf(" | WigglePower: %g\n", Bone.WigglePower);
Bone.ChildrenCount = 0; Bone.ChildrenCount = 0;
Bone.Children = (Bone_t**) malloc((Skeleton.BoneCount-Index-1) * sizeof(Bone_t*)); Bone.Children = (Bone_t**) malloc((Skeleton.BoneCount-Index-1) * sizeof(Bone_t*));