From f23bcd7b4d28683a242f912adc74f3aad242aa95 Mon Sep 17 00:00:00 2001 From: Fatbag Date: Mon, 27 Feb 2012 02:55:53 -0600 Subject: [PATCH] Added libjpeg-turbo to FileHandler with a working File::ReadImageFile() function. The dependency on SOIL in libvitaboy Renderer has therefore been removed. Also fixed formatting in recent source files. My next task is implementing IFF chunk reading. I'll also make a tool that can convert the game's behavior.iff file to an HTML page. --- Libraries/FileHandler/CMakeLists.txt | 4 +- Libraries/FileHandler/File.cpp | 17 +- Libraries/FileHandler/FileHandler.hpp | 38 +++- Libraries/FileHandler/Image.cpp | 95 +++++++++ Libraries/libvitaboy/CMakeLists.txt | 10 +- Libraries/libvitaboy/Renderer.cpp | 90 +++++---- Libraries/libvitaboy/apr.cpp | 33 +++ Libraries/libvitaboy/bnd.cpp | 38 ++++ Libraries/libvitaboy/col.cpp | 31 +++ Libraries/libvitaboy/hag.cpp | 28 +++ Libraries/libvitaboy/libvitaboy.cpp | 11 +- Libraries/libvitaboy/libvitaboy.hpp | 140 +++++++++++-- Libraries/libvitaboy/mesh.cpp | 14 +- Libraries/libvitaboy/oft.cpp | 37 ++++ Libraries/libvitaboy/po.cpp | 38 ++++ Libraries/libvitaboy/skel.cpp | 192 +++++++++--------- Libraries/libvitaboy/vbparse.cpp | 279 ++++++++++++++------------ Server/NiotsoServer.cpp | 16 ++ 18 files changed, 816 insertions(+), 295 deletions(-) create mode 100644 Libraries/FileHandler/Image.cpp create mode 100644 Libraries/libvitaboy/apr.cpp create mode 100644 Libraries/libvitaboy/bnd.cpp create mode 100644 Libraries/libvitaboy/col.cpp create mode 100644 Libraries/libvitaboy/hag.cpp create mode 100644 Libraries/libvitaboy/oft.cpp create mode 100644 Libraries/libvitaboy/po.cpp create mode 100644 Server/NiotsoServer.cpp diff --git a/Libraries/FileHandler/CMakeLists.txt b/Libraries/FileHandler/CMakeLists.txt index cacf089..8b9132f 100644 --- a/Libraries/FileHandler/CMakeLists.txt +++ b/Libraries/FileHandler/CMakeLists.txt @@ -3,6 +3,7 @@ project(FileHandler) add_subdirectory(libexpat) add_subdirectory(libfar) +add_subdirectory(libjpeg-turbo) add_subdirectory(libpng) add_subdirectory(utk) add_subdirectory(xa) @@ -14,6 +15,7 @@ set(FILEHANDLER_MINOR 0) set(FILEHANDLER_SOURCES File.cpp + Image.cpp ) include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) @@ -32,4 +34,4 @@ set_target_properties(FileHandler_shared PROPERTIES PREFIX "" IMPORT_PREFIX "" CLEAN_DIRECT_OUTPUT 1) -target_link_libraries(FileHandler_shared kernel32) \ No newline at end of file +target_link_libraries(FileHandler_shared kernel32 jpegturbo_static) \ No newline at end of file diff --git a/Libraries/FileHandler/File.cpp b/Libraries/FileHandler/File.cpp index d8eaf9e..81dcdd4 100644 --- a/Libraries/FileHandler/File.cpp +++ b/Libraries/FileHandler/File.cpp @@ -1,5 +1,5 @@ /* - libvitaboy - Copyright (c) 2012 Fatbag + FileHandler - Copyright (c) 2012 Fatbag Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -14,8 +14,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include #include "FileHandler.hpp" namespace File { @@ -23,20 +21,27 @@ namespace File { int Error = 0; unsigned FileSize = 0; +const uint8_t Signature[][4] = { + {0xFF,0xD8,0xFF,0xE0} //JPEG +}; +const uint8_t SignatureSize[] = { + 4 //JPEG +}; + uint8_t * ReadFile(const char * Filename){ HANDLE hFile = CreateFile(Filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if(hFile == INVALID_HANDLE_VALUE){ File::Error = (GetLastError() == ERROR_FILE_NOT_FOUND) ? FERR_NOT_FOUND : FERR_OPEN; return NULL; } - + FileSize = GetFileSize(hFile, NULL); if(FileSize == 0){ CloseHandle(hFile); File::Error = FERR_BLANK; return NULL; } - + uint8_t * InData = (uint8_t*) malloc(FileSize); if(InData == NULL){ CloseHandle(hFile); @@ -47,7 +52,7 @@ uint8_t * ReadFile(const char * Filename){ DWORD bytestransferred; BOOL result = ::ReadFile(hFile, InData, FileSize, &bytestransferred, NULL); CloseHandle(hFile); - + if(!result || bytestransferred != FileSize){ free(InData); File::Error = FERR_READ; diff --git a/Libraries/FileHandler/FileHandler.hpp b/Libraries/FileHandler/FileHandler.hpp index 3e08470..b03a733 100644 --- a/Libraries/FileHandler/FileHandler.hpp +++ b/Libraries/FileHandler/FileHandler.hpp @@ -14,19 +14,51 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef FILEHANDLER_HPP +#define FILEHANDLER_HPP + +#include +#include +#include +#include +#ifndef NOWINDOWS + #include +#endif + +struct Asset_t { + uint32_t Group; + uint32_t File; + uint32_t Type; +}; + enum FErr { FERR_NOT_FOUND, FERR_OPEN, FERR_BLANK, FERR_MEMORY, - FERR_READ + FERR_READ, + FERR_UNRECOGNIZED +}; + +enum ImageFormat_t { + FIMG_BGR24 +}; + +struct Image_t { + unsigned Width, Height; + ImageFormat_t Format; + uint8_t * Data; }; namespace File { extern int Error; -extern unsigned FileSize; +extern size_t FileSize; uint8_t * ReadFile(const char * Filename); +Image_t * ReadImageFile(const char * Filename); +uint8_t * ReadJPG(Image_t * Image, const uint8_t * InData, size_t FileSize); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Libraries/FileHandler/Image.cpp b/Libraries/FileHandler/Image.cpp new file mode 100644 index 0000000..608bc92 --- /dev/null +++ b/Libraries/FileHandler/Image.cpp @@ -0,0 +1,95 @@ +/* + FileHandler - Copyright (c) 2012 Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include "libjpeg-turbo/jpeglib.h" +#define NOWINDOWS +#include "FileHandler.hpp" + +namespace File { + +Image_t * ReadImageFile(const char * Filename){ + uint8_t * InData = File::ReadFile(Filename); + if(InData == NULL) return NULL; + + Image_t * Image = (Image_t*) malloc(sizeof(Image_t)); + if(Image == NULL){ + free(InData); + return NULL; + } + + uint8_t * OutData = ReadJPG(Image, InData, File::FileSize); + + free(InData); + if(OutData != NULL){ + return Image; + } + + File::Error = FERR_UNRECOGNIZED; + free(Image); + return NULL; +} + +uint8_t * ReadJPG(Image_t * Image, const uint8_t * InData, size_t FileSize){ + //Initialize + jpeg_decompress_struct cinfo; + jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + jpeg_mem_src(&cinfo, (unsigned char*) InData, FileSize); + if(jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK){ + jpeg_destroy_decompress(&cinfo); + return NULL; + } + if(!jpeg_start_decompress(&cinfo)){ + jpeg_destroy_decompress(&cinfo); + return NULL; + } + + //Read + unsigned row_stride = cinfo.output_width * cinfo.output_components; + uint8_t * OutData = (uint8_t*) malloc(cinfo.output_width * cinfo.output_height * cinfo.output_components); + if(OutData == NULL){ + jpeg_finish_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); + return NULL; + } + for(unsigned i=0; cinfo.output_scanline < cinfo.output_height; i++){ + //According to the libjpeg documentation, + //jpeg_read_scanlines can only really read 1 scanline at a time. + uint8_t * Location = OutData + i*row_stride; + if(!jpeg_read_scanlines(&cinfo, &Location, 1)){ + free(OutData); + jpeg_finish_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); + return NULL; + } + } + + //Close up + jpeg_finish_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); + if(Image){ + Image->Width = cinfo.output_width; + Image->Height = cinfo.output_height; + Image->Format = FIMG_BGR24; + Image->Data = OutData; + } + return OutData; +} + +} \ No newline at end of file diff --git a/Libraries/libvitaboy/CMakeLists.txt b/Libraries/libvitaboy/CMakeLists.txt index d0b621f..5b8c209 100644 --- a/Libraries/libvitaboy/CMakeLists.txt +++ b/Libraries/libvitaboy/CMakeLists.txt @@ -7,8 +7,14 @@ set(LIBVITABOY_MINOR 1) set(LIBVITABOY_SOURCES anim.cpp + apr.cpp + bnd.cpp + col.cpp + hag.cpp libvitaboy.cpp mesh.cpp + oft.cpp + po.cpp skel.cpp ) if(WIN32) @@ -33,7 +39,7 @@ set_target_properties(libvitaboy_shared PROPERTIES CLEAN_DIRECT_OUTPUT 1) add_executable(vbparse vbparse.cpp) -target_link_libraries(vbparse libvitaboy_static) +target_link_libraries(vbparse libvitaboy_static FileHandler_shared) add_executable(Renderer Renderer.cpp) -target_link_libraries(Renderer libvitaboy_shared "${CMAKE_SOURCE_DIR}/Libraries/libvitaboy/libSOIL.a" FileHandler_shared opengl32 glu32 winmm) \ No newline at end of file +target_link_libraries(Renderer libvitaboy_shared FileHandler_shared opengl32 glu32 winmm) \ No newline at end of file diff --git a/Libraries/libvitaboy/Renderer.cpp b/Libraries/libvitaboy/Renderer.cpp index c205be0..7afd773 100644 --- a/Libraries/libvitaboy/Renderer.cpp +++ b/Libraries/libvitaboy/Renderer.cpp @@ -44,13 +44,11 @@ F11: Enter/leave fullscreen */ -#include #include #include #include #include #include -#include "SOIL.h" #include "libvitaboy.hpp" HDC hDC=NULL; @@ -72,7 +70,7 @@ CharacterPlacement_t Character = {{0,-3,0}, {0,0,0}}; Skeleton_t Skeleton; const unsigned TextureCount = 3; -GLuint texture[3]; +unsigned texture[3]; enum { Texture_Body, Texture_Head, Texture_Hand }; const char* const TexturePaths[] = {"body.jpg", "head.jpg", "hand.jpg"}; @@ -94,14 +92,47 @@ float FramePeriod; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -int LoadGLTextures() +void DisplayFileError(const char * Filename){ + const char * Message; + switch(File::Error){ + case FERR_NOT_FOUND: + Message = "%s does not exist."; + break; + case FERR_OPEN: + Message = "%s could not be opened for reading."; + break; + case FERR_BLANK: + case FERR_UNRECOGNIZED: + Message = "%s is corrupt or invalid."; + break; + case FERR_MEMORY: + Message = "Memory for %s could not be allocated."; + break; + default: + Message = "%s could not be read."; + break; + } + + char Buffer[1024]; + sprintf(Buffer, Message, Filename); + MessageBox(hWnd, Buffer, NULL, MB_OK | MB_ICONERROR); +} + +bool LoadTextures() { + glGenTextures(3, texture); for(int i=0; i<3; i++){ - texture[i] = SOIL_load_OGL_texture(TexturePaths[i], SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, 0); - if(texture[i] == 0) + Image_t * Image = File::ReadImageFile(TexturePaths[i]); + if(!Image){ + DisplayFileError(TexturePaths[i]); return false; + } glBindTexture(GL_TEXTURE_2D, texture[i]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, Image->Width, Image->Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Image->Data); + free(Image->Data); + free(Image); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); @@ -126,9 +157,9 @@ void ResizeScene(GLsizei width, GLsizei height) glLoadIdentity(); } -int InitGL() +bool InitGL() { - if(!LoadGLTextures()) + if(!LoadTextures()) return false; glShadeModel(GL_SMOOTH); @@ -170,7 +201,7 @@ void TransformVertices(Bone_t& Bone) unsigned VertexIndex = Mesh.BoneBindings[BoneIndex].FirstFixedVertex + i; Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex]; Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex]; - + glTranslatef(RelativeVertex.x, RelativeVertex.y, RelativeVertex.z); glGetFloatv(GL_MODELVIEW_MATRIX, Matrix); AbsoluteVertex.x = Matrix[12]; @@ -182,7 +213,7 @@ void TransformVertices(Bone_t& Bone) unsigned VertexIndex = Mesh.FixedVertexCount + Mesh.BoneBindings[BoneIndex].FirstBlendedVertex + i; Vertex_t& RelativeVertex = Mesh.VertexData[VertexIndex]; Vertex_t& AbsoluteVertex = Mesh.TransformedVertexData[VertexIndex]; - + glTranslatef(RelativeVertex.x, RelativeVertex.y, RelativeVertex.z); glGetFloatv(GL_MODELVIEW_MATRIX, Matrix); AbsoluteVertex.x = Matrix[12]; @@ -240,8 +271,10 @@ void DrawMeshes() for(unsigned i=0; i= Duration) AnimationTime -= Duration; - if(AnimationTime<0) AnimationTime = 0; + if(AnimationTime<0) AnimationTime = 0; //Safe-guard against rounding error for(unsigned i=0; i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadAppearance(Appearance_t& Appearance){ + printf("\n========== Appearance ==========\n"); + Appearance.Version = VBFile.readint32(); + printf("Version: %u\n", Appearance.Version); + + ReadAsset(Appearance.Thumbnail, NOGROUP); + + Appearance.BindingCount = VBFile.readint32(); + printf("Binding count: %u\n", Appearance.BindingCount); + Appearance.Bindings = (Asset_t*) malloc(Appearance.BindingCount * sizeof(Asset_t)); + for(unsigned i=0; i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadBinding(Binding_t& Binding){ + printf("\n========== Binding ==========\n"); + Binding.Version = VBFile.readint32(); + printf("Version: %u\n", Binding.Version); + + Binding.BoneName = VBFile.readstring(); + printf("Bone name: %s\n", Binding.BoneName); + + Binding.MeshDef = VBFile.readint32(); + if(Binding.MeshDef){ + printf("\n Mesh:\n"); + ReadAsset(Binding.Mesh, READGROUP); + } + + Binding.AppearanceDef = VBFile.readint32(); + if(Binding.AppearanceDef){ + printf("\n Appearance:\n"); + ReadAsset(Binding.Appearance, READGROUP); + } +} \ No newline at end of file diff --git a/Libraries/libvitaboy/col.cpp b/Libraries/libvitaboy/col.cpp new file mode 100644 index 0000000..f9d40c0 --- /dev/null +++ b/Libraries/libvitaboy/col.cpp @@ -0,0 +1,31 @@ +/* + libvitaboy - Copyright (c) 2012 Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadCollection(Collection_t& Collection){ + printf("\n========== Collection ==========\n"); + Collection.POCount = VBFile.readint32(); + printf("Purchasable Outfit count: %u\n", Collection.POCount); + Collection.PurchasableOutfits = (PODef_t*) malloc(Collection.POCount * sizeof(PODef_t)); + for(unsigned i=0; i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadHandGroup(HandGroup_t& HandGroup){ + printf("\n========== Hand Group ==========\n"); + HandGroup.Version = VBFile.readint32(); + printf("Version: %u\n", HandGroup.Version); + + for(unsigned i=0; i<18; i++){ + printf("\n [Purchasable Outfit %u]\n", i); + ReadAsset(HandGroup.HandAppearances[i], NOGROUP); + } +} \ No newline at end of file diff --git a/Libraries/libvitaboy/libvitaboy.cpp b/Libraries/libvitaboy/libvitaboy.cpp index 1bbe5d2..c729cc1 100644 --- a/Libraries/libvitaboy/libvitaboy.cpp +++ b/Libraries/libvitaboy/libvitaboy.cpp @@ -18,6 +18,15 @@ VBFile_t VBFile; +void ReadAsset(Asset_t& Asset, bool ReadGroup){ + Asset.Group = (ReadGroup) ? VBFile.readint32() : 0xA96F6D42; + printf(" | Group: %u\n", Asset.Group); + Asset.File = VBFile.readint32(); + printf(" | File: %u\n", Asset.File); + Asset.Type = VBFile.readint32(); + printf(" | Type: %u\n", Asset.Type); +} + void ReadPropEntry(KeyValuePair_t& Entry){ Entry.Key = VBFile.readstring(); printf(" | | | | | Key: %s\n", Entry.Key); @@ -29,7 +38,7 @@ void ReadPropEntries(Prop_t& Prop){ unsigned count = Prop.EntriesCount = VBFile.readint32(); printf(" | | | | EntriesCount: %u\n", Prop.EntriesCount); Prop.Entries = (KeyValuePair_t*) malloc(count * sizeof(KeyValuePair_t)); - + for(unsigned i=0; i #include #include #include #include +#include class VBFile_t { private: const uint8_t *Buffer, *Position; unsigned Size; - + public: inline void set(const void *_Buffer, unsigned _Size){ Buffer = (const uint8_t*) _Buffer; Position = (const uint8_t*) _Buffer; Size = _Size; } - + inline unsigned getpos(){ return Position-Buffer; } - + inline void seekto(unsigned offset){ Position = Buffer+offset; } - + inline uint32_t readint32(){ uint32_t value = (uint32_t)((Position[0]<<(8*3)) | (Position[1]<<(8*2)) | (Position[2]<<(8*1)) | (Position[3]<<(8*0))); Position += 4; return value; } - + inline uint32_t readint16(){ uint16_t value = (uint16_t)((Position[0]<<(8*1)) | (Position[1]<<(8*0))); Position += 2; return value; } - + inline uint32_t readint8(){ uint8_t value = (uint8_t)((Position[0]<<(8*0))); Position += 1; return value; } - + inline float readfloat(){ //Obviously a platform-dependent implementation float value; @@ -65,12 +69,12 @@ class VBFile_t { Position += 4; return value; } - + inline void readbytes(void* Destination, unsigned length){ memcpy(Destination, Position, length); Position += length; } - + inline char* readstring(){ //Read a Pascal string with 1 length byte unsigned length = readint8(); @@ -79,7 +83,7 @@ class VBFile_t { string[length] = '\0'; return string; } - + inline char* readstring2(){ //Read a Pascal string with 2 length bytes unsigned length = readint16(); @@ -96,6 +100,11 @@ extern VBFile_t VBFile; ** Common */ +enum ReadGroup { + NOGROUP, + READGROUP +}; + struct Translation_t { float x, y, z; }; @@ -119,6 +128,7 @@ struct PropsList_t { Prop_t * Props; }; +void ReadAsset(Asset_t& Asset, bool ReadGroup); void ReadPropEntry(KeyValuePair_t& Entry); void ReadPropEntries(Prop_t& Prop); void ReadPropsList(PropsList_t& PropsList); @@ -145,7 +155,7 @@ struct Motion_t { uint32_t Unknown; char * BoneName; uint32_t FrameCount; - float Duration; + float Duration; //Converted to seconds uint8_t HasTranslation; uint8_t HasRotation; uint32_t FirstTranslation; @@ -165,7 +175,7 @@ struct Motion_t { struct Animation_t { uint32_t Version; char * Name; - float Duration; + float Duration; //Converted to seconds float Distance; uint8_t IsMoving; uint32_t TranslationsCount; @@ -185,6 +195,64 @@ void ReadTimePropsList(TimePropsList_t& TimePropsList); void ReadTimePropsLists(Motion_t& Motion); +/**** +** Appearance (*.apr) +*/ + +struct Appearance_t { + uint32_t Version; + Asset_t Thumbnail; + uint32_t BindingCount; + Asset_t * Bindings; +}; + +void ReadAppearance(Appearance_t& Appearance); + +/**** +** Binding (*.bnd) +*/ + +struct Binding_t { + uint32_t Version; + char * BoneName; + uint32_t MeshDef; + Asset_t Mesh; + uint32_t AppearanceDef; + Asset_t Appearance; +}; + +void ReadBinding(Binding_t& Binding); + + +/**** +** Collection (*.col) +*/ + +struct PODef_t { + uint32_t Index; + Asset_t PO; +}; + +struct Collection_t { + uint32_t POCount; + PODef_t * PurchasableOutfits; +}; + +void ReadCollection(Collection_t& Collection); + + +/**** +** Hand Group (*.hag) +*/ + +struct HandGroup_t { + uint32_t Version; + Asset_t HandAppearances[18]; +}; + +void ReadHandGroup(HandGroup_t& HandGroup); + + /**** ** Mesh (*.mesh) */ @@ -237,6 +305,48 @@ struct Mesh_t { void ReadMesh(Mesh_t& Mesh); +/**** +** Outfit (*.oft) +*/ + +enum OutfitColor { + OutfitColor_Light, + OutfitColor_Medium, + OutfitColor_Dark +}; + +enum OutfitRegion { + OutfitRegion_Head = 0, + OutfitRegion_Body = 18 +}; + +struct Outfit_t { + uint32_t Version; + uint32_t Unknown; + Asset_t Appearance[3]; + uint32_t Group; + uint32_t Region; +}; + +void ReadOutfit(Outfit_t& Outfit); + + +/**** +** Purchasable Outfit (*.po) +*/ + +struct PurchasableOutfit_t { + uint32_t Version; + uint32_t Unknown; + uint32_t OutfitDef; + Asset_t Outfit; + uint32_t CollectionDef; + Asset_t Collection; +}; + +void ReadPurchasableOutfit(PurchasableOutfit_t& PurchasableOutfit); + + /**** ** Skeleton (*.skel) */ @@ -254,7 +364,7 @@ struct Bone_t { uint32_t CanBlend; float WiggleValue; float WigglePower; - + unsigned ChildrenCount; Bone_t ** Children; }; @@ -268,4 +378,6 @@ struct Skeleton_t { void ReadSkeleton(Skeleton_t& Bone); void ReadBone(Skeleton_t& Skeleton, Bone_t& Bone, unsigned Index); -unsigned FindBone(Skeleton_t& Skeleton, const char * BoneName, unsigned Count); \ No newline at end of file +unsigned FindBone(Skeleton_t& Skeleton, const char * BoneName, unsigned Count); + +#endif \ No newline at end of file diff --git a/Libraries/libvitaboy/mesh.cpp b/Libraries/libvitaboy/mesh.cpp index 74226a6..ad31c93 100644 --- a/Libraries/libvitaboy/mesh.cpp +++ b/Libraries/libvitaboy/mesh.cpp @@ -20,7 +20,7 @@ void ReadMesh(Mesh_t& Mesh){ printf("\n========== Mesh ==========\n"); Mesh.Version = VBFile.readint32(); printf("Version: %u\n", Mesh.Version); - + Mesh.BoneCount = VBFile.readint32(); printf("BoneCount: %u\n", Mesh.BoneCount); Mesh.BoneNames = (char**) malloc(Mesh.BoneCount * sizeof(char*)); @@ -28,7 +28,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.BoneNames[i] = VBFile.readstring(); printf("| Bone %u: %s\n", i+1, Mesh.BoneNames[i]); } - + Mesh.FaceCount = VBFile.readint32(); printf("FaceCount: %u\n", Mesh.FaceCount); Mesh.FaceData = (Face_t*) malloc(Mesh.FaceCount * sizeof(Face_t)); @@ -37,7 +37,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.FaceData[i].VertexB = VBFile.readint32(); Mesh.FaceData[i].VertexC = VBFile.readint32(); } - + Mesh.BindingCount = VBFile.readint32(); Mesh.BoneBindings = (BoneBinding_t*) malloc(Mesh.BindingCount * sizeof(BoneBinding_t)); printf("BindingCount: %u\n", Mesh.BindingCount); @@ -48,7 +48,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.BoneBindings[i].FirstBlendedVertex = VBFile.readint32(); Mesh.BoneBindings[i].BlendedVertexCount = VBFile.readint32(); } - + Mesh.FixedVertexCount = VBFile.readint32(); printf("FixedVertexCount: %u\n", Mesh.FixedVertexCount); Mesh.TextureVertexData = (TextureVertex_t*) malloc(Mesh.FixedVertexCount * sizeof(TextureVertex_t)); @@ -56,7 +56,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.TextureVertexData[i].u = VBFile.readfloat(); Mesh.TextureVertexData[i].v = VBFile.readfloat(); } - + Mesh.BlendedVertexCount = VBFile.readint32(); printf("BlendedVertexCount: %u\n", Mesh.BlendedVertexCount); Mesh.BlendData = (BlendData_t*) malloc(Mesh.BlendedVertexCount * sizeof(BlendData_t)); @@ -64,7 +64,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.BlendData[i].Weight = (float)VBFile.readint32()/0x8000; Mesh.BlendData[i].OtherVertex = VBFile.readint32(); } - + Mesh.TotalVertexCount = VBFile.readint32(); printf("TotalVertexCount: %u\n", Mesh.TotalVertexCount); Mesh.VertexData = (Vertex_t*) malloc(Mesh.TotalVertexCount * sizeof(Vertex_t)); @@ -79,7 +79,7 @@ void ReadMesh(Mesh_t& Mesh){ Mesh.VertexNorms[i].x = VBFile.readfloat(); Mesh.VertexNorms[i].y = VBFile.readfloat(); Mesh.VertexNorms[i].z = VBFile.readfloat(); - + if(i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadOutfit(Outfit_t& Outfit){ + printf("\n========== Outfit ==========\n"); + Outfit.Version = VBFile.readint32(); + printf("Version: %u\n", Outfit.Version); + + Outfit.Unknown = VBFile.readint32(); + printf("Unknown: %u\n", Outfit.Unknown); + + const char* Colors[] = {"Light", "Medium", "Dark"}; + for(unsigned i=0; i<3; i++){ + printf("\n [%s Appearance]\n", Colors[i]); + ReadAsset(Outfit.Appearance[i], NOGROUP); + } + + Outfit.Group = VBFile.readint32(); + printf("Group: %u\n", Outfit.Group); + Outfit.Region = VBFile.readint32(); + printf("Region: %u\n", Outfit.Region); +} \ No newline at end of file diff --git a/Libraries/libvitaboy/po.cpp b/Libraries/libvitaboy/po.cpp new file mode 100644 index 0000000..5381456 --- /dev/null +++ b/Libraries/libvitaboy/po.cpp @@ -0,0 +1,38 @@ +/* + libvitaboy - Copyright (c) 2012 Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadPurchasableOutfit(PurchasableOutfit_t& PurchasableOutfit){ + printf("\n========== Purchasable Outfit ==========\n"); + PurchasableOutfit.Version = VBFile.readint32(); + printf("Version: %u\n", PurchasableOutfit.Version); + + PurchasableOutfit.Unknown = VBFile.readint32(); + printf("Unknown: %u\n", PurchasableOutfit.Unknown); + + PurchasableOutfit.OutfitDef = VBFile.readint32(); + if(PurchasableOutfit.OutfitDef){ + printf("\n Outfit:\n"); + ReadAsset(PurchasableOutfit.Outfit, READGROUP); + } + + PurchasableOutfit.CollectionDef = VBFile.readint32(); + if(PurchasableOutfit.CollectionDef){ + printf("\n Collection:\n"); + ReadAsset(PurchasableOutfit.Collection, READGROUP); + } +} \ No newline at end of file diff --git a/Libraries/libvitaboy/skel.cpp b/Libraries/libvitaboy/skel.cpp index 4eb0431..beade7f 100644 --- a/Libraries/libvitaboy/skel.cpp +++ b/Libraries/libvitaboy/skel.cpp @@ -1,99 +1,95 @@ -/* - libvitaboy - Copyright (c) 2012 Fatbag - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "libvitaboy.hpp" - -static unsigned bonenumber = 0; - -void ReadSkeleton(Skeleton_t& Skeleton){ - printf("\n========== Skeleton ==========\n"); - Skeleton.Version = VBFile.readint32(); - printf("Version: %u\n", Skeleton.Version); - Skeleton.Name = VBFile.readstring(); - printf("Name: %s\n", Skeleton.Name); - - Skeleton.BoneCount = VBFile.readint16(); - printf("BoneCount: %u\n", Skeleton.BoneCount); - Skeleton.Bones = (Bone_t*) malloc(Skeleton.BoneCount * sizeof(Bone_t)); - for(unsigned i=0; i + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "libvitaboy.hpp" + +void ReadSkeleton(Skeleton_t& Skeleton){ + printf("\n========== Skeleton ==========\n"); + Skeleton.Version = VBFile.readint32(); + printf("Version: %u\n", Skeleton.Version); + Skeleton.Name = VBFile.readstring(); + printf("Name: %s\n", Skeleton.Name); + + Skeleton.BoneCount = VBFile.readint16(); + printf("BoneCount: %u\n", Skeleton.BoneCount); + Skeleton.Bones = (Bone_t*) malloc(Skeleton.BoneCount * sizeof(Bone_t)); + for(unsigned i=0; i - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include -#include "libvitaboy.hpp" - -enum VBFileType { - VBFILE_ANIM, - VBFILE_APR, - VBFILE_BND, - VBFILE_COL, - VBFILE_HAG, - VBFILE_MESH, - VBFILE_OFT, - VBFILE_PO, - VBFILE_SKEL -}; - -int main(int argc, char *argv[]){ - int type; - char * InFile; - - if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ - printf("Usage: vbparse [-t type] infile\n" - "Parse a TSO VitaBoy file.\n" - "\n" - "Supported types:\n" - " (*) ANIM - Animation\n" - " (*) APR - Appearance\n" - " (*) BND - Binding\n" - " (*) COL - Collection\n" - " (*) HAG - Hand group\n" - " (*) MESH - Mesh\n" - " (*) OFT - Outfit\n" - " (*) PO - Purchasable object\n" - " (*) SKEL - Skeleton\n" - "\n" - "Report bugs to .\n" - "vbparse is maintained by the Niotso project.\n" - "Home page: "); - return 0; - } - - if(argc >= 4 && !strcmp(argv[1], "-t")){ - if(!stricmp(argv[2], "anim")) type = 0; - else if(!stricmp(argv[2], "apr")) type = 1; - else if(!stricmp(argv[2], "bnd")) type = 2; - else if(!stricmp(argv[2], "col")) type = 3; - else if(!stricmp(argv[2], "hag")) type = 4; - else if(!stricmp(argv[2], "mesh")) type = 5; - else if(!stricmp(argv[2], "oft")) type = 6; - else if(!stricmp(argv[2], "po")) type = 7; - else if(!stricmp(argv[2], "skel")) type = 8; - else{ - printf("%sUnrecognized type '%s'", "vbparse: Error: ", argv[2]); - return -1; - } - InFile = argv[3]; - }else{ - char * pos = strrchr(argv[1], '.') + 1; - if(!stricmp(pos, "anim")) type = 0; - else if(!stricmp(pos, "apr")) type = 1; - else if(!stricmp(pos, "bnd")) type = 2; - else if(!stricmp(pos, "col")) type = 3; - else if(!stricmp(pos, "hag")) type = 4; - else if(!stricmp(pos, "mesh")) type = 5; - else if(!stricmp(pos, "oft")) type = 6; - else if(!stricmp(pos, "po")) type = 7; - else if(!stricmp(pos, "skel")) type = 8; - else{ - printf("%sUnrecognized type", "vbparse: Error: "); - return -1; - } - InFile = argv[1]; - } - - HANDLE ProcessHeap = GetProcessHeap(); - HANDLE hFile; - unsigned FileSize; - uint8_t *InData; - DWORD bytestransferred; - - hFile = CreateFile(InFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if(hFile == INVALID_HANDLE_VALUE){ - if(GetLastError() == ERROR_FILE_NOT_FOUND){ - printf("%sThe specified input file does not exist.", "vbparse: Error: "); - return -1; - } - printf("%sThe input file could not be opened for reading.", "vbparse: Error: "); - return -1; - } - FileSize = GetFileSize(hFile, NULL); - InData = (uint8_t*) HeapAlloc(ProcessHeap, HEAP_NO_SERIALIZE, FileSize); - if(InData == NULL){ - printf("%sMemory for this file could not be allocated.", "vbparse: Error: "); - return -1; - } - if(!ReadFile(hFile, InData, FileSize, &bytestransferred, NULL) || bytestransferred != FileSize){ - printf("%sThe input file could not be read.", "vbparse: Error: "); - return -1; - } - CloseHandle(hFile); - - VBFile.set(InData, FileSize); - - if(type == VBFILE_ANIM){ - Animation_t Animation; - ReadAnimation(Animation); - } - - return 0; +/* + libvitaboy - Copyright (c) 2012 Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include "libvitaboy.hpp" + +enum VBFileType { + VBFILE_ANIM, + VBFILE_APR, + VBFILE_BND, + VBFILE_COL, + VBFILE_HAG, + VBFILE_MESH, + VBFILE_OFT, + VBFILE_PO, + VBFILE_SKEL +}; + +int main(int argc, char *argv[]){ + int type; + char * InFile; + + if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){ + printf("Usage: vbparse [-t type] infile\n" + "Parse a TSO VitaBoy file.\n" + "\n" + "Supported types:\n" + " (*) ANIM - Animation\n" + " (*) APR - Appearance\n" + " (*) BND - Binding\n" + " (*) COL - Collection\n" + " (*) HAG - Hand group\n" + " (*) MESH - Mesh\n" + " (*) OFT - Outfit\n" + " (*) PO - Purchasable object\n" + " (*) SKEL - Skeleton\n" + "\n" + "Report bugs to .\n" + "vbparse is maintained by the Niotso project.\n" + "Home page: "); + return 0; + } + + if(argc >= 4 && !strcmp(argv[1], "-t")){ + if(!stricmp(argv[2], "anim")) type = 0; + else if(!stricmp(argv[2], "apr")) type = 1; + else if(!stricmp(argv[2], "bnd")) type = 2; + else if(!stricmp(argv[2], "col")) type = 3; + else if(!stricmp(argv[2], "hag")) type = 4; + else if(!stricmp(argv[2], "mesh")) type = 5; + else if(!stricmp(argv[2], "oft")) type = 6; + else if(!stricmp(argv[2], "po")) type = 7; + else if(!stricmp(argv[2], "skel")) type = 8; + else{ + printf("%sUnrecognized type '%s'", "vbparse: Error: ", argv[2]); + return -1; + } + InFile = argv[3]; + }else{ + char * pos = strrchr(argv[1], '.') + 1; + if(!stricmp(pos, "anim")) type = 0; + else if(!stricmp(pos, "apr")) type = 1; + else if(!stricmp(pos, "bnd")) type = 2; + else if(!stricmp(pos, "col")) type = 3; + else if(!stricmp(pos, "hag")) type = 4; + else if(!stricmp(pos, "mesh")) type = 5; + else if(!stricmp(pos, "oft")) type = 6; + else if(!stricmp(pos, "po")) type = 7; + else if(!stricmp(pos, "skel")) type = 8; + else{ + printf("%sUnrecognized type", "vbparse: Error: "); + return -1; + } + InFile = argv[1]; + } + + uint8_t *InData = File::ReadFile(InFile); + if(InData == NULL){ + const char * Message; + switch(File::Error){ + case FERR_NOT_FOUND: + Message = "%s does not exist."; + break; + case FERR_OPEN: + Message = "%s could not be opened for reading."; + break; + case FERR_BLANK: + Message = "%s is corrupt or invalid."; + break; + case FERR_MEMORY: + Message = "Memory for %s could not be allocated."; + break; + default: + Message = "%s could not be read."; + break; + } + printf(Message, InFile); + return -1; + } + + VBFile.set(InData, File::FileSize); + + switch(type){ + case VBFILE_ANIM: + Animation_t Animation; + ReadAnimation(Animation); + break; + case VBFILE_APR: + Appearance_t Appearance; + ReadAppearance(Appearance); + break; + case VBFILE_BND: + Binding_t Binding; + ReadBinding(Binding); + break; + case VBFILE_COL: + Collection_t Collection; + ReadCollection(Collection); + break; + case VBFILE_HAG: + HandGroup_t HandGroup; + ReadHandGroup(HandGroup); + break; + case VBFILE_MESH: + Mesh_t Mesh; + ReadMesh(Mesh); + break; + case VBFILE_OFT: + Outfit_t Outfit; + ReadOutfit(Outfit); + break; + case VBFILE_PO: + PurchasableOutfit_t PurchasableOutfit; + ReadPurchasableOutfit(PurchasableOutfit); + break; + case VBFILE_SKEL: + Skeleton_t Skeleton; + ReadSkeleton(Skeleton); + } + + return 0; } \ No newline at end of file diff --git a/Server/NiotsoServer.cpp b/Server/NiotsoServer.cpp new file mode 100644 index 0000000..47d0e44 --- /dev/null +++ b/Server/NiotsoServer.cpp @@ -0,0 +1,16 @@ +/* + Niotso Server - Copyright (C) 2012 Fatbag + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ \ No newline at end of file