bcfnt.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 FINF {
  20. u8 magic[4];
  21. u32_le section_size;
  22. u8 font_type;
  23. u8 line_feed;
  24. u16_le alter_char_index;
  25. u8 default_width[3];
  26. u8 encoding;
  27. u32_le tglp_offset;
  28. u32_le cwdh_offset;
  29. u32_le cmap_offset;
  30. u8 height;
  31. u8 width;
  32. u8 ascent;
  33. u8 reserved;
  34. };
  35. struct TGLP {
  36. u8 magic[4];
  37. u32_le section_size;
  38. u8 cell_width;
  39. u8 cell_height;
  40. u8 baseline_position;
  41. u8 max_character_width;
  42. u32_le sheet_size;
  43. u16_le num_sheets;
  44. u16_le sheet_image_format;
  45. u16_le num_columns;
  46. u16_le num_rows;
  47. u16_le sheet_width;
  48. u16_le sheet_height;
  49. u32_le sheet_data_offset;
  50. };
  51. struct CMAP {
  52. u8 magic[4];
  53. u32_le section_size;
  54. u16_le code_begin;
  55. u16_le code_end;
  56. u16_le mapping_method;
  57. u16_le reserved;
  58. u32_le next_cmap_offset;
  59. };
  60. struct CWDH {
  61. u8 magic[4];
  62. u32_le section_size;
  63. u16_le start_index;
  64. u16_le end_index;
  65. u32_le next_cwdh_offset;
  66. };
  67. /**
  68. * Relocates the internal addresses of the BCFNT Shared Font to the new base.
  69. * @param shared_font SharedMemory object that contains the Shared Font
  70. * @param previous_address Previous address at which the offsets in the structure were based.
  71. * @param new_address New base for the offsets in the structure.
  72. */
  73. void RelocateSharedFont(Kernel::SharedPtr<Kernel::SharedMemory> shared_font, VAddr previous_address, VAddr new_address);
  74. } // namespace BCFNT
  75. } // namespace APT
  76. } // namespace Service