Ingen beskrivning

callback.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /****************************************************************************
  2. * Copyright (C) 2015-2016 by the SotS Team *
  3. * *
  4. * This file is part of Sovereign of the Skies. *
  5. * *
  6. * Sovereign of the Skies is free software: you can redistribute it *
  7. * and/or modify it *
  8. * under the terms of the GNU Lesser General Public License as published *
  9. * by the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version provided you include a copy of the *
  11. * licence and this header. *
  12. * *
  13. * Sovereign of the Skies is distributed in the hope that it will be *
  14. * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU Lesser General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU Lesser General Public *
  19. * License along with Sovereign of the Skies. *
  20. * If not, see <http://www.gnu.org/licenses/>. *
  21. ****************************************************************************/
  22. /**
  23. * @file callback.h
  24. * @author Sturmvogel
  25. * @date 15 dec 2016
  26. * @brief Manage callbacks and tasks
  27. *
  28. * This header file provides methods to interact with callbacks and
  29. * the task handler. It also defines the superstate structure,
  30. * which contains callback information, sprite pointers, kesypad etc.
  31. */
  32. #ifndef CALLBACK_H_
  33. #define CALLBACK_H_
  34. #include <objects.h>
  35. /* === TYPES === */
  36. typedef void (*callback)();
  37. /* === STRUCTURES === */
  38. struct int_superstate {
  39. callback callback1;
  40. callback callback2;
  41. callback callback2backup;
  42. callback callback5_vblank;
  43. callback hblank_callback;
  44. u32 field_14;
  45. u32 field_18;
  46. u32 bit_to_wait_for;
  47. u32 *ptr_vblank_counter;
  48. u32 field_24;
  49. u16 buttons_held;
  50. u16 buttons_new;
  51. u16 buttons_held_remapped;
  52. u16 buttons_new_remapped;
  53. u16 buttons_new_and_key_repeat;
  54. u32 keypad_countdown;
  55. u32 unused_padding;
  56. struct obj_entity sprites[128];
  57. u8 multi_purpose_state_tracker;
  58. u8 gpu_sprites_upload_skip;
  59. };
  60. /* === EXTERN STRUCTURES === */
  61. extern struct int_superstate superstate;
  62. /* === EXTERN METHODS === */
  63. /**
  64. * @brief sets the second main callback
  65. * @param address callback which should be set
  66. */
  67. extern void set_callback2(callback address);
  68. /**
  69. * @brief sets the vblank callback
  70. * @param address callback which should be set
  71. */
  72. extern void vblank_handler_set(callback address);
  73. /**
  74. * @brief does everything the overworld needs to do
  75. */
  76. extern void callback_overworld();
  77. /**
  78. * @brief executes the task handler stack
  79. */
  80. extern void task_exec();
  81. #endif