bcfnt.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright 2016 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/swap.h"
  6. #include "core/hle/kernel/shared_memory.h"
  7. #include "core/hle/service/service.h"
  8. namespace Service {
  9. namespace APT {
  10. namespace BCFNT { ///< BCFNT Shared Font file structures
  11. struct CFNT {
  12. u8 magic[4];
  13. u16_le endianness;
  14. u16_le header_size;
  15. u32_le version;
  16. u32_le file_size;
  17. u32_le num_blocks;
  18. };
  19. struct SectionHeader {
  20. u8 magic[4];
  21. u32_le section_size;
  22. };
  23. struct FINF {
  24. u8 magic[4];
  25. u32_le section_size;
  26. u8 font_type;
  27. u8 line_feed;
  28. u16_le alter_char_index;
  29. u8 default_width[3];
  30. u8 encoding;
  31. u32_le tglp_offset;
  32. u32_le cwdh_offset;
  33. u32_le cmap_offset;
  34. u8 height;
  35. u8 width;
  36. u8 ascent;
  37. u8 reserved;
  38. };
  39. struct TGLP {
  40. u8 magic[4];
  41. u32_le section_size;
  42. u8 cell_width;
  43. u8 cell_height;
  44. u8 baseline_position;
  45. u8 max_character_width;
  46. u32_le sheet_size;
  47. u16_le num_sheets;
  48. u16_le sheet_image_format;
  49. u16_le num_columns;
  50. u16_le num_rows;
  51. u16_le sheet_width;
  52. u16_le sheet_height;
  53. u32_le sheet_data_offset;
  54. };
  55. struct CMAP {
  56. u8 magic[4];
  57. u32_le section_size;
  58. u16_le code_begin;
  59. u16_le code_end;
  60. u16_le mapping_method;
  61. u16_le reserved;
  62. u32_le next_cmap_offset;
  63. };
  64. struct CWDH {
  65. u8 magic[4];
  66. u32_le section_size;
  67. u16_le start_index;
  68. u16_le end_index;
  69. u32_le next_cwdh_offset;
  70. };
  71. /**
  72. * Relocates the internal addresses of the BCFNT Shared Font to the new base. The current base will
  73. * be auto-detected based on the file headers.
  74. *
  75. * @param shared_font SharedMemory object that contains the Shared Font
  76. * @param new_address New base for the offsets in the structure.
  77. */
  78. void RelocateSharedFont(Kernel::SharedPtr<Kernel::SharedMemory> shared_font, VAddr new_address);
  79. } // namespace BCFNT
  80. } // namespace APT
  81. } // namespace Service