BsxFile.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef BSX_FILE_H
  2. #define BSX_FILE_H
  3. #include <Ogre.h>
  4. #include "DatFile.h"
  5. #include "common/LzsFile.h"
  6. #include "../../common/Vram.h"
  7. #include "../../common/OgreGenUtilites.h"
  8. struct Unit
  9. {
  10. Ogre::String name;
  11. std::vector<Ogre::String> animations;
  12. };
  13. struct Field
  14. {
  15. Ogre::String name;
  16. std::vector< Unit > units;
  17. };
  18. struct TexForGenBsx: TexForGen
  19. {
  20. int type;
  21. bool operator==( const TexForGenBsx& i ) const
  22. {
  23. return i.texture_x == texture_x &&
  24. i.texture_y == texture_y &&
  25. i.palette_y == palette_y &&
  26. i.palette_x == palette_x &&
  27. i.bpp == bpp &&
  28. ( i.type == type || ( i.type < 2 && type < 2 ) );
  29. }
  30. };
  31. typedef std::vector< TexForGenBsx > VectorTexForGenBsx;
  32. class BsxFile : public LzsFile
  33. {
  34. public:
  35. explicit BsxFile(const Ogre::String& file);
  36. explicit BsxFile(File* pFile);
  37. BsxFile(File* pFile, const u32 offset, const u32 length);
  38. BsxFile(u8* pBuffer, const u32 offset, const u32 length);
  39. virtual ~BsxFile();
  40. Ogre::Entity* GetModel(Ogre::Entity* entity, const s8 character_id, const Unit& unit, const DatModelData dat);
  41. void CreateTexture(const Ogre::String& name, const int face_id, const VectorTexForGenBsx& textures);
  42. void ReadBSXTextureToVram();
  43. private:
  44. std::unique_ptr<Vram> m_Vram;
  45. };
  46. #endif // BSX_FILE_h