mirror of
https://github.com/simtactics/niotso.git
synced 2025-03-22 10:52:20 +00:00
got it working up until the demos, still need to check and redo all the tools
This commit is contained in:
parent
948bd8474c
commit
52b0e0671f
31 changed files with 297 additions and 271 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
# Build system
|
# Build system
|
||||||
|
build/
|
||||||
_build/
|
_build/
|
||||||
_deps/
|
_deps/
|
||||||
_dist/
|
_dist/
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
9
Tools/vitaboy-parse/CMakeLists.txt
Normal file
9
Tools/vitaboy-parse/CMakeLists.txt
Normal 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)
|
|
@ -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
5
examples/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
add_subdirectory(gldemo)
|
||||||
|
add_subdirectory(rlgldemo)
|
||||||
|
|
||||||
|
#TODO:
|
||||||
|
# Set Properties -> Debugging -> Working Directory from $(ProjectDir) to $(Outdir)
|
|
@ -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)
|
||||||
|
|
|
@ -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 {
|
||||||
|
@ -122,7 +131,7 @@ static int LoadTextures()
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -219,7 +228,8 @@ 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){
|
}
|
||||||
|
else if (Bone.ChildrenCount > 1) {
|
||||||
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
|
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
TransformVertices(*Bone.Children[i]);
|
TransformVertices(*Bone.Children[i]);
|
||||||
|
@ -251,7 +261,6 @@ static void BlendVertices()
|
||||||
|
|
||||||
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();
|
||||||
|
@ -335,7 +344,8 @@ static void DrawBonesSkeleton(Bone_t& Bone)
|
||||||
|
|
||||||
if (Bone.ChildrenCount == 1) {
|
if (Bone.ChildrenCount == 1) {
|
||||||
DrawBonesSkeleton(*Bone.Children[0]);
|
DrawBonesSkeleton(*Bone.Children[0]);
|
||||||
}else if(Bone.ChildrenCount > 1){
|
}
|
||||||
|
else if (Bone.ChildrenCount > 1) {
|
||||||
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
|
for (unsigned i = 0; i < Bone.ChildrenCount; i++) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
DrawBonesSkeleton(*Bone.Children[i]);
|
DrawBonesSkeleton(*Bone.Children[i]);
|
||||||
|
@ -366,7 +376,8 @@ static int DrawScene(float TimeDelta, uint8_t keys[256])
|
||||||
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; } }
|
||||||
|
else PressedQ = 0;
|
||||||
if (keys['N']) { AdvanceFrame(Skeleton, Animation, TimeDelta); }
|
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
|
|
@ -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>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#define APIENTRY
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *__restrict Title;
|
const char *__restrict Title;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ struct Sound_t {
|
||||||
uint8_t * Data;
|
uint8_t * Data;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace File {
|
namespace File
|
||||||
|
{
|
||||||
inline size_t GetFileSize(FILE * hFile){
|
inline size_t GetFileSize(FILE * hFile){
|
||||||
fseek(hFile, 0, SEEK_END);
|
fseek(hFile, 0, SEEK_END);
|
||||||
size_t FileSize = ftell(hFile);
|
size_t FileSize = ftell(hFile);
|
||||||
|
@ -75,13 +75,12 @@ inline size_t GetFileSize(FILE * hFile){
|
||||||
return FileSize;
|
return FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
fhexport extern int Error;
|
extern int Error;
|
||||||
fhexport extern size_t FileSize;
|
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
|
|
@ -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)
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
10
niotso/libvitaboy/Log.hpp
Normal 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
|
|
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
/****
|
/****
|
||||||
|
|
|
@ -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++){
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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*));
|
||||||
|
|
Loading…
Add table
Reference in a new issue