Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 KB | None | 0 0
  1. #define RETRO_MEMDOMAINS_FLAG_INVALID (1 << 0) /* One or more of the memory domains have been invalidated. Request memory domains again. */
  2.  
  3. #define RETRO_MEMDOMAIN_FLAG_INVALID (1 << 0) /* This memory domain is has been invalidated and must not be used. Request memory domains again. */
  4. #define RETRO_MEMDOMAIN_FLAG_INVALID_PTR (1 << 1) /* This memory domain's pointer is has been invalidated at some point. Use RETRO_MEMDOMAIN_OP_REFRESH_PTR to clear this. */
  5. #define RETRO_MEMDOMAIN_FLAG_IO_R (1 << 2) /* Can be read or peeked */
  6. #define RETRO_MEMDOMAIN_FLAG_IO_W (1 << 3) /* Can be written or poked */
  7. #define RETRO_MEMDOMAIN_FLAG_UNIT8 (1 << 4) /* Resource is fundamentally addressed in 8 bit units (this is almost universally the case */
  8. #define RETRO_MEMDOMAIN_FLAG_UNIT16 (1 << 5) /* Resource is fundamentally addressed in 16 bit units; more granular addressing is not sensible */
  9. #define RETRO_MEMDOMAIN_FLAG_UNIT32 (1 << 6) /* Resource is fundamentally addressed in 32 bit units; more granular addressing is not sensible */
  10. #define RETRO_MEMDOMAIN_FLAG_UNIT64 (1 << 7) /* Resource is fundamentally addressed in 64 bit units; more granular addressing is not sensible */
  11. #define RETRO_MEMDOMAIN_FLAG_READ (1 << 8) /* Advice: Is conceptually readable; the user may be permitted to read it, regardless */
  12. #define RETRO_MEMDOMAIN_FLAG_WRITE (1 << 9) /* Advice: Is conceptually writable; the user may be permitted to write it, regardless */
  13. #define RETRO_MEMDOMAIN_FLAG_BIGENDIAN (1 << 10) /* Advice: known to be typically accessed in a big endian pattern */
  14. #define RETRO_MEMDOMAIN_FLAG_LITTLEENDIAN (1 << 11) /* Advice: known to be typically accessed in a little endian pattern */
  15. #define RETRO_MEMDOMAIN_FLAG_ALIGN_1 (1 << 12) /* Advice: aAdresses must be a multiple of 2 */
  16. #define RETRO_MEMDOMAIN_FLAG_ALIGN_2 (1 << 13) /* Advice: aAdresses must be a multiple of 2 */
  17. #define RETRO_MEMDOMAIN_FLAG_ALIGN_4 (1 << 14) /* Advice: addresses must be a multiple of 4 */
  18. #define RETRO_MEMDOMAIN_FLAG_ALIGN_8 (1 << 15) /* Advice: addresses must be a multiple of 8 */
  19. #define RETRO_MEMDOMAIN_FLAG_WORDSIZE_2 (1 << 16) /* Advice: values are accessed 1 byte at a time */
  20. #define RETRO_MEMDOMAIN_FLAG_WORDSIZE_2 (1 << 17) /* Advice: values are accessed 2 bytes at a time */
  21. #define RETRO_MEMDOMAIN_FLAG_WORDSIZE_4 (1 << 18) /* Advice: values are accessed 4 bytes at a time */
  22. #define RETRO_MEMDOMAIN_FLAG_WORDSIZE_8 (1 << 19) /* Advice: values are accessed 8 bytes at a time */
  23. #define RETRO_MEMDOMAIN_FLAG_CAN_HOOK_R (1 << 20) /* Read operations can be hooked (not supported; for future use) */
  24. #define RETRO_MEMDOMAIN_FLAG_CAN_HOOK_W (1 << 21) /* Write operations can be hooked (not supported; for future use) */
  25. #define RETRO_MEMDOMAIN_FLAG_CAN_HOOK_X (1 << 22) /* Execute operations can be hooked (not supported; for future use) */
  26. #define RETRO_MEMDOMAIN_FLAG_CAN_HOOK_F (1 << 23) /* Fetch (for execute) operations can be hooked (not supported; for future use) */
  27. #define RETRO_MEMDOMAIN_FLAG_CAN_TEST_DIRTY (1 << 24) /* Indicates whether the memdomain can test whether it's dirty */
  28. #define RETRO_MEMDOMAIN_FLAG_CAN_TRACK_DIRTY (1 << 25) /* Indicates whether the memdomain tracks whether it's dirty (testing will be instantaneous, and the flag can be cleared) */
  29. #define RETRO_MEMDOMAIN_FLAG_TAG_ARTIFICIAL (1 << 26) /* Tags the memory domain as being somewhat fictitious, provided for convenience */
  30. #define RETRO_MEMDOMAIN_FLAG_TAG_HIDDEN (1 << 27) /* Tags the memory domain as being intended for internal use, and hidden from most users */
  31. #define RETRO_MEMDOMAIN_FLAG_TAG_CHEATSEARCH (1 << 28) /* Tags the memory domain as being suitable for cheat searching */
  32. #define RETRO_MEMDOMAIN_FLAG_TAG_BUS (1 << 29) /* Tags the memory domain as being bus-like */
  33. #define RETRO_MEMDOMAIN_FLAG_TAG_FILE (1 << 30) /* Tags the memory domain as being file-like (a raw representation of a loaded ROM file, for instance) */
  34. #define RETRO_MEMDOMAIN_FLAG_TAG_MEMORY (1 << 31) /* Tags the memory domain as being a memory-like resource */
  35. #define RETRO_MEMDOMAIN_FLAG_TAG_DEFAULT (1 << 32) /* Tags the memory domain as being the ideal for a certain purpose. ex. DEFAULT BUS will be the main cpu's sysbus */
  36.  
  37. #define RETRO_MEMDOMAIN_IO_READ (0) /* Specifies a read with concrete properties determined by the core, including side effects */
  38. #define RETRO_MEMDOMAIN_IO_PEEK (1) /* Specifies a synthetic read, avoiding side effects where sensible and possible */
  39. #define RETRO_MEMDOMAIN_IO_WRITE (2) /* Specifies a write with concrete properties determined by the core, including side effects */
  40. #define RETRO_MEMDOMAIN_IO_POKE (3) /* Specifies a synthetic write, avoiding side effects where sensible and possible */
  41. /* reserved */
  42. #define RETRO_MEMDOMAIN_IO_SIZE8 (1<<24)
  43. #define RETRO_MEMDOMAIN_IO_SIZE16 (1<<25)
  44. #define RETRO_MEMDOMAIN_IO_SIZE32 (1<<26)
  45. #define RETRO_MEMDOMAIN_IO_SIZE64 (1<<27)
  46. /* reserved */
  47. #define RETRO_MEMDOMAIN_IO_BIGENDIAN (1<<31) /* Not completely sure what this means or if it makes sense */
  48.  
  49. #define RETRO_MEMDOMAIN_OP_STORE (0) /* Stores a buffer into the memory domain */
  50. #define RETRO_MEMDOMAIN_OP_DUMP (1) /* Dumps from the memory domain into a buffer */
  51. #define RETRO_MEMDOMAIN_OP_TEST_DIRTY (2) /* Returns whether the memory domain is dirty; returns 1 for dirty and 0 for not */
  52. #define RETRO_MEMDOMAIN_OP_CLEAR_DIRTY (3) /* Clears the dirty status (if it's tracked) */
  53. #define RETRO_MEMDOMAIN_OP_REFRESH_PTR (4) /* Clears the RETRO_MEMDOMAIN_FLAG_INVALID_PTR flag on this memory domain */
  54. #define RETRO_MEMDOMAIN_OP_MAP (5) /* TODO: IDEA: Attempts to map the resource address to a system bus address; see elsewhere for more details*/
  55.  
  56. #define RETRO_MEMDOMAINS_SIGNAL_FLAG_INVALIDATED (1<<0)
  57.  
  58. /* Implements an IO for a memory domain (e.g. peek, write) */
  59. typedef uint64_t (*retro_memdomain_io_t)(uint32_t ioflags, uint64_t address, uint64_t value);
  60.  
  61. /* Implements a misc or bulk operation */
  62. typedef uint64_t (*retro_memdomain_op_t)(uint32_t ioflags, uint32_t opflags, uint64_t address, void* buffer, uint64_t length);
  63.  
  64.  
  65. struct retro_memdomains_signal_args
  66. {
  67. /* flags for the signal (really, just the signal type) */
  68. uint32_t flags;
  69.  
  70. /* argument for the signal */
  71. void* arg;
  72.  
  73. /* the callback argument that was passed into retro_memdomains_get_t */
  74. void* user_arg;
  75. };
  76.  
  77. /* Details about a single memory domain IO interface */
  78. struct retro_memdomain_iodef
  79. {
  80. /* RETRO_MEMDOMAIN_IO flags determining the type of the IO */
  81. uint32_t flags;
  82.  
  83. /* the corresponding callback. */
  84. retro_memdomain_io_t cb;
  85.  
  86. /* Human-readable memo/errata, in ASCII English. */
  87. const char* memo;
  88. };
  89.  
  90. struct retro_memdomain
  91. {
  92. /* A set of RETRO_MEMDOMAIN_FLAG values */
  93. uint64_t flags;
  94.  
  95. /* Reserved for future use */
  96. uint64_t flags2;
  97.  
  98. /* A pointer to the resource; may be NULL, in which case callbacks would need to be provided */
  99. void* ptr;
  100.  
  101. /* Size of the memory domain; it's the size of `ptr` if that is provided; otherwise it's the count of units that can be addressed through the callbacks */
  102. uint64_t size;
  103.  
  104. /* NULL-terminated lists of available IOs. Any of these may be empty lists. */
  105. const retro_memdomain_iodef *read, *peek, *write, *poke;
  106.  
  107. /* The name of the memory domain. TODO: What characters are allowed? */
  108. const char* name;
  109.  
  110. /* A category used to namespace the memory domain; should be an empty string if unset, which should be most cases. */
  111. const char* category;
  112.  
  113. /* Human-readable description, in ASCII English. */
  114. const char* desc;
  115.  
  116. /* callback for miscellaneous or bulk operations; may be NULL if not supported. */
  117. retro_memdomain_op_t op;
  118.  
  119. /* If this can correlate directly to a RETRO_MEMORY value, it's specified here. Otherwise it's 0xFFFFFFFF */
  120. uint32_t retro_get_memory_type;
  121. };
  122.  
  123. struct retro_memdomains
  124. {
  125. /* count of defined domains */
  126. uint32_t num_domains;
  127.  
  128. /* pointer to all defined domains */
  129. const retro_memdomain* domains;
  130. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement