| 1 | // (c) Copyright 2006-2007 notaz, All rights reserved. |
| 2 | // Free for non-commercial use. |
| 3 | |
| 4 | // For commercial use, separate licencing terms must be obtained. |
| 5 | |
| 6 | #include "port_config.h" |
| 7 | |
| 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | extern void *g_screen_ptr; |
| 13 | |
| 14 | #if SCREEN_SIZE_FIXED |
| 15 | #define g_screen_width SCREEN_WIDTH |
| 16 | #define g_screen_height SCREEN_HEIGHT |
| 17 | #else |
| 18 | extern int g_screen_width; |
| 19 | extern int g_screen_height; |
| 20 | #endif |
| 21 | |
| 22 | |
| 23 | #define EOPT_EN_SRAM (1<<0) |
| 24 | #define EOPT_SHOW_FPS (1<<1) |
| 25 | #define EOPT_EN_SOUND (1<<2) |
| 26 | #define EOPT_GZIP_SAVES (1<<3) |
| 27 | #define EOPT_MMUHACK (1<<4) |
| 28 | #define EOPT_NO_AUTOSVCFG (1<<5) |
| 29 | #define EOPT_16BPP (1<<7) |
| 30 | #define EOPT_RAM_TIMINGS (1<<8) |
| 31 | #define EOPT_CONFIRM_SAVE (1<<9) |
| 32 | #define EOPT_EN_CD_LEDS (1<<10) |
| 33 | #define EOPT_CONFIRM_LOAD (1<<11) |
| 34 | #define EOPT_A_SN_GAMMA (1<<12) |
| 35 | #define EOPT_PSYNC (1<<13) |
| 36 | |
| 37 | enum { |
| 38 | EOPT_SCALE_NONE = 0, |
| 39 | EOPT_SCALE_SW_H, |
| 40 | EOPT_SCALE_HW_H, |
| 41 | EOPT_SCALE_HW_HV, |
| 42 | }; |
| 43 | |
| 44 | typedef struct _currentConfig_t { |
| 45 | // char lastRomFile[512]; |
| 46 | int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves, |
| 47 | // mmuhack, no_save_cfg_on_exit, <unused>, 16_bit_mode |
| 48 | // craigix_ram, confirm_save, show_cd_leds, confirm_load |
| 49 | // A_SNs_gamma, perfect_vsync, giz_scanlines, giz_dblbuff |
| 50 | // vsync_mode, show_clock, no_frame_limitter |
| 51 | int s_PicoOpt; // for old cfg files only |
| 52 | int s_PsndRate; |
| 53 | int s_PicoRegion; |
| 54 | int s_PicoAutoRgnOrder; |
| 55 | int s_PicoCDBuffers; |
| 56 | int Frameskip; |
| 57 | int CPUclock; |
| 58 | int volume; |
| 59 | int gamma; |
| 60 | int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering |
| 61 | int rotation; // for UIQ |
| 62 | float scale; // psp: screen scale |
| 63 | float hscale32, hscale40; // psp: horizontal scale |
| 64 | int gamma2; // psp: black level |
| 65 | int turbo_rate; |
| 66 | } currentConfig_t; |
| 67 | |
| 68 | extern currentConfig_t currentConfig, defaultConfig; |
| 69 | extern char *PicoConfigFile; |
| 70 | extern int rom_loaded; |
| 71 | extern int state_slot; |
| 72 | extern int config_slot, config_slot_current; |
| 73 | extern unsigned char *movie_data; |
| 74 | extern int reset_timing; |
| 75 | |
| 76 | #define PICO_PEN_ADJUST_X 4 |
| 77 | #define PICO_PEN_ADJUST_Y 2 |
| 78 | extern int pico_pen_x, pico_pen_y; |
| 79 | extern int pico_inp_mode; |
| 80 | |
| 81 | extern char rom_fname_reload[512]; // ROM to try loading on next PGS_ReloadRom |
| 82 | extern char rom_fname_loaded[512]; // currently loaded ROM filename |
| 83 | |
| 84 | // engine states |
| 85 | extern int engineState; |
| 86 | enum TPicoGameState { |
| 87 | PGS_Paused = 1, |
| 88 | PGS_Running, |
| 89 | PGS_Quit, |
| 90 | PGS_KeyConfig, |
| 91 | PGS_ReloadRom, |
| 92 | PGS_Menu, |
| 93 | PGS_RestartRun, |
| 94 | PGS_Suspending, /* PSP */ |
| 95 | PGS_SuspendWake, /* PSP */ |
| 96 | }; |
| 97 | |
| 98 | |
| 99 | void emu_init(void); |
| 100 | void emu_finish(void); |
| 101 | |
| 102 | int emu_reload_rom(char *rom_fname); |
| 103 | int emu_save_load_game(int load, int sram); |
| 104 | void emu_reset_game(void); |
| 105 | |
| 106 | int emu_read_config(int game, int no_defaults); |
| 107 | int emu_write_config(int game); |
| 108 | |
| 109 | char *emu_get_save_fname(int load, int is_sram, int slot); |
| 110 | int emu_check_save_file(int slot); |
| 111 | void emu_setSaveStateCbs(int gz); |
| 112 | |
| 113 | void emu_make_path(char *buff, const char *end, int size); |
| 114 | void emu_update_input(void); |
| 115 | void emu_textOut8 (int x, int y, const char *text); |
| 116 | void emu_textOut16(int x, int y, const char *text); |
| 117 | void emu_get_game_name(char *str150); |
| 118 | void emu_set_fastforward(int set_on); |
| 119 | int emu_cd_check(int *pregion, char *fname_in); |
| 120 | |
| 121 | #ifdef __cplusplus |
| 122 | } // extern "C" |
| 123 | #endif |
| 124 | |