alberthrocks

calc.h Include

Nov 12th, 2011
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.47 KB | None | 0 0
  1. #ifndef _CALC_H
  2.  
  3. #define _CALC_H
  4.  
  5.  
  6.  
  7. #include "stdafx.h"
  8.  
  9. #include "coretypes.h"
  10.  
  11.  
  12.  
  13. #ifdef WINVER
  14.  
  15. #include "gui.h" // it would be nice to get this separated somehow
  16.  
  17. #include "droptarget.h"
  18.  
  19. #elif WXVER
  20.  
  21. #include <wx/frame.h>
  22.  
  23. #include "wx/wx.h"
  24.  
  25. #endif
  26.  
  27. #include "core.h"
  28.  
  29. #include "lcd.h"
  30.  
  31. #include "keys.h"
  32.  
  33. #include "link.h"
  34.  
  35.  
  36.  
  37. #ifdef _WINDOWS
  38.  
  39. #include "Wabbitemu_h.h"
  40.  
  41. #include "sound.h"
  42.  
  43. #include "DropTarget.h"
  44.  
  45. #include "dbbreakpoints.h"
  46.  
  47. #endif
  48.  
  49.  
  50.  
  51. #include "label.h"
  52.  
  53. #include "savestate.h"
  54.  
  55.  
  56.  
  57.  
  58.  
  59. typedef enum {
  60.  
  61.     GDS_IDLE,
  62.  
  63.     GDS_STARTING,
  64.  
  65.     GDS_RECORDING,
  66.  
  67.     GDS_ENDING
  68.  
  69. } gif_disp_states;
  70.  
  71.  
  72.  
  73. #define MIN_BLOCK_SIZE 16
  74.  
  75. #define MAX_FLASH_PAGE_SIZE 0x80
  76.  
  77. #define MAX_RAM_PAGE_SIZE 0x08
  78.  
  79. typedef struct profiler {
  80.  
  81.     BOOL running;
  82.  
  83.     int blockSize;
  84.  
  85.     long long totalTime;
  86.  
  87.     long flash_data[MAX_FLASH_PAGE_SIZE][PAGE_SIZE / MIN_BLOCK_SIZE];
  88.  
  89.     long ram_data[MAX_RAM_PAGE_SIZE][PAGE_SIZE / MIN_BLOCK_SIZE];
  90.  
  91. } profiler_t;
  92.  
  93.  
  94.  
  95. #define KEY_STRING_SIZE 56
  96.  
  97. struct key_string {
  98.  
  99.     TCHAR *text;
  100.  
  101.     int group;
  102.  
  103.     int bit;
  104.  
  105.     key_string *next;
  106.  
  107. };
  108.  
  109.  
  110.  
  111. typedef struct tagCALC {
  112.  
  113. #ifdef WINVER
  114.  
  115.     HWND (*breakpoint_callback)(struct tagCALC *);
  116.  
  117. #elif MACVER
  118.  
  119.     void (*breakpoint_callback)(struct tagCALC *, void *);
  120.  
  121.     void *breakpoint_owner;
  122.  
  123. #elif WXVER
  124.  
  125.     void (*breakpoint_callback)(struct tagCALC *);
  126.  
  127. #endif
  128.  
  129.     int slot;
  130.  
  131.     TCHAR rom_path[MAX_PATH];
  132.  
  133.     char rom_version[32];
  134.  
  135.     int model;
  136.  
  137.  
  138.  
  139.     time_t time_error;
  140.  
  141.  
  142.  
  143.     BOOL active;
  144.  
  145.     CPU_t cpu;
  146.  
  147.     memory_context_t mem_c;
  148.  
  149.     timer_context_t timer_c;
  150.  
  151. #ifdef WINVER
  152.  
  153.     AUDIO_t *audio; // FIXME: Bad!
  154.  
  155. #endif
  156.  
  157.  
  158.  
  159. #ifdef WINVER
  160.  
  161.     CDropTarget *pDropTarget;
  162.  
  163.     HWND hwndFrame;
  164.  
  165.     HWND hwndLCD;
  166.  
  167.     HWND hwndDetachedFrame;
  168.  
  169.     HWND hwndDetachedLCD;
  170.  
  171.     HWND hwndStatusBar;
  172.  
  173.     HWND hwndDebug;
  174.  
  175.     HWND hwndSmallClose;
  176.  
  177.     HWND hwndSmallMinimize;
  178.  
  179.     HWND hwndKeyListDialog;
  180.  
  181.  
  182.  
  183.     BOOL SkinEnabled;
  184.  
  185.     DWORD scale;
  186.  
  187.     DWORD detached_scale;
  188.  
  189.     BOOL bCutout;
  190.  
  191.     HANDLE hdlThread;
  192.  
  193.    
  194.  
  195.     clock_t sb_refresh;
  196.  
  197.  
  198.  
  199.     key_string *last_keypress_head;
  200.  
  201.     int num_keypresses;
  202.  
  203.  
  204.  
  205.     BOOL do_drag;
  206.  
  207.     HDC hdcSkin;
  208.  
  209.     HDC hdcButtons;
  210.  
  211.     HDC hdcKeymap;
  212.  
  213. #elif WXVER
  214.  
  215.     wxBitmap calcSkin;
  216.  
  217.     wxImage keymap;
  218.  
  219.     int scale;
  220.  
  221.     bool SkinEnabled;
  222.  
  223.     bool bCutout;
  224.  
  225.     wxSize SkinSize;
  226.  
  227.     wxRect LCDRect;
  228.  
  229.     clock_t sb_refresh;
  230.  
  231.     bool bCustomSkin;
  232.  
  233.     char skin_path[256];
  234.  
  235.     char keymap_path[256];
  236.  
  237. #else
  238.  
  239.     pthread_t hdlThread;
  240.  
  241. #endif
  242.  
  243.  
  244.  
  245.     BOOL running;
  246.  
  247.     int speed;
  248.  
  249.     BYTE breakpoints[0x10000];
  250.  
  251.     label_struct labels[6000];
  252.  
  253.     profiler_t profiler;
  254.  
  255.  
  256.  
  257.     TCHAR labelfn[256];
  258.  
  259.     applist_t applist;
  260.  
  261.     apphdr_t *last_transferred_app;
  262.  
  263.  
  264.  
  265.     gif_disp_states gif_disp_state;
  266.  
  267.  
  268.  
  269. #ifdef WINVER
  270.  
  271.     RECT rectSkin;
  272.  
  273.     RECT rectLCD;
  274.  
  275.     COLORREF FaceplateColor;
  276.  
  277.     BOOL bCustomSkin;
  278.  
  279.     BOOL bAlwaysOnTop;
  280.  
  281.     BOOL bAlphaBlendLCD;
  282.  
  283.     TCHAR skin_path[256];
  284.  
  285.     TCHAR keymap_path[256];
  286.  
  287.     IWabbitemu *pWabbitemu;
  288.  
  289.     ICalcNotify *pCalcNotify;
  290.  
  291. #endif
  292.  
  293.  
  294.  
  295. } calc_t;
  296.  
  297.  
  298.  
  299. #ifdef WITH_BACKUPS
  300.  
  301. typedef struct DEBUG_STATE {
  302.  
  303.     SAVESTATE_t *save;
  304.  
  305.     struct DEBUG_STATE *next, *prev;
  306.  
  307. } debugger_backup;
  308.  
  309. #endif
  310.  
  311.  
  312.  
  313. #ifdef QUICKLOOK
  314.  
  315. #define MAX_CALCS   1
  316.  
  317. #else
  318.  
  319. #define MAX_CALCS   8
  320.  
  321. #endif
  322.  
  323. #define MAX_SPEED 100*50
  324.  
  325.  
  326.  
  327. typedef struct tagCALC CALC, *LPCALC;
  328.  
  329.  
  330.  
  331. void calc_turn_on(LPCALC);
  332.  
  333. LPCALC calc_slot_new(void);
  334.  
  335. u_int calc_count(void);
  336.  
  337. int calc_reset(LPCALC);
  338.  
  339. int CPU_reset(CPU_t *);
  340.  
  341. int calc_run_frame(LPCALC);
  342.  
  343. int calc_run_seconds(LPCALC, double);
  344.  
  345. int calc_run_timed(LPCALC, time_t);
  346.  
  347. int calc_run_all(void);
  348.  
  349. BOOL calc_start_screenshot(calc_t *calc, const char *filename);
  350.  
  351. void calc_stop_screenshot(calc_t *calc);
  352.  
  353.  
  354.  
  355. #ifdef WITH_BACKUPS
  356.  
  357. void do_backup(LPCALC);
  358.  
  359. void restore_backup(int index, LPCALC);
  360.  
  361. void init_backups();
  362.  
  363. void free_backups(LPCALC);
  364.  
  365. void free_backup(debugger_backup *);
  366.  
  367. #endif
  368.  
  369.  
  370.  
  371. BOOL rom_load(LPCALC lpCalc, LPCTSTR FileName);
  372.  
  373. void calc_slot_free(LPCALC);
  374.  
  375.  
  376.  
  377. void calc_unpause_linked();
  378.  
  379. void calc_pause_linked();
  380.  
  381.  
  382.  
  383. int calc_init_83p(LPCALC);
  384.  
  385. int calc_init_84p(LPCALC);
  386.  
  387. int calc_init_83pse(LPCALC);
  388.  
  389. LPCALC calc_from_cpu(CPU_t *);
  390.  
  391. LPCALC calc_from_memc(memc *);
  392.  
  393. void calc_erase_certificate(unsigned char *, int);
  394.  
  395. void port_debug_callback(void *, void *);
  396.  
  397. void mem_debug_callback(void *);
  398.  
  399.  
  400.  
  401. #ifdef CALC_C
  402.  
  403. #define GLOBAL
  404.  
  405. #else
  406.  
  407. #define GLOBAL extern
  408.  
  409. #endif
  410.  
  411.  
  412.  
  413. GLOBAL calc_t calcs[MAX_CALCS];
  414.  
  415. GLOBAL LPCALC lpDebuggerCalc;
  416.  
  417.  
  418.  
  419. #ifdef WITH_BACKUPS
  420.  
  421. #define MAX_BACKUPS 10
  422.  
  423. GLOBAL debugger_backup * backups[MAX_CALCS];
  424.  
  425. GLOBAL int number_backup;
  426.  
  427. GLOBAL int current_backup_index;
  428.  
  429. GLOBAL int num_backup_per_sec;
  430.  
  431. #endif
  432.  
  433.  
  434.  
  435. #ifdef WITH_AVI
  436.  
  437. #include "avi_utils.h"
  438.  
  439. GLOBAL HAVI recording_avi;
  440.  
  441. GLOBAL BOOL is_recording;
  442.  
  443. #endif
  444.  
  445.  
  446.  
  447. GLOBAL u_int frame_counter;
  448.  
  449. GLOBAL int startX;
  450.  
  451. GLOBAL int startY;
  452.  
  453. GLOBAL BOOL exit_save_state;
  454.  
  455. GLOBAL BOOL new_calc_on_load_files;
  456.  
  457. GLOBAL BOOL do_backups;
  458.  
  459. GLOBAL BOOL show_wizard;
  460.  
  461. GLOBAL BOOL break_on_exe_violation;
  462.  
  463. GLOBAL BOOL break_on_invalid_flash;
  464.  
  465. GLOBAL BOOL sync_cores;
  466.  
  467. GLOBAL link_t *link_hub[MAX_CALCS + 1];
  468.  
  469.  
  470.  
  471.  
  472.  
  473. GLOBAL const TCHAR *CalcModelTxt[]
  474.  
  475. #ifdef CALC_C
  476.  
  477. = { //"???",
  478.  
  479.     _T("TI-81"),
  480.  
  481.     _T("TI-82"),
  482.  
  483.     _T("TI-83"),
  484.  
  485.     _T("TI-85"),
  486.  
  487.     _T("TI-86"),
  488.  
  489.     _T("TI-73"),
  490.  
  491.     _T("TI-83+"),
  492.  
  493.     _T("TI-83+SE"),
  494.  
  495.     _T("TI-84+"),
  496.  
  497.     _T("TI-84+SE"),
  498.  
  499.     _T("???")}
  500.  
  501. #endif
  502.  
  503. ;
  504.  
  505.  
  506.  
  507. #define _HAS_CALC_H
  508.  
  509. #endif
Advertisement
Add Comment
Please, Sign In to add comment